public class PropertyDescriptor extends Object implements Serializable, com.escenic.module.CanContainModules
ContentDescriptor
to define allowed properties for a Content
. A
PropertyDescriptor may also have a default value.
A PropertyDescriptor
can optionally contain some user specified values which are exposed as Module
s.
This is added to the property descriptor when it is created on the server side. All foreign markup that is defined in
the content-type field definition will be added to the modules.
Any user of this class may decide to use these Module
s to do some client specific task. No validation or
error handling on the values of these Module
s are done on the PropertyDescriptor
.
Note: Unlike PropertyDescriptor
, this doesn't conform with the JavaBeans
specification.
TODO: add Better validation rulesConstructor and Description |
---|
PropertyDescriptor(PropertyDescriptor pOriginalDescriptor,
String pLabel,
String pDescription) |
PropertyDescriptor(String pName,
Class<?> pType) |
PropertyDescriptor(String pName,
Class<?> pType,
boolean pReadOnly) |
PropertyDescriptor(String pName,
Class<?> pType,
String pMimetype,
Collection<Constraint> pConstraints) |
PropertyDescriptor(String pName,
Class<?> pType,
String pMimetype,
Object pDefaultValue,
Collection<? extends Constraint> pConstraints,
boolean pReadOnly) |
PropertyDescriptor(String pName,
Class<?> pType,
String pLabel,
String pDescription,
String pMimetype,
Object pDefaultValue,
Collection<? extends Constraint> pConstraints,
List<com.escenic.module.Module> pModules,
boolean pReadOnly) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
List<Constraint> |
getConstraints() |
Object |
getDefaultValue() |
String |
getDescription() |
String |
getLabel() |
String |
getMimetype() |
com.escenic.module.Module |
getModule(URI pURI,
String pElementName)
The first module instance with the URI and element name as specified, and with no attributes, or
null if
there is no module which matches. |
com.escenic.module.Module |
getModule(URI pURI,
String pElementName,
String pAttributeName,
String pValue)
The first module instance with the URI and element name as specified, and with an attribute value as specified, or
null if there is no module which matches. |
List<com.escenic.module.Module> |
getModules()
Gets all the modules regardless of namespace.
|
List<com.escenic.module.Module> |
getModules(URI pURI)
Return a list of Module instances for the containing element.
|
List<com.escenic.module.Module> |
getModules(URI pURI,
String pElementName)
Return a list of module instances with the URI and element name as specified.
|
List<com.escenic.module.Module> |
getModules(URI pURI,
String pElementName,
String pAttributeName,
String pValue)
Return a list of module instances with the URI and element name as specified, and with an attribute value as
specified.
|
String |
getName() |
Class<?> |
getType() |
int |
hashCode() |
boolean |
hasModules()
If there are any modules registered, this would return true.
|
boolean |
isAssignable(Object pValue)
Validate that the type of the parameter is assignable to this property.
|
boolean |
isNullable() |
boolean |
isReadOnly() |
boolean |
isValid(Object pValue)
Validate that this value is
assignable and valid according to the
constraints (business rules) of this property. |
String |
toString() |
public PropertyDescriptor(String pName, Class<?> pType, String pMimetype, Collection<Constraint> pConstraints)
public PropertyDescriptor(String pName, Class<?> pType, String pMimetype, Object pDefaultValue, Collection<? extends Constraint> pConstraints, boolean pReadOnly)
public PropertyDescriptor(PropertyDescriptor pOriginalDescriptor, String pLabel, String pDescription)
public PropertyDescriptor(String pName, Class<?> pType, String pLabel, String pDescription, String pMimetype, Object pDefaultValue, Collection<? extends Constraint> pConstraints, List<com.escenic.module.Module> pModules, boolean pReadOnly)
public String getName()
public String getLabel()
public String getDescription()
public Class<?> getType()
public boolean isReadOnly()
public Object getDefaultValue()
public List<Constraint> getConstraints()
public String getMimetype()
public boolean isAssignable(Object pValue)
null
values are always allowed.
To validate the business rules for this property isValid(Object)
.pValue
- value to test assignability of.public boolean isValid(Object pValue)
assignable
and valid according to the
constraints
(business rules) of this property.
TODO: This methods should return ValidationResultpValue
- value to test.public com.escenic.module.Module getModule(URI pURI, String pElementName, String pAttributeName, String pValue)
com.escenic.module.CanContainModules
null
if there is no module which matches.getModule
in interface com.escenic.module.CanContainModules
pURI
- The URI of the namespace of the markuppElementName
- The name of the element you are looking fornull
if no such module exists.public com.escenic.module.Module getModule(URI pURI, String pElementName)
com.escenic.module.CanContainModules
null
if
there is no module which matches.getModule
in interface com.escenic.module.CanContainModules
pURI
- The URI of the namespace of the markuppElementName
- The name of the element you are looking fornull
if no such module exists.public List<com.escenic.module.Module> getModules()
com.escenic.module.CanContainModules
getModules
in interface com.escenic.module.CanContainModules
public List<com.escenic.module.Module> getModules(URI pURI)
com.escenic.module.CanContainModules
getModules
in interface com.escenic.module.CanContainModules
pURI
- The URI of the namespace of the markuppublic List<com.escenic.module.Module> getModules(URI pURI, String pElementName)
com.escenic.module.CanContainModules
getModules
in interface com.escenic.module.CanContainModules
pURI
- The URI of the namespace of the markuppElementName
- The name of the element you are looking forpublic List<com.escenic.module.Module> getModules(URI pURI, String pElementName, String pAttributeName, String pValue)
com.escenic.module.CanContainModules
getModules
in interface com.escenic.module.CanContainModules
pURI
- The URI of the namespace of the markuppElementName
- The name of the element you are looking forpAttributeName
- The name of the attribute you want to look forpValue
- The value of the attribute you want to look for, or null
if you want an element without this
attribute.public boolean hasModules()
com.escenic.module.CanContainModules
hasModules
in interface com.escenic.module.CanContainModules
true
if any modules exist.public boolean isNullable()
© 1998- 2018 Stibo DX