Class DefaultFeatureType

  • All Implemented Interfaces:
    Serializable, Deprecable

    public class DefaultFeatureType
    extends AbstractIdentifiedType
    Abstraction of a real-world phenomena. A Feature­Type instance describes the class of all feature instances of that type.
    Analogy: compared to the Java language, Feature­Type is equivalent to Class while Feature instances are equivalent to Object instances of that class.
    Warning: This class is expected to implement a GeoAPI Feature­Type interface in a future version. When such interface will be available, most references to Default­Feature­Type in the API will be replaced by references to the Feature­Type interface.
    Naming
    The feature type name is mandatory and should be unique. Those names are the main criterion used for deciding if a feature type is assignable from another type. Names can be scoped 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: 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 to Char­Sequence[], which is safe for read operations but not for write operations — the later may throw Array­Store­Exception).
    Instantiation
    Default­Feature­Type can be instantiated directly by a call to its constructor. But a more convenient approach may be to use the Feature­Type­Builder instead, which provides shortcuts for frequently-used operations like creating various Generic­Name instances sharing the same namespace.
    Immutability and thread safety
    Instances of this class are immutable if all properties (Generic­Name and International­String instances) and all arguments (Attribute­Type instances) given to the constructor are also immutable. Such immutable instances can be shared by many objects and passed between threads without synchronization.
    Since:
    0.5
    See Also:
    Default­Attribute­Type, Default­Association­Role, Abstract­Feature, Default­Feature­Type­Info, Feature­Naming, Serialized Form

    Defined in the sis-feature module

    • Method Detail

      • isAbstract

        public final boolean isAbstract()
        Returns true 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

        public boolean isSimple()
        Returns true if this feature type contains only attributes with [1 … 1] multiplicity, or operations (no feature association). Such feature types can be handled as a records.
        Returns:
        true if this feature type contains only simple attributes or operations.
      • isAssignableFrom

        public boolean isAssignableFrom​(DefaultFeatureType type)
        Returns 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.
        Constraints:
        • If A is assignable from B and B is assignable from C, then A is assignable from C.
        Analogy: if we compare Feature­Type to Class in the Java language, then this method is equivalent to Class​.is­Assignable­From(Class).
        Parameters:
        type - the type to be checked.
        Returns:
        true if instances of the given type can be assigned to association of this type.
      • getSuperTypes

        public final Set<DefaultFeatureType> getSuperTypes()
        Returns the direct parents of this feature type.
        Analogy: if we compare Feature­Type to Class in the Java language, then this method is equivalent to Class​.get­Superclass() except that feature types allow multi-inheritance.
        Warning: The type of list elements will be changed to Feature­Type if and when such interface will be defined in GeoAPI.
        Note for subclasses: this method is final because it is invoked (indirectly) by constructors, and invoking a user-overrideable method at construction time is not recommended. Furthermore, many Apache SIS methods need guarantees about the stability of this collection.
        Returns:
        the parents of this feature type, or an empty set if none.
      • getProperties

        public 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. The returned collection will include the properties inherited from the super-types only if include­Super­Types is true.
        Warning: The type of list elements will be changed to Property­Type if and when such interface will be defined in GeoAPI.
        Parameters:
        include­Super­Types - true for including the properties inherited from the super-types, or false for returning only the properties defined explicitly in this type.
        Returns:
        feature operation, attribute type and association role that carries characteristics of this feature type (not including parent types).
      • hashCode

        public int hashCode()
        Returns a hash code value for this feature type.
        Overrides:
        hash­Code in class Abstract­Identified­Type
        Returns:
        the hash code for this type.
      • equals

        public boolean equals​(Object obj)
        Compares this feature type with the given object for equality.
        Overrides:
        equals in class Abstract­Identified­Type
        Parameters:
        obj - the object to compare with this type.
        Returns:
        true if the given object is equals to this type.
      • toString

        public String toString()
        Formats this feature in a tabular format.
        Overrides:
        to­String in class Object
        Returns:
        a string representation of this feature in a tabular format.
        See Also:
        Feature­Format