Class TLcdDataModel
- All Implemented Interfaces:
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
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 aTLcdDataModelBuilder
. 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 Summary
Modifier and TypeMethodDescription<T extends ILcdAnnotation>
TaddAnnotation
(ILcdAnnotation aAnnotation) Adds the given annotation to this element.boolean
<T extends ILcdAnnotation>
TgetAnnotation
(Class<T> aAnnotationType) Returns the element's annotation for the specified class if such an annotation is present, else null.Returns all annotations present on this element as an unmodifiable collection.Returns all the declared dependencies of this data model.getDeclaredType
(String aName) Returns the type defined by this data model with the given name.Returns a (unmodifiable) set of all types defined in this data model.Returns all the dependencies (transitively) of this data model.getDependency
(String aName) Returns a dependent data model with the given name.Returns a displayable name for this data model, suitable for usage in user interfaces.getName()
Returns the name of this model.getTypes()
Returns a (unmodifiable) set of all types declared in this data model or one of its dependencies.int
hashCode()
boolean
isAnnotationPresent
(Class<? extends ILcdAnnotation> aAnnotationType) Returns true if an annotation for the specified class is present on this element, else false.boolean
Returns if this instance is anonymous.<T extends ILcdAnnotation>
TremoveAnnotation
(Class<T> aAnnotationClass) Removes the annotation of the given class from this element.toString()
-
Method Details
-
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
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
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
Returns the name of this model. Returnsnull
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
Returns a (unmodifiable) set of all types defined in this data model.- Returns:
- all the types of this data model
-
getDeclaredType
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
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
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 interfaceILcdAnnotatedElement
- 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
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 interfaceILcdAnnotatedElement
- 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
Description copied from interface:ILcdAnnotatedElement
Returns all annotations present on this element as an unmodifiable collection.- Specified by:
getAnnotations
in interfaceILcdAnnotatedElement
- Returns:
- all annotations present on this element
-
toString
-
hashCode
public int hashCode() -
equals
-
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
Description copied from interface:ILcdAnnotatedElement
Adds the given annotation to this element.- Specified by:
addAnnotation
in interfaceILcdAnnotatedElement
- 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
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 interfaceILcdAnnotatedElement
- 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.
-