Class ReflectionEntityInformation<T,​ID extends Serializable>

  • All Implemented Interfaces:
    org.springframework.data.repository.core.EntityInformation<T,​ID>, org.springframework.data.repository.core.EntityMetadata<T>

    public class ReflectionEntityInformation<T,​ID extends Serializable>
    extends org.springframework.data.repository.core.support.AbstractEntityInformation<T,​ID>
    EntityInformation implementation that inspects fields for an annotation and looks up this field's value to retrieve the id.
    Author:
    Oliver Gierke
    • Constructor Detail

      • ReflectionEntityInformation

        public ReflectionEntityInformation​(Class<T> domainClass)
        Creates a new ReflectionEntityInformation inspecting the given domain class for a field carrying the Id annotation.
        Parameters:
        domainClass - must not be null.
      • ReflectionEntityInformation

        public ReflectionEntityInformation​(Class<T> domainClass,
                                           Class<? extends Annotation> annotation)
        Creates a new ReflectionEntityInformation inspecting the given domain class for a field carrying the given annotation.
        Parameters:
        domainClass - must not be null.
        annotation - must not be null.
    • Method Detail

      • getId

        @Nullable
        public ID getId​(@NonNull
                        Object entity)
      • getIdType

        @NonNull
        public Class<ID> getIdType()