Package de.espirit.or.schema
Interface EntityType
- All Superinterfaces:
Serializable
Definition for a type of an entity. Usually relates to a table within a schema.
- Since:
- 4.0.17
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(de.espirit.or.schema.EntityTypeListener listener) Adds a listener for attribute change events.boolean
containsAttribute
(@NotNull String name) Checks up whether this type contains an attribute with the given name.createComposedAttribute
(String name, @NotNull EntityType targetType, ComposedAttribute.Relation type, @Nullable String opposedName) Create a composed attribute with the givenname
.<T> SimpleAttribute<T>
createSimpleAttribute
(@NotNull String name, @NotNull Class<T> type) Create a simple attribute with the givenname
andtype
.@Nullable Attribute<?>
getAttribute
(@NotNull String name) Return the attribute with the givenname
.<T> @Nullable Attribute<T>
getAttribute
(@NotNull String name, @NotNull Class<T> type) Provides the attribute with the given name if it is of the requested type.Return a name list of all declared attributes.Collection<? extends Attribute<?>>
Return all declared attributes by this entity type.Provides the next available name for an attribute starting with name as its base.de.espirit.or.schema.Key
getKey()
Provides the key used for identifying data entries.getName()
Returns the name of this entity type.de.espirit.or.schema.Table
getTable()
Provides the underlying table definition for this type.@Nullable EntityValidator
Provides a validator that enables to check an entity wrt. defined constraints.boolean
isComposedAttribute
(String name) Checks up whether the attribute with the given name represents a relation.boolean
isSimpleAttribute
(String name) Checks up whether the attribute with the given name is a value containing attribute.boolean
Checks up whether the given data entry is valid.void
remove
(de.espirit.or.schema.EntityTypeListener listener) Removes a listener for attribute change events.void
removeAttribute
(String name) Deletes the given attributename
from this entity type.void
Set the name of this entity type toname
.
-
Method Details
-
createSimpleAttribute
<T> SimpleAttribute<T> createSimpleAttribute(@NotNull @NotNull String name, @NotNull @NotNull Class<T> type) throws SchemaException Create a simple attribute with the givenname
andtype
.- Throws:
SchemaException
- Since:
- 4.0.17
-
createComposedAttribute
ComposedAttribute createComposedAttribute(String name, @NotNull @NotNull EntityType targetType, @NotNull ComposedAttribute.Relation type, @Nullable @Nullable String opposedName) throws SchemaException Create a composed attribute with the givenname
.- Throws:
SchemaException
- Since:
- 4.0.17
-
containsAttribute
Checks up whether this type contains an attribute with the given name.- Parameters:
name
- The attribute's name.- Returns:
true
, if an attribute with the given name exists.- Since:
- 4.0.17
-
getName
String getName()Returns the name of this entity type.- Since:
- 4.0.17
-
setName
Set the name of this entity type toname
.- Since:
- 4.0.17
-
getAttributes
Collection<? extends Attribute<?>> getAttributes()Return all declared attributes by this entity type.- Since:
- 4.0.17
-
getAttributeNames
Collection<String> getAttributeNames()Return a name list of all declared attributes.- Since:
- 4.0.17
-
getAttribute
Return the attribute with the givenname
.- Since:
- 4.0.17
-
getAttribute
@Nullable <T> @Nullable Attribute<T> getAttribute(@NotNull @NotNull String name, @NotNull @NotNull Class<T> type) throws SchemaException Provides the attribute with the given name if it is of the requested type.- Parameters:
name
- The attribute's name.type
- The desired type.- Returns:
- The matching attribute or
null
, if there is no attribute with the given name. - Throws:
SchemaException
- if the attribute is not of the requested type.- Since:
- 4.0.17
-
getValidator
Provides a validator that enables to check an entity wrt. defined constraints.- Returns:
- A validator or
null
, if not defined. - Since:
- 4.0.17
-
isValid
Checks up whether the given data entry is valid.- Returns:
true
, if valid.- Throws:
ORException
- if some error occurred when trying to resolve the given object.- Since:
- 4.0.17
-
getTable
de.espirit.or.schema.Table getTable()Provides the underlying table definition for this type.- Returns:
- The table.
- Since:
- 4.0.17
-
getKey
de.espirit.or.schema.Key getKey()Provides the key used for identifying data entries.- Returns:
- The key.
- Since:
- 4.0.17
-
getAvailableAttributeName
Provides the next available name for an attribute starting with name as its base.- Returns:
- A name not taken.
- Since:
- 4.0.17
-
removeAttribute
Deletes the given attributename
from this entity type. If the attribute is a main attribute in an 1:1 or 1:n relation then the opposed attribute will be removed from the target entity type.- Since:
- 4.0.17
-
isSimpleAttribute
Checks up whether the attribute with the given name is a value containing attribute.- Parameters:
name
- The attribute's name.- Returns:
true
, if value containing.- Since:
- 4.0.17
-
isComposedAttribute
Checks up whether the attribute with the given name represents a relation.- Parameters:
name
- The attribute's name.- Returns:
true
, if it is a relation.- Since:
- 4.0.17
-
add
void add(de.espirit.or.schema.EntityTypeListener listener) Adds a listener for attribute change events.- Parameters:
listener
- A listener.- Since:
- 4.0.17
-
remove
void remove(de.espirit.or.schema.EntityTypeListener listener) Removes a listener for attribute change events.- Parameters:
listener
- A listener.- Since:
- 4.0.17
-