public class TypeListFromTextFile<T> extends Object implements TypeFromGeneric<File,List<T>>
TypeListFromTextFilePropertyType
Modifier and Type | Field and Description |
---|---|
static String |
TYPE
The type name string constant of TypeListFromTextFile implementation.
|
Constructor and Description |
---|
TypeListFromTextFile(PropertyType<T> propertyType)
Constructor, using default charset and no lines is ignored.
|
TypeListFromTextFile(PropertyType<T> propertyType,
Charset encoding,
String ignoreLineRegex)
Constructor.
|
TypeListFromTextFile(PropertyType<T> propertyType,
String ignoreLineRegex)
Constructor, using default charset.
|
TypeListFromTextFile(PropertyType<T> propertyType,
String encoding,
String ignoreLineRegex)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
List<T> |
fromType(String propertyName,
File fromFile)
The method which converts K to the type T.
|
String |
getEncoding()
The enconding of the file.
|
String |
getIgnoreLineRegex()
The regular expression used to tell if a line shouild be ignored.
|
org.apache.commons.logging.Log |
getLogger()
Gets a logger.
|
Pattern |
getPattern()
Gets the compile Pattern from IgnoreLineRegex, this is
null ubtil first time it is used or IgnoreLineRegex is null . |
PropertyType<T> |
getPropertyType()
The PropertyType used to convert a line to a Type T.
|
List<String> |
getRestrictions()
Gets a detailed description of the TypeFromGeneric with any constraints that might influence the validation.
|
String |
getTypeName()
The resulting type.
|
void |
validateConstraints(String propertyName)
Will validate that the
PropertyType isnt
null .
Encoding isnt null or emptr and is valid.
The IgnoreLineRegex is valid if it is not null .
|
public static final String TYPE
public TypeListFromTextFile(PropertyType<T> propertyType)
propertyType
- the type which is each line will be validated/converted with.public TypeListFromTextFile(PropertyType<T> propertyType, String ignoreLineRegex)
propertyType
- the type which is each line will be validated/converted with.ignoreLineRegex
- the regular expression if "find" the line is ignored, if this is null
than it is not used.Matcher.find()
public TypeListFromTextFile(PropertyType<T> propertyType, Charset encoding, String ignoreLineRegex)
propertyType
- the type which is each line will be validated/converted with.encoding
- the encoding use to load the text file.ignoreLineRegex
- the regular expression if "find" the line is ignored, if this is null
than it is not used.Matcher.find()
public TypeListFromTextFile(PropertyType<T> propertyType, String encoding, String ignoreLineRegex)
propertyType
- the type which is each line will be validated/converted with.encoding
- the encoding use to load the text file.ignoreLineRegex
- the regular expression if "find" the line is ignored, if this is null
than it is not used.Matcher.find()
public PropertyType<T> getPropertyType()
public String getEncoding()
public String getIgnoreLineRegex()
null
no lines is ignored.Matcher.find()
public Pattern getPattern()
null
ubtil first time it is used or IgnoreLineRegex is null
.public List<T> fromType(String propertyName, File fromFile) throws PropertyException
TypeFromGeneric
fromType
in interface TypeFromGeneric<File,List<T>>
propertyName
- the name of the property, this is Derived Property, not the Property which supplies the import for the type conversion.fromFile
- the type KPropertyException
- if the conversion could not be performed.public String getTypeName()
getTypeName
in interface TypeFromGeneric<File,List<T>>
public void validateConstraints(String propertyName) throws PropertyException
null
.null
or emptr and is valid.null
.validateConstraints
in interface TypeFromGeneric<File,List<T>>
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,List<T>>
StringList
,
StringList.asUnmodifiableList()
public org.apache.commons.logging.Log getLogger()
TypeFromGeneric
getLogger
in interface TypeFromGeneric<File,List<T>>