public class ParseProperties extends java.lang.Object implements ParseNextProperty
Constructor and Description |
---|
ParseProperties(Project project,
java.util.Collection<PropertyExpander> expanders,
GetProperty getProperty)
Constructor with a getProperty.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsProperties(java.lang.String value)
Learn whether a String contains replaceable properties.
|
Project |
getProject()
Get the project.
|
java.lang.Object |
parseNextProperty(java.lang.String value,
java.text.ParsePosition pos)
Return any property that can be parsed from the specified position
in the specified String.
|
java.lang.Object |
parseProperties(java.lang.String value)
Decode properties from a String representation.
|
public ParseProperties(Project project, java.util.Collection<PropertyExpander> expanders, GetProperty getProperty)
project
- the current Ant project.expanders
- a sequence of expandersgetProperty
- property resolver.public Project getProject()
getProject
in interface ParseNextProperty
public java.lang.Object parseProperties(java.lang.String value)
value
parameter (unsurprisingly) at the beginning and asks each
PropertyExpander
whether there is a
property reference at that point. PropertyExpanders return
the name of a property they may find and may advance the parse
position.null
the
method continues with the next PropertyExpander, otherwise it
tries to look up the property's value using the configured
GetProperty
instance.value
is exhausted.If the entire contents of value
resolves to a
single property, the looked up property value is returned.
Otherwise a String is returned that concatenates the
non-property parts of value
and the expanded
values of the properties that have been found.
value
- The string to be scanned for property references.
May be null
, in which case this
method returns immediately with no effect.null
if the original string is null
.public boolean containsProperties(java.lang.String value)
Uses the configured PropertyExpanders
and scans through the string. Returns true
as soon as any expander finds a property.
value
- the String to check.true
if value
contains property notation.public java.lang.Object parseNextProperty(java.lang.String value, java.text.ParsePosition pos)
Uses the configured PropertyExpanders
and GetProperty
instance .
parseNextProperty
in interface ParseNextProperty
value
- String to parsepos
- ParsePosition