Package org.geotools.feature.type
Class AbstractLazyComplexTypeImpl
- Object
-
- AbstractLazyAttributeTypeImpl
-
- AbstractLazyComplexTypeImpl
-
- All Implemented Interfaces:
AttributeType
,ComplexType
,PropertyType
public abstract class AbstractLazyComplexTypeImpl extends AbstractLazyAttributeTypeImpl implements ComplexType
A replacement forComplexTypeImpl
with lazy evaluation of descriptors, to support cyclically-defined types. Note that type equality is defined by name, so do not allow different types with the same name to be put in any Collection.Inspired by
ComplexTypeImpl
.- Author:
- Ben Caradoc-Davies (CSIRO Earth Science and Resource Engineering)
- See Also:
ComplexTypeImpl
-
-
Constructor Summary
Constructors Constructor Description AbstractLazyComplexTypeImpl(Name name, boolean identified, boolean isAbstract, List<Filter> restrictions, InternationalString description)
Constructor arguments have the same meaning as inComplexTypeImpl
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Collection<PropertyDescriptor>
buildDescriptors()
Subclasses must override this method to return the list of descriptors that define the properties of this type.Class<Collection<Property>>
getBinding()
The java class that values of properties of the property type are bound to.PropertyDescriptor
getDescriptor(String name)
The namespace-ignorant version ofgetDescriptor(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.String
toString()
-
Methods inherited from class AbstractLazyAttributeTypeImpl
buildSuper, equals, getDescription, getName, getRestrictions, getSuper, getUserData, hashCode, isAbstract, isIdentified
-
Methods inherited from interface AttributeType
getSuper, isIdentified
-
Methods inherited from interface PropertyType
equals, getDescription, getName, getRestrictions, getUserData, hashCode, isAbstract
-
-
-
-
Constructor Detail
-
AbstractLazyComplexTypeImpl
public AbstractLazyComplexTypeImpl(Name name, boolean identified, boolean isAbstract, List<Filter> restrictions, InternationalString description)
Constructor arguments have the same meaning as inComplexTypeImpl
.
-
-
Method Detail
-
buildDescriptors
public abstract Collection<PropertyDescriptor> buildDescriptors()
Subclasses must override this method to return the list of descriptors that define the properties of this type. This method will only be called once at most.If the type has no properties, return either an empty collection or null.
- Returns:
- a collection of descriptors or null if empty
-
getBinding
public Class<Collection<Property>> getBinding()
Description copied from interface:PropertyType
The java class that values of properties of the property type are bound to.This value is never
null
.- Specified by:
getBinding
in interfaceComplexType
- Specified by:
getBinding
in interfacePropertyType
- Overrides:
getBinding
in classAbstractLazyAttributeTypeImpl
- Returns:
- The binding of the property type.
- See Also:
AbstractLazyAttributeTypeImpl.getBinding()
-
getDescriptors
public Collection<PropertyDescriptor> getDescriptors()
Description copied from interface:ComplexType
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
.- Specified by:
getDescriptors
in interfaceComplexType
- Returns:
- Collection of descriptors representing the composition of the complex type.
- See Also:
ComplexType.getDescriptors()
-
getDescriptor
public PropertyDescriptor getDescriptor(Name name)
Description copied from interface:ComplexType
Describe a single property by name.This method returns
null
if no such property is found.- Specified by:
getDescriptor
in interfaceComplexType
- Parameters:
name
- The name of the property to get.- Returns:
- The property matching the specified name, or
null
. - See Also:
ComplexType.getDescriptor(org.geotools.api.feature.type.Name)
-
isInline
public boolean isInline()
Description copied from interface:ComplexType
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
- Specified by:
isInline
in interfaceComplexType
- Returns:
- true if attribute is to be considered transparent by XPath queries
- See Also:
ComplexType.isInline()
-
toString
public String toString()
- Overrides:
toString
in classAbstractLazyAttributeTypeImpl
- See Also:
AbstractLazyAttributeTypeImpl.toString()
-
getDescriptor
public PropertyDescriptor getDescriptor(String name)
The namespace-ignorant version ofgetDescriptor(Name)
. Note that we honour the same permissive algorithm asComplexTypeImpl
: (1) try no-namespace, (2) try container-namespace, (2) search for match ignoring namespace. *Shudder*. Warning: Any code that uses this method instead ofgetDescriptor(Name)
is * inherently unsafe.- Specified by:
getDescriptor
in interfaceComplexType
- Parameters:
name
- The name of the property to get.- Returns:
- The property matching the specified name, or
null
. - See Also:
ComplexType.getDescriptor(java.lang.String)
-
-