public class UniqueFileNameValidator extends Object implements net.sf.jguiraffe.transform.Validator
A specialized Validator
implementations for checking whether the name
entered for a new file does not exist in the current directory.
In the validation method this class obtains the data object with the content of the current directory (which is available as a typed property from the context). Then it checks whether the name entered by the user already exists in this directory. If this is the case, validation fails and an error message is produced.
Modifier and Type | Field and Description |
---|---|
static String |
ERR_FILE_EXISTS
Constant for the error message produced by this validator.
|
Constructor and Description |
---|
UniqueFileNameValidator() |
Modifier and Type | Method and Description |
---|---|
net.sf.jguiraffe.transform.ValidationResult |
isValid(Object o,
net.sf.jguiraffe.transform.TransformerContext ctx)
Performs the validation.
|
public static final String ERR_FILE_EXISTS
public net.sf.jguiraffe.transform.ValidationResult isValid(Object o, net.sf.jguiraffe.transform.TransformerContext ctx)
isValid
in interface net.sf.jguiraffe.transform.Validator
o
- the object to be validated (this is the file name; null
names are accepted)ctx
- the validation contextCopyright © 2016 The JGUIraffe Team. All Rights Reserved.