Class ParseProperties

  extended by
All Implemented Interfaces:

public class ParseProperties
extends java.lang.Object
implements ParseNextProperty

Parse properties using a collection of expanders.

Ant 1.8.0

Constructor Summary
ParseProperties(Project project, java.util.Collection<PropertyExpander> expanders, GetProperty getProperty)
          Constructor with a getProperty.
Method Summary
 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.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public ParseProperties(Project project,
                       java.util.Collection<PropertyExpander> expanders,
                       GetProperty getProperty)
Constructor with a getProperty.

project - the current Ant project.
expanders - a sequence of expanders
getProperty - property resolver.
Method Detail


public Project getProject()
Get the project.

Specified by:
getProject in interface ParseNextProperty
the current Ant project.


public java.lang.Object parseProperties(java.lang.String value)
Decode properties from a String representation.

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.
the original string with the properties replaced, or null if the original string is null.


public boolean containsProperties(java.lang.String value)
Learn whether a String contains replaceable properties.

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)
Return any property that can be parsed from the specified position in the specified String.

Uses the configured PropertyExpanders and GetProperty instance .

Specified by:
parseNextProperty in interface ParseNextProperty
value - String to parse
pos - ParsePosition
Object or null if no property is at the current location. If a property reference has been found but the property doesn't expand to a value, the property's name is returned.