Class TLcdDataModel

java.lang.Object
com.luciad.datamodel.TLcdDataModel
All Implemented Interfaces:
ILcdAnnotatedElement

public final class TLcdDataModel extends Object implements ILcdAnnotatedElement

A data model is a collection of types that forms a logical entity. Conceptually this is similar to a UML package or an XML schema. A data model is identified by a unique name. Some examples of instances supported by LuciadLightspeed are the AIXM5 and GML32 data models.

A data model has an explicit collection of dependent data models (see getDependencies()). Typically, these data models are needed when creating data objects for the types declared in this data model. The dependencies include, but are not limited to, the following data models:

  • the data model of the supertypes of the types declared in this data model
  • the data model of the types of the properties of the types declared in this data model
Note that dependencies can be cyclic.

Two data model instances are considered to be equal if they have the same name.

TLcdDataModel provides direct access to its declared types (getDeclaredTypes()). It also provides access to all the types which are reachable from the data model. This is the union of this data model's declared types with all the type declared by its dependencies.

Anonymous data models are data models that have no name and have no declared types. They only have dependencies. An anonymous data model is never a dependency for another data model. They are equal to other anonymous data models that have the same set of dependencies. Anonymous data models are typically used to represent a collection of data models as a single data model. The data model offered by an ILcdDataModelDescriptor is an example where such an anonymous data model is often used.

Application-specific meta data can be represented using annotations. See ILcdAnnotatedElement for more details on this. A simple example for data models that are derived from an XML schema could be the name space URI. This URI can't be set directly on a data model; however it can be associated with the data model using an annotation. This allows other applications to retrieve it easily.

Instances of this class are thread safe. Once an instance has been created, there is no public API to modify it. The only exception is the annotations and these are implemented such that they are thread safe.

Data models are created using a TLcdDataModelBuilder. Such a builder provides an extensive API to define a new data model including all the types and properties it declares.

Consult the Introduction to the data modeling API for more information.

Since:
10.0
See Also:
  • Method Details

    • getDependencies

      public Set<TLcdDataModel> getDependencies()
      Returns all the dependencies (transitively) of this data model. The data model never depends on itself. Anonymous data models are expanded such that the returned set only contains data models with a name. The result is not modifiable.
      Returns:
      the transitive set of all dependencies of this data model
    • getDeclaredDependencies

      public Set<TLcdDataModel> getDeclaredDependencies()
      Returns all the declared dependencies of this data model. The data model never depends on itself. Anonymous data models are expanded such that the returned set only contains data models with a name. The result is not modifiable.
      Returns:
      the set of all declared dependencies of this data model
    • getDependency

      public TLcdDataModel getDependency(String aName)
      Returns a dependent data model with the given name. If no such model can be found, null is returned.
      Parameters:
      aName - the name of the data model that is to be returned. Data model names are case sensitive
      Returns:
      a data model that depends on this model and that has the given name
    • getName

      public String getName()
      Returns the name of this model. Returns null for anonymous data models.
      Returns:
      the name of this model
    • isAnonymous

      public boolean isAnonymous()
      Returns if this instance is anonymous.
      Returns:
      if this data model is anonymous
    • getDeclaredTypes

      public Set<TLcdDataType> getDeclaredTypes()
      Returns a (unmodifiable) set of all types defined in this data model.
      Returns:
      all the types of this data model
    • getDeclaredType

      public TLcdDataType getDeclaredType(String aName)
      Returns the type defined by this data model with the given name. If no such type can be found, null is returned.
      Parameters:
      aName - the name of the type that should be returned. Type names are case sensitive
      Returns:
      the type defined by this data model with the given name
    • getTypes

      public Set<TLcdDataType> getTypes()
      Returns a (unmodifiable) set of all types declared in this data model or one of its dependencies.
      Returns:
      all the types of this data model and its dependencies
    • getAnnotation

      public <T extends ILcdAnnotation> T getAnnotation(Class<T> aAnnotationType)
      Description copied from interface: ILcdAnnotatedElement

      Returns the element's annotation for the specified class if such an annotation is present, else null.

      Note that the exact annotation class needs to be passed as parameter. In other words, in case the element is only annotated with instances of subclasses of the given annotation class, null is returned.

      Specified by:
      getAnnotation in interface ILcdAnnotatedElement
      Parameters:
      aAnnotationType - - the Class object corresponding to the annotation type
      Returns:
      this element's annotation for the specified annotation class if present on this element, else null
    • isAnnotationPresent

      public boolean isAnnotationPresent(Class<? extends ILcdAnnotation> aAnnotationType)
      Description copied from interface: ILcdAnnotatedElement

      Returns true if an annotation for the specified class is present on this element, else false. This method is designed primarily for convenient access to marker annotations.

      Note that the exact annotation class needs to be passed as parameter. In other words, in case the element is only annotated with instances of subclasses of the given annotation class, false is returned.

      Specified by:
      isAnnotationPresent in interface ILcdAnnotatedElement
      Parameters:
      aAnnotationType - the Class object corresponding to the annotation class
      Returns:
      true if an annotation for the specified annotation class is present on this element, else false
    • getAnnotations

      public Collection<ILcdAnnotation> getAnnotations()
      Description copied from interface: ILcdAnnotatedElement
      Returns all annotations present on this element as an unmodifiable collection.
      Specified by:
      getAnnotations in interface ILcdAnnotatedElement
      Returns:
      all annotations present on this element
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getDisplayName

      public String getDisplayName()
      Returns a displayable name for this data model, suitable for usage in user interfaces.
      Returns:
      a displayable name for the data model.
      See Also:
    • addAnnotation

      public <T extends ILcdAnnotation> T addAnnotation(ILcdAnnotation aAnnotation)
      Description copied from interface: ILcdAnnotatedElement
      Adds the given annotation to this element.
      Specified by:
      addAnnotation in interface ILcdAnnotatedElement
      Parameters:
      aAnnotation - the annotation to add
      Returns:
      the previous annotation of the same class as the given annotation associated with this element, or null if there was no annotation for that class.
    • removeAnnotation

      public <T extends ILcdAnnotation> T removeAnnotation(Class<T> aAnnotationClass)
      Description copied from interface: ILcdAnnotatedElement

      Removes the annotation of the given class from this element.

      Note that the exact annotation class needs to be passed as parameter. In other words, in case the element is only annotated with instances of subclasses of the given annotation class, nothing is removed and null is returned.

      Specified by:
      removeAnnotation in interface ILcdAnnotatedElement
      Parameters:
      aAnnotationClass - the class of annotation to remove
      Returns:
      the annotation of the given class that was associated with this element, or null if there was no annotation for that class.