T - Type of the PropertyTag and the type of the generated
objectpublic class PropertyEntryMaker<T> extends java.lang.Object implements ContainerEntryMaker
PropertyTag with a ValueParser. The the
purpose of the PropertyEntryMaker it to parse a string and
construct an object using the data contained in the string. The object will
have the same datatype as the one supported by the PropertyTag
and thus the PropertyTag and generated object may be used as a
key-value pair in a PropertyContainer.| Constructor and Description |
|---|
PropertyEntryMaker(PropertyTag<T> tag,
ValueParser<? extends T> parser)
Constructs a new
PropertyEntryMaker around an existing
PropertyTag. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getName()
Returns the name of this
PropertyEntryMaker, which will be the
same as the name of it's PropertyTag. |
ValueParser<? extends T> |
getParser()
Returns the parser this
PropertyEntryMaker uses to generate
objects of type T from string values. |
PropertyTag<T> |
getPropertyTag()
Returns the
PropertyTag this maker parses values for. |
java.lang.Class<? super T> |
getTarget()
The type of class this
PropertyEntryMaker parses string to |
void |
setValue(PropertyContainer contanier,
java.lang.String valueString)
Parses the specified string and adds the generated value to
container using this PropertyEntryMaker's
PropertyTag as the key |
void |
setValue(PropertyMap map,
java.lang.String valueString)
Parses the specified string and adds the generated value to
PropertyContainer using this
PropertyEntryMaker's
PropertyTag as the key. |
java.lang.String |
toString() |
public PropertyEntryMaker(PropertyTag<T> tag, ValueParser<? extends T> parser) throws java.lang.NullPointerException
PropertyEntryMaker around an existing
PropertyTag.java.lang.NullPointerException - If tag or parser are nulltag - The PropertyTag this maker may parse values forparser - The parser used to generate the object of type T from a given
stringpublic java.lang.String getName()
PropertyEntryMaker, which will be the
same as the name of it's PropertyTag.PropertyEntryMakerpublic ValueParser<? extends T> getParser()
PropertyEntryMaker uses to generate
objects of type T from string values.PropertyEntryMaker's parserpublic PropertyTag<T> getPropertyTag()
PropertyTag this maker parses values for.PropertyEntryMaker's PropertyTagpublic java.lang.Class<? super T> getTarget()
PropertyEntryMaker parses string toPropertyEntryMaker's datatypepublic void setValue(PropertyContainer contanier, java.lang.String valueString) throws java.lang.IllegalArgumentException, InvalidPropertyException, java.lang.NullPointerException
container using this PropertyEntryMaker's
PropertyTag as the keysetValue in interface ContainerEntryMakerjava.lang.IllegalArgumentException - If valueString is not of a format that allows this
maker to convert it into an object of type TInvalidPropertyException - If the container cannot contain this parser's
PropertyTagjava.lang.NullPointerException - If container is null or valueString is
null and this the parser does not support null
stringscontanier - The container to add this parser's PropertyTag and
parsed value tovalueString - The string to parse and convert into an object of type Tpublic void setValue(PropertyMap map, java.lang.String valueString) throws java.lang.IllegalArgumentException, java.lang.NullPointerException
PropertyEntryMaker's
PropertyTag as the key. This method differs from
setValue(PropertyContainer, String) in that it can't throw an
InvalidPropertyException (PropertyMaps don't when
properties are set in them, unlike PropertyContainers)setValue in interface ContainerEntryMakerjava.lang.IllegalArgumentException - If valueString is not of a format that allows this
maker to convert it into an object of type Tjava.lang.NullPointerException - If valueString is null and this maker does not
support null stringsmap - The container to add this parser's PropertyTag and
parsed value tovalueString - The string to parse and convert into an object of type Tpublic java.lang.String toString()
toString in class java.lang.Object