public class FileStructurePropertyType extends PropertyType<File> implements MarkerPathPropertyType
java.io.File of the root directory which is retrieved from the PropertyIO.
public final static RootDirectoryNode DIR_ROOT = new RootDirectoryNode();
public final static DirectoryNode DIR_CONF = new DirectoryNode("conf",DIR_ROOT);
public final static DirectoryNode DIR_REPORTS = new DirectoryNode("reports",DIR_ROOT);
public final static DirectoryNode DIR_REPORTS_ACTIVE = new DirectoryNode("active",DIR_REPORTS);
public final static DirectoryNode DIR_REPORTS_INACTIVE = new DirectoryNode("inactive",DIR_REPORTS);
public final static DirectoryNode DIR_TEM P= new DirectoryNode("temp",DIR_ROOT);
public final static DirectoryNode DIR_DELETED = new DirectoryNode("deleted",DIR_ROOT);
public final static FileNode FILE_USERS_XML = new FileNode("users.xml",DIR_CONF);
public final static FileNode FILE_REPORTS_XML = new FileNode("reports.xml",DIR_CONF);
Than the type constructor will be : Property<File> A_PROPERTY = new Property<File>("a.property.name", new FileStructurePropertyType(DIR_ROOT));
java.io.File from any node by using the getFile(). DIR_REPORTS_ACTIVE.getFile()
A_PROPERTY.getRootDirectoryNode()and you will have the valid directory to work from.
FileValidator for files and directories. null is returned. RootDirectoryNode,
DirectoryNode,
FileNode,
FilterFileNode,
AbstractTreeNode,
FileValidator,
DefaultDirectoryValidator,
DefaultFileValidator,
DefaultXmlFileValidator,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
static String |
TYPE
The type name string constant of FileStructurePropertyType
|
| Constructor and Description |
|---|
FileStructurePropertyType()
Constructor, an instance of
RootDirectoryNode MUST be set at a later time. |
FileStructurePropertyType(RootDirectoryNode rootDirectoryNode)
Constructor, requires a instance of
RootDirectoryNode. |
FileStructurePropertyType(RootDirectoryNodeLocator rootDirectoryNodeLocator)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getRestrictions()
Gets a detailed description of the PropertyType with any constraints that might influence the validation.
|
RootDirectoryNode |
getRootDirectoryNode()
The root node of the file structure.
|
RootDirectoryNodeLocator |
getRootDirectoryNodeLocator()
Gets the implementation of RootDirectoryNodeLocator.
|
void |
setRootDirectoryNode(RootDirectoryNode rootDirectoryNode)
Sets the RootDirectoryNode for where the File structure eminates.
|
void |
setRootDirectoryNodeLocator(RootDirectoryNodeLocator rootDirectoryNodeLocator)
Sets the rootDirectoryNodeLocator.
|
String |
toString(String propertyName,
File t)
Converts a typed to the string representation.
|
void |
validateConstraints(String propertyName)
Will invalidate if:
The RootDirectoryNodeLocater is null.
The RootDirectoryNode is null.
|
File |
validateValue(String propertyName,
String value)
Converts the string representation of to a typed value.
|
equals, getDefaultValue, getDefaultValueAsString, getDefaultValueDescription, getDescription, getDescription, getInitializationPriority, getIo, getLogger, getTypeName, hasDefaultValue, isDefaultValueValid, postGetValueProcessing, setDefaultValue, setInitializationPriority, setIo, setTypedValue, setTypeName, toType, validate, validateNullTypepublic static final String TYPE
public FileStructurePropertyType()
RootDirectoryNode MUST be set at a later time.public FileStructurePropertyType(RootDirectoryNode rootDirectoryNode)
RootDirectoryNode.rootDirectoryNode - the root node of the file structure to initialize and validate. This will set the RootDirectoryNode in a instance of DefaultRootDirectoryNodeLocator.setRootDirectoryNode(RootDirectoryNode),
DefaultRootDirectoryNodeLocatorpublic FileStructurePropertyType(RootDirectoryNodeLocator rootDirectoryNodeLocator)
rootDirectoryNodeLocator - an implementation of RootDirectoryNodeLocator interface. If null than either RootDirectoryNodeLocator or RootDirectoryNode MUST be set at a later time.public RootDirectoryNodeLocator getRootDirectoryNodeLocator()
RootDirectoryNodeLocatorpublic void setRootDirectoryNodeLocator(RootDirectoryNodeLocator rootDirectoryNodeLocator)
rootDirectoryNodeLocator - the RootDirectoryNodeLocator.public RootDirectoryNode getRootDirectoryNode()
public void setRootDirectoryNode(RootDirectoryNode rootDirectoryNode)
rootDirectoryNode - the root directory node.DefaultRootDirectoryNodeLocatorpublic List<String> getRestrictions()
PropertyTypegetRestrictions in class PropertyType<File>public File validateValue(String propertyName, String value) throws PropertyException
PropertyTypevalidateValue in class PropertyType<File>propertyName - the name of the property used for logging purposes. To uniquely identify the Property with validation issues.value - the string representation of the propertyPropertyException - if the conversion failed.public void validateConstraints(String propertyName) throws PropertyException
null.null.validateConstraints in class PropertyType<File>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()public String toString(String propertyName, File t) throws PropertyException
PropertyTypetoString in class PropertyType<File>propertyName - the name of the property used for logging purposes.t - the type T.PropertyException - if conversion failed in validation.PropertyType.validate(String, String)