public class DefaultFeatureType extends AbstractIdentifiedType
FeatureType instance describes the class of all
feature instances of that type.
FeatureType is equivalent to Class while
Feature instances are equivalent to Object instances of that class.FeatureType interface in a future version.
When such interface will be available, most references to DefaultFeatureType in the API
will be replaced by references to the FeatureType interface.String[] can be casted to CharSequence[], which
is safe for read operations but not for write operations — the later may throw ArrayStoreException).DefaultFeatureType can be instantiated directly by a call to its constructor.
But a more convenient approach may be to use the FeatureTypeBuilder instead,
which provides shortcuts for frequently-used operations like creating various GenericName
instances sharing the same namespace.
GenericName and InternationalString
instances) and all arguments (AttributeType instances) given to the constructor are also immutable.
Such immutable instances can be shared by many objects and passed between threads without synchronization.DefaultAttributeType,
DefaultAssociationRole,
AbstractFeature,
DefaultFeatureTypeInfo,
FeatureNaming,
Serialized FormDefined in the sis-feature module
DEFINITION_KEY, DEPRECATED_KEY, DESCRIPTION_KEY, DESIGNATION_KEY, NAME_KEY| Constructor and Description |
|---|
DefaultFeatureType(Map<String,?> identification,
boolean isAbstract,
DefaultFeatureType[] superTypes,
AbstractIdentifiedType... properties)
Constructs a feature type from the given properties.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
Compares this feature type with the given object for equality.
|
GenericName |
getName() |
Collection<AbstractIdentifiedType> |
getProperties(boolean includeSuperTypes)
Returns any feature operation, any feature attribute type and any feature association role that
carries characteristics of a feature type.
|
AbstractIdentifiedType |
getProperty(String name)
Returns the attribute, operation or association role for the given name.
|
Set<DefaultFeatureType> |
getSuperTypes()
Returns the direct parents of this feature type.
|
int |
hashCode()
Returns a hash code value for this feature type.
|
boolean |
isAbstract()
Returns
true if the feature type acts as an abstract super-type. |
boolean |
isAssignableFrom(DefaultFeatureType type)
Returns
true if this type is same or a super-type of the given type. |
boolean |
isSimple()
Returns
true if this feature type contains only attributes constrained to the [1 … 1] cardinality,
or operations (no feature association). |
AbstractFeature |
newInstance()
Creates a new feature instance of this type.
|
String |
toString()
Formats this feature in a tabular format.
|
getDefinition, getDescription, getDesignation, getName, getRemarks, isDeprecatedpublic DefaultFeatureType(Map<String,?> identification, boolean isAbstract, DefaultFeatureType[] superTypes, AbstractIdentifiedType... properties)
| Map key | Value type | Returned by |
|---|---|---|
| "name" | GenericName or String |
AbstractIdentifiedType.getName() |
| "definition" | InternationalString or String |
AbstractIdentifiedType.getDefinition() |
| "designation" | InternationalString or String |
AbstractIdentifiedType.getDesignation() |
| "description" | InternationalString or String |
AbstractIdentifiedType.getDescription() |
| "deprecated" | Boolean |
AbstractIdentifiedType.isDeprecated() |
org.opengis.feature.FeatureType and org.opengis.feature.PropertyType.
This change is pending GeoAPI revision. In the meantime, make sure that the properties
array contains only attribute types, association roles or operations, not other
feature types since the later are not properties in the ISO sense.identification - the name and other information to be given to this feature type.isAbstract - if true, the feature type acts as an abstract super-type.superTypes - the parents of this feature type, or null or empty if none.properties - any feature operation, any feature attribute type and any feature
association role that carries characteristics of a feature type.FeatureTypeBuilderpublic final boolean isAbstract()
true if the feature type acts as an abstract super-type.
Abstract types can not be instantiated.true if the feature type acts as an abstract super-type.public boolean isSimple()
true if this feature type contains only attributes constrained to the [1 … 1] cardinality,
or operations (no feature association).
Such feature types can be handled as a records.true if this feature type contains only simple attributes or operations.public boolean isAssignableFrom(DefaultFeatureType type)
true if this type is same or a super-type of the given type.
The check is based mainly on the feature type name, which should be unique.
However as a safety, this method also checks that all properties in this feature type is assignable
from a property of the same name in the given type.
FeatureType to Class in the Java language, then this method is equivalent
to Class.isAssignableFrom(Class).type - the type to be checked.true if instances of the given type can be assigned to association of this type.public final Set<DefaultFeatureType> getSuperTypes()
FeatureType to Class in the Java language, then this method is equivalent
to Class.getSuperclass() except that feature types allow multi-inheritance.FeatureType if and when such interface
will be defined in GeoAPI.public Collection<AbstractIdentifiedType> getProperties(boolean includeSuperTypes)
includeSuperTypes
is true.
PropertyType if and when such interface
will be defined in GeoAPI.includeSuperTypes - true for including the properties inherited from the super-types,
or false for returning only the properties defined explicitely in this type.public AbstractIdentifiedType getProperty(String name) throws IllegalArgumentException
PropertyType if and when such interface
will be defined in GeoAPI.name - the name of the property to search.null if none.IllegalArgumentException - if the given argument is not a property name of this feature.AbstractFeature.getProperty(String)public AbstractFeature newInstance() throws IllegalStateException
FeatureType to Class and Feature to Object in the Java language,
then this method is equivalent to Class.newInstance().IllegalStateException - if this feature type is abstract.public int hashCode()
hashCode in class AbstractIdentifiedTypepublic boolean equals(Object obj)
equals in class AbstractIdentifiedTypeobj - the object to compare with this type.true if the given object is equals to this type.public String toString()
toString in class ObjectFeatureFormatpublic GenericName getName()
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.