Class UuidEntityRef

java.lang.Object
de.xima.fc.workflow.UuidEntityRef
All Implemented Interfaces:
IEntityReference, Serializable

public final class UuidEntityRef extends Object implements IEntityReference
Models a reference to another entity via the UUID of that entity. Supports JSON serialization and deserialization. All fields of this class should not be null, to indicate a missing reference use null instead of an instance of this class.
Since:
7.0.0
Author:
XIMA MEDIA GmbH
See Also:
  • Constructor Details

    • UuidEntityRef

      public UuidEntityRef()
      For JSON serialization / deserialization only. Use the static factory methods.
  • Method Details

    • equals

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

      public Class<? extends IUUIDEntity> getEntityClass()
      Specified by:
      getEntityClass in interface IEntityReference
      Returns:
      Type of the referenced class.
    • getUuid

      public UUID getUuid()
      Specified by:
      getUuid in interface IEntityReference
      Returns:
      The UUID of the referenced entity.
    • hashCode

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

      public void setEntityClass(Class<? extends IUUIDEntity> entityClass)
      Parameters:
      entityClass - Type of the referenced class.
    • setUuid

      public void setUuid(UUID uuid)
      Parameters:
      uuid - Type of the referenced class.
    • toString

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

      public static <TEntity extends IUUIDEntity> UuidEntityRef forEntity(TEntity entity)
      Creates a new entity reference for the given UUID entity.
      Type Parameters:
      TEntity - Type of the referenced entity.
      Parameters:
      entity - An entity for which to create a reference.
      Returns:
      A new instance with the given UUID and class, or null when the given entity is null.
    • forUuid

      public static <TEntity extends IUUIDEntity> UuidEntityRef forUuid(UUID uuid, Class<TEntity> entityClass)
      Creates a new entity reference with the given UUID and entity class.
      Type Parameters:
      TEntity - Type of the referenced entity.
      Parameters:
      uuid - UUID of the referenced entity.
      entityClass - Type of the referenced entity.
      Returns:
      A new instance with the given UUID and class, or null when the given UUID or entity class is null.