|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PropertyDescriptor
Describes a Property, and how it relates to its containing entity, which is
often a ComplexAttribute
.
A property descriptor defines the following about the property:
The concept of a descriptor is similar to that of a element declaration in xml. Consider the following xml schema definition:
<complexType name="someComplexType"> <sequence> <element name="foo" minOccurs="2" maxOccurs="4" type="xs:string" nillable="false"/> <sequence> <complexType>
//the complex type ComplexType complexType = ...; //get the descriptor PropertyDescriptor descriptor = complexType.getProperty( "foo" ); //make the following assertions descriptor.getName().getLocalPart().equals( "foo" ); descriptor.getType().getName().getNamespaceURI().equals( "http://www.w3.org/2001/XMLSchema" ) descriptor.getType().getName().getLocalPart().equals( "string" ); descriptor.getMinOccurs() == 2; descriptor.getMaxOccurs() == 4; descriptor.isNillable() == true; //the complex attribute ComplexAttribute complexAttribute = ... complexAttribute.getType() == complexType; //get the properties Collection properties = complexAttribute.getProperties( "foo" ); //make assertions about properties properties.size() >= 2; //minOccurs = 2 properties.size() <= 4; //maxOccurs = 4 for ( Property p : properties ) { p.getDescriptor() == descriptor p.getValue() != null; //nilable = false p.getType().getBinding() == String.class; //type = xs:string p.getValue() instanceof String; //type = xs:string }
Method Summary | |
---|---|
int |
getMaxOccurs()
The maximum number of occurrences of the property within its containing entity. |
int |
getMinOccurs()
The minimum number of occurrences of the property within its containing entity. |
Name |
getName()
The name of the property defined by the descriptor, with respect to its containing type or entity.. |
PropertyType |
getType()
The type of the property defined by the descriptor. |
Map<Object,Object> |
getUserData()
A map of "user data" which enables applications to store "application-specific" information against a property descriptor. |
boolean |
isNillable()
Flag indicating if null is an allowable value for the
property. |
Method Detail |
---|
PropertyType getType()
This value should never be null
. The type contains information
about the value of the property such as its java class.
Name getName()
This value may be null
in some instances. Also note that this
is not the same name as getType().getName()
. The former is
the name of the instance, the latter is the name of the type of the
instance.
int getMinOccurs()
This value is always an integer greater than or equal to zero.
int getMaxOccurs()
This value is a positive integer. A value of -1
means that
the max number of occurrences is unbounded.
boolean isNillable()
null
is an allowable value for the
property.
true
if the property is allowed to be null
,
otherwise false
.Map<Object,Object> getUserData()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |