public static <E> E asEntity(Ref<?, ? super E> reference, Class<E> entityClass) {

    if (reference == null) {
      return null;
    } else {
      return JpaEntityManagerAccess.getEntityManager().getReference(entityClass, reference.getId());
    }
  }
public static < E > E asEntity ( Ref < ? , ? super E > reference , Class < E > entityClass ) { if ( reference == null ) { return null ; } else { return JpaEntityManagerAccess . getEntityManager ( ) . getReference ( entityClass , reference . getId ( ) ) ; } }
@param <E> generic type of the {@link net.sf.mmm.util.entity.api.PersistenceEntity entity}
@param reference the {@link Ref} or {@code null}. Typically an
{@link io.oasp.module.basic.common.api.reference.IdRef}.
@param entityClass the {@link net.sf.mmm.util.entity.api.PersistenceEntity entity} {@link Class}.
@return the {@link net.sf.mmm.util.entity.api.PersistenceEntity entity} of the specified {@link Class} with the
{@link Ref#getId() ID} from the given {@link GenericIdRef} or {@code null} if the given {@link Ref} is
{@code null}.