Class 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:
    Serialized Form
    • Constructor Detail

      • UuidEntityRef

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

      • 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.
      • forEntity

        public static <TEntity extends IUUIDEntityUuidEntityRef 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 IUUIDEntityUuidEntityRef 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.