|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsoftparsmap.StringTemplate
This class can extract string information from a string template or create a string given a template and data. To clarify see following example.
StringTemplate st = new StringTemplate("family{number}.tree", "{", "}"); st.setMarker("{number}", "100"); System.out.println(st.getPaintedTemplate()); st.paintTemplate("family200.tree"); System.out.println(st.getFirstValue("{number}"));
This will print
family100.tree 200
Constructor Summary | |
StringTemplate(java.lang.String template,
java.lang.String startMarker,
java.lang.String stopMarker)
Construct a string template from a template and what markers start and stop with. |
Method Summary | |
java.lang.String |
getFirstValue(java.lang.String marker)
Returns the value of the first marker named as given. |
java.lang.String |
getPaintedTemplate()
After markers have been set, calling this method will return the template with its markers painted accordingly. |
boolean |
hasMarker(java.lang.String marker)
Returns true if the marker exists in the template. |
void |
paintTemplate(java.lang.String value)
If the value matches the template the markers will be set to corresponding values. |
void |
paintTemplateWithMarkerNames()
Sets the markers with their own names. |
void |
setMarker(java.lang.String marker,
java.lang.String newValue)
Sets a marker to a new value. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StringTemplate(java.lang.String template, java.lang.String startMarker, java.lang.String stopMarker)
template
- is the templatestartMarker
- defines how markers beginstopMarker
- defines how markers endMethod Detail |
public void setMarker(java.lang.String marker, java.lang.String newValue)
marker
- is the markernewValue
- is the new valuepublic void paintTemplateWithMarkerNames()
public java.lang.String getPaintedTemplate()
public void paintTemplate(java.lang.String value)
value
- is string matching the templatepublic boolean hasMarker(java.lang.String marker)
public java.lang.String getFirstValue(java.lang.String marker)
marker
- is the marker
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |