Interface ComplexType
-
- All Superinterfaces:
AttributeType
,PropertyType
- All Known Subinterfaces:
FeatureType
,SimpleFeatureType
- All Known Implementing Classes:
AbstractLazyComplexTypeImpl
,ComplexFeatureTypeImpl
,ComplexTypeImpl
,ComplexTypeProxy
,FeatureTypeImpl
,FeatureTypeProxy
,NonFeatureTypeProxy
,SimpleFeatureTypeImpl
,UniqueNameFeatureTypeImpl
,VPFFeatureClass
,VPFFeatureType
public interface ComplexType extends AttributeType
The type of a complex attribute.
Similar to how a complex attribute is composed of other properties, a complex type is composed of property descriptors. A complex type is very much like a complex type from xml schema. Consider the following xml schema complex type:
<element name="myComplexElement" type="myComplexType"/> <complexType name="myComplexType"> <sequence> <element name="foo" type="xs:string" minOccurs="2" maxOccurs="4"> <element name="bar" type="xs:int" nillable=false/> </sequence> </complexType>
The corresponding complex type that would emerge would be composed as follows:ComplexType complexType = ...; complexType.getProperties().size() == 2; //the foo property descriptor PropertyDescriptor foo = complexType.getProperty( "foo" ); foo.getName().getLocalPart() == "foo"; foo.getMinOccurs() == 2; foo.getMaxOccurs() == 4; foo.isNillable() == true; foo.getType().getName().getLocalPart() == "string"; //the bar property descriptor PropertyDescriptor bar = complexType.getProperty( "bar" ); foo.getName().getLocalPart() == "bar"; foo.getMinOccurs() == 1; foo.getMaxOccurs() == 1; foo.isNillable() == false; foo.getType().getName().getLocalPart() == "int";
Now consider the following xml instance document:<myComplexElement> <foo>one</foo> <foo>two</foo> <foo>three</foo> <bar>1</bar> </myComplexElement>
The resulting complex attribute would be composed as follows:ComplexAttribute attribute = ...; attribute.getName().getLocalPart() == "myComplexElement"; attribute.getType().getName().getLocalPart() == "myComplexType"; Collection foo = attribute.getProperties( "foo" ); foo.size() == 3; foo.get(0).getValue() == "one"; foo.get(1).getValue() == "two"; foo.get(2).getValue() == "three"; Property bar = attribute.getProperty( "bar" ); bar.getValue() == 1;
- Author:
- Jody Garnett (Refractions Research), Justin Deoliveira (The Open Planning Project)
- See Also:
ComplexAttribute
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Class<Collection<Property>>
getBinding()
Override and type narrow to Collection.class. PropertyDescriptor
getDescriptor(String name)
Describe a single property by unqualified name.PropertyDescriptor
getDescriptor(Name name)
Describe a single property by name.Collection<PropertyDescriptor>
getDescriptors()
The property descriptor which compose the complex type.boolean
isInline()
Indicates ability of XPath to notice this attribute.-
Methods inherited from interface AttributeType
getSuper, isIdentified
-
Methods inherited from interface PropertyType
equals, getDescription, getName, getRestrictions, getUserData, hashCode, isAbstract
-
-
-
-
Method Detail
-
getBinding
Class<Collection<Property>> getBinding()
Override and type narrow to Collection.class. - Specified by:
getBinding
in interfacePropertyType
- Returns:
- The binding of the property type.
-
getDescriptors
Collection<PropertyDescriptor> getDescriptors()
The property descriptor which compose the complex type.A complex type can be composed of attributes and associations which means this collection returns instances of
AttributeDescriptor
andAssociationDescriptor
.- Returns:
- Collection of descriptors representing the composition of the complex type.
-
getDescriptor
PropertyDescriptor getDescriptor(Name name)
Describe a single property by name.This method returns
null
if no such property is found.- Parameters:
name
- The name of the property to get.- Returns:
- The property matching the specified name, or
null
.
-
getDescriptor
PropertyDescriptor getDescriptor(String name)
Describe a single property by unqualified name.Note: Special care should be taken when using this method in the case that two properties with the same local name but different namespace uri exist. For this reason using
getDescriptor(Name)
is safer.This method returns
null
if no such property is found.- Parameters:
name
- The name of the property to get.- Returns:
- The property matching the specified name, or
null
.
-
isInline
boolean isInline()
Indicates ability of XPath to notice this attribute.This facility is used to "hide" an attribute from XPath searches, while the compelx contents will still be navigated no additional nesting will be considered. It will be as if the content were "folded" inline resulting in a flatter nesting structure.
Construct described using Java Interfaces:
The above is can hold the following information:interface TestSample { String name; List
measurement; } interface Measurement { long timestamp; Point point; long reading; }
Out of the box this is represented to XPath as the following tree:[ name="survey1", measurements=( [timestamp=3,point=(2,3), reading=4200], [timestamp=9,point=(2,4), reading=445600], ) ]
By inlining Measurement we can achive the following:root/name: survey1 root/measurement[0]/timestamp:3 root/measurement[0]/point: (2,3) root/measurement[0]/reading: 4200 root/measurement[1]/timestamp:9 root/measurement[2]/point: (2,4) root/measurement[3]/reading: 445600
root/name: survey1 root/timestamp[0]:3 root/point[0]: (2,3) root/reading[0]: 4200 root/timestamp[1]:9 root/point[1]: (2,4) root/reading[1] 445600
- Returns:
- true if attribute is to be considered transparent by XPath queries
-
-