|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.syphr.prom.Reference
public class Reference
This class encapsulates a reference to another property from within a property's value.
For example, using an Ant-like Evaluator
, a property may look like
some.property = some value ${nested}
where ${nested}
is
the reference.
Constructor Summary | |
---|---|
Reference(String name,
String value,
int startPosition,
int endPosition)
Construct a new reference. |
Method Summary | |
---|---|
void |
addReference(Reference ref)
Add a sub reference to this instance. |
boolean |
equals(Object obj)
|
int |
getEndPosition()
Retrieve the end index (inclusive) of this reference in the original value in which it was nested. |
String |
getName()
Retrieve the name of this reference. |
List<Reference> |
getReferences()
Retrieve a list of sub-references contained within the value of this reference. |
int |
getStartPosition()
Retrieve the start index (inclusive) of this reference in the original value in which it was nested. |
String |
getValue()
Retrieve the value of this reference, which may contain other references. |
int |
hashCode()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Reference(String name, String value, int startPosition, int endPosition)
name
- the name of the referencevalue
- the value of the referencestartPosition
- the starting location (inclusive) of the entire reference (not just the
name) in its original contextendPosition
- the ending location (inclusive) of the entire reference (not just the
name) in its original contextMethod Detail |
---|
public String getName()
public String getValue()
public int getStartPosition()
Evaluator
and a reference "
${reference}
", the start position would be the '$
'.
StringBuilder originalValue = new StringBuilder(original);
String evaluated = originalValue.replace(ref.getStartPosition(), ref.getEndPostion(), ref.getValue());
getEndPosition()
public int getEndPosition()
Evaluator
and a reference "
${reference}
", the end position would be the '}
'.
StringBuilder originalValue = new StringBuilder(original);
String evaluated = originalValue.replace(ref.getStartPosition(), ref.getEndPostion(), ref.getValue());
getStartPosition()
public void addReference(Reference ref)
Evaluator
when building a reference.
ref
- the reference to addpublic List<Reference> getReferences()
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |