public class TextFromFilePropertyType extends DerivedFromSinglePropertyType<File,String> implements MarkerPathPropertyType
Property<File> FILE_PROPERTY = new Property<File>("file.property", new FilePropertyType(new File("c:\temp\test.htm")); Property<String> A_PROPERTY= new Property<String>("name", new TextFromFilePropertyType(FILE_PROPERTY));
Modifier and Type | Field and Description |
---|---|
static String |
TYPE
The type name string constant of TextFromFile implementation.
|
Constructor and Description |
---|
TextFromFilePropertyType(Property<File> derivedFromFile)
Loads a property value into a String, derived from a File using the Charset.defaultCharset() encoding.
|
TextFromFilePropertyType(Property<File> derivedFromFile,
Charset encoding)
Loads a property value into a String, derived from a File.
|
TextFromFilePropertyType(Property<File> derivedFromFile,
Charset encoding,
String defaultValue)
Loads a property value into a String, derived from a File.
|
TextFromFilePropertyType(Property<File> derivedFromFile,
String encoding)
Loads a property value into a String, derived from a File.
|
TextFromFilePropertyType(Property<File> derivedFromFile,
String encoding,
String defaultValue)
Loads a property value into a String, derived from a File.
|
Modifier and Type | Method and Description |
---|---|
List<String> |
getDerivedToRestrictions()
Gets a detailed description of the "Derived->TO->PropertyType" with any constraints that might influence the validation.
Without any futher description of of the properties it is derived from, this is taken care of in the method "getDerivedFromRestrictions". |
String |
getEncoding() |
void |
validateConstraints(String propertyName)
Validates the TextFromFile type constraints.
|
String |
validateDerivedValue(String propertyName)
Loads the file with the FileUtils.
|
getDerivedFromProperty, getDerivedFromPropertyValue
getDerivedFrom, getDerivedFromCount, getDerivedFromProperty, getDerivedFromRestrictions, getMaxDerivedFrom, getMinDerivedFrom, getRestrictions, isMinAndMaxTheSame, isUseMaxDerivedFrom, isUseMinDerivedFrom, validateValue
equals, getDefaultValue, getDefaultValueAsString, getDefaultValueDescription, getDescription, getDescription, getInitializationPriority, getIo, getLogger, getTypeName, hasDefaultValue, isDefaultValueValid, postGetValueProcessing, setDefaultValue, setInitializationPriority, setIo, setTypedValue, setTypeName, toString, toType, validate, validateNullType
public static final String TYPE
public TextFromFilePropertyType(Property<File> derivedFromFile, String encoding)
derivedFromFile
- the Property which defines the file to load from.encoding
- the encoding of the file, where the encoding is parsed as a string.public TextFromFilePropertyType(Property<File> derivedFromFile, Charset encoding) throws NullPointerException
derivedFromFile
- the Property which defines the file to load from.encoding
- the encoding of the file, where the encoding is parsed as a Charset.NullPointerException
- if encoding is null
. *StandardCharsets
public TextFromFilePropertyType(Property<File> derivedFromFile)
derivedFromFile
- derivedFromFile the Property which defines the file to load from.Charset.defaultCharset()
public TextFromFilePropertyType(Property<File> derivedFromFile, String encoding, String defaultValue)
derivedFromFile
- the Property which defines the file to load from.encoding
- the encoding of the file, where the encoding is parsed as a string.public TextFromFilePropertyType(Property<File> derivedFromFile, Charset encoding, String defaultValue) throws NullPointerException
derivedFromFile
- the Property which defines the file to load from.encoding
- the encoding of the file, where the encoding is parsed as a Charset.NullPointerException
- if encoding is null
.StandardCharsets
public String getEncoding()
public List<String> getDerivedToRestrictions()
DerivedPropertyType
getDerivedToRestrictions
in class DerivedPropertyType<String>
public String validateDerivedValue(String propertyName) throws PropertyException
validateDerivedValue
in class DerivedPropertyType<String>
propertyName
- the name of derived PropertyPropertyException
- if it could not be converted into type T.FileUtils.loadAsString(String, File, String)
public void validateConstraints(String propertyName) throws PropertyException
validateConstraints
in class DerivedPropertyType<String>
propertyName
- the name of the property used for logging purposes, to
identify the unique property which PropertyType has constraint
issues.PropertyException
- if the constraints have invalid/conflicting values.Property.validate()