public class KeyMultiLineValuesFromTextFile extends Object implements TypeFromGeneric<File,Hashtable<String,List<List<String>>>>
Hashtable<String,List<List<String>>>. !key1 value1 line1 value1 line2 #value1 ignored value1 line3 !key2 value2 line1 !key1 value3 line1 value3 line2 value3 line3 !key3 #value4 ignored value4 line1 value4 line2
| 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_INDICATOR
The default key indicator "!"
|
| Constructor and Description |
|---|
KeyMultiLineValuesFromTextFile()
Default constructor using DEFAULT_KEY_INDICATOR and DEFAULT_COMMENT_INDICATOR
|
KeyMultiLineValuesFromTextFile(String keyIndicator,
String commentIndicator)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
Hashtable<String,List<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 |
getKeyIndicator()
The key indictor
|
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_INDICATOR
public static final String DEFAULT_COMMENT_INDICATOR
public KeyMultiLineValuesFromTextFile()
DEFAULT_KEY_INDICATOR,
DEFAULT_COMMENT_INDICATORpublic KeyMultiLineValuesFromTextFile(String keyIndicator, String commentIndicator)
keyIndicator - the none empty string when which starts a line, it indicates that the rest of line is the key, and every line below is its values, until a new key or EOF.commentIndicator - if a line starts with this string (indicator) it is ignore.public String getKeyIndicator()
public String getCommentIndicator()
public Hashtable<String,List<List<String>>> fromType(String propertyName, File from) throws PropertyException
TypeFromGenericfromType in interface TypeFromGeneric<File,Hashtable<String,List<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()
TypeFromGenericgetTypeName in interface TypeFromGeneric<File,Hashtable<String,List<List<String>>>>public void validateConstraints(String propertyName) throws PropertyException
TypeFromGenericvalidateConstraints in interface TypeFromGeneric<File,Hashtable<String,List<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()
TypeFromGenericgetRestrictions in interface TypeFromGeneric<File,Hashtable<String,List<List<String>>>>StringList,
StringList.asUnmodifiableList()public org.apache.commons.logging.Log getLogger()
TypeFromGeneric