Package io.jmix.core

Class Id<T>

java.lang.Object
io.jmix.core.Id<T>
Type Parameters:
T - entity type
All Implemented Interfaces:
Serializable

public final class Id<T> extends Object implements Serializable
Convenient class for methods that receive Id of an entity as a parameter.
See Also:
  • Method Details

    • getValue

      public Object getValue()
      Returns:
      value of entity id
    • getEntityClass

      public Class<T> getEntityClass()
      Returns:
      class of entity
    • of

      public static <T> Id<T> of(T entity)
      Type Parameters:
      T - entity type
      Parameters:
      entity - entity instance
      Returns:
      Id of the passed entity
    • ofNullable

      @Nullable public static <T> Id<T> ofNullable(@Nullable T entity)
      Type Parameters:
      T - entity type
      Parameters:
      entity - entity instance, can be null
      Returns:
      Id of the passed entity or null
    • of

      public static <T> Id<T> of(Object id, Class<T> entityClass)
      Type Parameters:
      T - entity type
      Parameters:
      id - entity id
      entityClass - entity class
      Returns:
      Id of the passed entity
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object