public interface EntityType extends Serializable
Modifier and Type | Method and Description |
---|---|
void |
add(de.espirit.or.schema.EntityTypeListener listener)
Adds a listener for attribute change events.
|
boolean |
containsAttribute(String name)
Checks up whether this type contains an attribute with the given name.
|
ComposedAttribute |
createComposedAttribute(String name,
EntityType targetType,
ComposedAttribute.Relation type,
String opposedName)
Create a composed attribute with the given
name . |
<T> de.espirit.or.schema.SimpleAttribute<T> |
createSimpleAttribute(String name,
Class<T> type)
Create a simple attribute with the given
name and type . |
Attribute<?> |
getAttribute(String name)
Return the attribute with the given
name . |
<T> Attribute<T> |
getAttribute(String name,
Class<T> type)
Provides the attribute with the given name if it is of the requested type.
|
Collection<String> |
getAttributeNames()
Return a name list of all declared attributes.
|
Collection<? extends Attribute<?>> |
getAttributes()
Return all declared attributes by this entity type.
|
String |
getAvailableAttributeName(String name)
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.
|
String |
getName()
Returns the name of this entity type.
|
de.espirit.or.schema.Table |
getTable()
Provides the underlying table definition for this type.
|
EntityValidator |
getValidator()
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 |
isValid(Entity object)
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 attribute
name from this entity type. |
void |
setName(String name)
Set the name of this entity type to
name . |
<T> de.espirit.or.schema.SimpleAttribute<T> createSimpleAttribute(@NotNull String name, @NotNull Class<T> type) throws de.espirit.or.SchemaException
name
and type
.de.espirit.or.SchemaException
ComposedAttribute createComposedAttribute(String name, @NotNull EntityType targetType, @NotNull ComposedAttribute.Relation type, @Nullable String opposedName) throws de.espirit.or.SchemaException
name
.de.espirit.or.SchemaException
boolean containsAttribute(@NotNull String name)
name
- The attribute's name.true
, if an attribute with the given name exists.String getName()
Collection<? extends Attribute<?>> getAttributes()
Collection<String> getAttributeNames()
@Nullable Attribute<?> getAttribute(@NotNull String name)
name
.@Nullable <T> Attribute<T> getAttribute(@NotNull String name, @NotNull Class<T> type) throws de.espirit.or.SchemaException
name
- The attribute's name.type
- The desired type.null
, if there is no attribute with the given name.de.espirit.or.SchemaException
- if the attribute is not of the requested type.@Nullable EntityValidator getValidator()
null
, if not defined.boolean isValid(Entity object) throws de.espirit.or.ORException
true
, if valid.de.espirit.or.ORException
- if some error occurred when trying to resolve the given object.de.espirit.or.schema.Table getTable()
de.espirit.or.schema.Key getKey()
String getAvailableAttributeName(String name)
void removeAttribute(String name)
name
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.boolean isSimpleAttribute(String name)
name
- The attribute's name.true
, if value containing.boolean isComposedAttribute(String name)
name
- The attribute's name.true
, if it is a relation.void add(de.espirit.or.schema.EntityTypeListener listener)
listener
- A listener.void remove(de.espirit.or.schema.EntityTypeListener listener)
listener
- A listener.Copyright © 2021 e-Spirit AG. All Rights Reserved. Build 5.2.210210