public class KeyValuesFromTextFile extends Object implements TypeFromGeneric<File,Hashtable<String,List<String>>>
Hashtable<String,List<String>>
. #ignored key1=value1 key1=value2 #ignored key1=value3 key2=value4 key3=value5 key3=value6 #ignored
MapUtils
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_COMMENT_INDICATOR
The default comment indicator, "#", if the line starts with this, it is ignored.
|
static String |
DEFAULT_KEY_VALUE_DIVIDER
The default key/value divider "="
|
Constructor and Description |
---|
KeyValuesFromTextFile()
Default constructor, using DEFAULT_KEY_VALUE_DIVIDER and DEFAULT_COMMENT_INDICATOR.
|
KeyValuesFromTextFile(String keyValueDivider,
String commentIndicator)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Hashtable<String,List<String>> |
fromType(String propertyName,
File from)
The method which converts K to the type T.
|
String |
getCommentIndicator()
The string which indicates that a String is a comment, if it starts with this.
|
String |
getKeyValueDivider()
Returns the string which divides the key and value in a string.
|
org.apache.commons.logging.Log |
getLogger()
Gets a logger.
|
List<String> |
getRestrictions()
Gets a detailed description of the TypeFromGeneric with any constraints that might influence the validation.
|
String |
getTypeName()
The simpel short name.
|
void |
validateConstraints(String propertyName)
Validates the constraints for the type.
|
public static final String DEFAULT_KEY_VALUE_DIVIDER
public static final String DEFAULT_COMMENT_INDICATOR
public KeyValuesFromTextFile()
public String getKeyValueDivider()
public String getCommentIndicator()
public Hashtable<String,List<String>> fromType(String propertyName, File from) throws PropertyException
TypeFromGeneric
fromType
in interface TypeFromGeneric<File,Hashtable<String,List<String>>>
propertyName
- the name of the property, this is Derived Property, not the Property which supplies the import for the type conversion.from
- the type KPropertyException
- if the conversion could not be performed.public String getTypeName()
TypeFromGeneric
getTypeName
in interface TypeFromGeneric<File,Hashtable<String,List<String>>>
public void validateConstraints(String propertyName) throws PropertyException
TypeFromGeneric
validateConstraints
in interface TypeFromGeneric<File,Hashtable<String,List<String>>>
propertyName
- the name of the property which validates the constraints, this is Derived Property, not the Property which supplies the import for the type conversion.PropertyException
- if the constraints do not hold.public List<String> getRestrictions()
TypeFromGeneric
getRestrictions
in interface TypeFromGeneric<File,Hashtable<String,List<String>>>
StringList
,
StringList.asUnmodifiableList()
public org.apache.commons.logging.Log getLogger()
TypeFromGeneric