Package org.opengis.feature
Interface FeatureType
-
- All Superinterfaces:
IdentifiedType
@Classifier(METACLASS) @UML(identifier="FeatureType", specification=ISO_19109) public interface FeatureType extends IdentifiedType
Abstraction of a real-world phenomena. AFeatureType
instance describes the class of allFeature
instances of that type.Analogy with Java reflection
compared to the Java language,FeatureType
is equivalent toClass
whileFeature
instances are equivalent toObject
instances of that class.Naming
The feature type name is mandatory and should be unique. Names can be ScopedName for avoiding name collision.Properties and inheritance
Each feature type can provide descriptions for the following properties: In addition, a feature type can inherit the properties of one or more other feature types. Properties defined in the sub-type can override properties of the same name defined in the super-types, provided that values of the sub-type property are assignable to the super-type property.Analogy with Java language
compared to the Java language, the above rule is similar to overriding a method with a more specific return type (a.k.a. covariant return type). This is also similar to Java arrays, which are implicitly covariant (i.e.String[]
can be casted toCharSequence[]
, which is safe for read operations but not for write operations — the later may throwArrayStoreException
).- Since:
- 3.1
- See Also:
Feature
-
-
Method Summary
Modifier and Type Method Description GenericName
getName()
Returns the name of this feature type.Collection<? extends PropertyType>
getProperties(boolean includeSuperTypes)
Returns any feature operation, any feature attribute type and any feature association role that carries characteristics of a feature type.PropertyType
getProperty(String name)
Returns the attribute, operation or association role for the given name.Set<? extends FeatureType>
getSuperTypes()
Returns the direct parents of this feature type.boolean
isAbstract()
Returnstrue
if the feature type acts as an abstract super-type.boolean
isAssignableFrom(FeatureType type)
Returnstrue
if this type is same or a super-type of the given type.boolean
isSimple()
Returnstrue
if this feature type contains only attributes constrained to the [1 … 1] multiplicity, or operations (no feature association).Feature
newInstance()
Creates a new feature instance of this type.-
Methods inherited from interface IdentifiedType
getDefinition, getDescription, getDesignation
-
-
-
-
Method Detail
-
getName
@UML(identifier="name", obligation=MANDATORY, specification=ISO_19109) GenericName getName()
Returns the name of this feature type. ForFeatureType
, the name is mandatory. The feature name is often an instance ofTypeName
, but this is not mandatory.- Specified by:
getName
in interfaceIdentifiedType
- Returns:
- the feature type name.
-
isAbstract
@UML(identifier="isAbstract", obligation=MANDATORY, specification=ISO_19109) boolean isAbstract()
Returnstrue
if the feature type acts as an abstract super-type. Abstract types can not be instantiated.- Returns:
true
if the feature type acts as an abstract super-type.
-
isSimple
boolean isSimple()
Returnstrue
if this feature type contains only attributes constrained to the [1 … 1] multiplicity, or operations (no feature association). Such feature types can be handled as aRecordType
instances.- Returns:
true
if this feature type contains only simple attributes or operations.
-
getProperty
PropertyType getProperty(String name) throws PropertyNotFoundException
Returns the attribute, operation or association role for the given name.- Parameters:
name
- the name of the property to search.- Returns:
- the property for the given name.
- Throws:
PropertyNotFoundException
- if the given argument is not a property name of this feature type.- See Also:
Feature.getProperty(String)
-
getProperties
@UML(identifier="carrierOfCharacteristics", obligation=OPTIONAL, specification=ISO_19109) Collection<? extends PropertyType> getProperties(boolean includeSuperTypes)
Returns any feature operation, any feature attribute type and any feature association role that carries characteristics of a feature type. The returned collection will include the properties inherited from the super-types only ifincludeSuperTypes
istrue
.- Parameters:
includeSuperTypes
-true
for including the properties inherited from the super-types, orfalse
for returning only the properties defined explicitely in this type.- Returns:
- Feature operation, attribute type and association role that carries characteristics of this feature type (not including parent types).
-
getSuperTypes
@UML(identifier="superType", obligation=OPTIONAL, specification=ISO_19109) Set<? extends FeatureType> getSuperTypes()
Returns the direct parents of this feature type.Analogy with Java reflection
if we compareFeatureType
toClass
in the Java language, then this method is equivalent toClass.getSuperclass()
except that feature types allow multi-inheritance.- Returns:
- the parents of this feature type, or an empty set if none.
-
isAssignableFrom
boolean isAssignableFrom(FeatureType type)
Returnstrue
if this type is same or a super-type of the given type. Implementations should ensure that the following constraints are met:- If A is assignable from B and B is assignable from C, then A is assignable from C.
Analogy with Java reflection
if we compareFeatureType
toClass
in the Java language, then this method is equivalent toClass.isAssignableFrom(Class)
.- Parameters:
type
- the type to be checked.- Returns:
true
if instances of the given type can be assigned to association of this type.
-
newInstance
Feature newInstance() throws FeatureInstantiationException, UnsupportedOperationException
Creates a new feature instance of this type.Analogy with Java reflection
if we compareFeatureType
toClass
andFeature
toObject
in the Java language, then this method is equivalent toClass.newInstance()
.- Returns:
- a new feature instance.
- Throws:
FeatureInstantiationException
- if this feature type is abstract or can not be instantiated for some other reason.UnsupportedOperationException
- if this type does not support new instance creation.
-
-