Interface EntityType

All Superinterfaces:
Serializable

public interface EntityType extends Serializable
Definition for a type of an entity. Usually relates to a table within a schema.
Since:
4.0.17
  • Method Details

    • createSimpleAttribute

      <T> SimpleAttribute<T> createSimpleAttribute(@NotNull @NotNull String name, @NotNull @NotNull Class<T> type) throws SchemaException
      Create a simple attribute with the given name and type.
      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 given name.
      Throws:
      SchemaException
      Since:
      4.0.17
    • containsAttribute

      boolean containsAttribute(@NotNull @NotNull String name)
      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

      void setName(@NotNull @NotNull String name)
      Set the name of this entity type to name.
      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

      @Nullable @Nullable Attribute<?> getAttribute(@NotNull @NotNull String name)
      Return the attribute with the given name.
      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

      @Nullable @Nullable EntityValidator 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

      boolean isValid(Entity object) throws ORException
      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

      String getAvailableAttributeName(String name)
      Provides the next available name for an attribute starting with name as its base.
      Returns:
      A name not taken.
      Since:
      4.0.17
    • removeAttribute

      void removeAttribute(String name)
      Deletes the given attribute 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.
      Since:
      4.0.17
    • isSimpleAttribute

      boolean isSimpleAttribute(String name)
      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

      boolean isComposedAttribute(String name)
      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