public Class<? extends Serializable> getIdType() { RepositoryDefinition annotation = repositoryInterface.getAnnotation(RepositoryDefinition.class); return annotation == null ? null : annotation.idClass(); }
private Class<?> resolveIdType(Class<?> repositoryInterface) { RepositoryDefinition annotation = repositoryInterface.getAnnotation(RepositoryDefinition.class); if (annotation == null || annotation.idClass() == null) { throw new IllegalArgumentException(String.format("Could not resolve id type of %s!", repositoryInterface)); } return annotation.idClass(); }
@Override protected RepositoryMetadata resolveFromInterface(Class<?> repositoryInterface) { final RepositoryDefinition definition = repositoryInterface.getAnnotation(RepositoryDefinition.class); if (definition == null) { throw new RepositoryDefinitionException(repositoryInterface, "Expected the repository to be annotated with @RepositoryDefinition"); } final Class<?> entityType = definition.domainClass(); final Class<? extends Serializable> idType = definition.idClass(); String idProperty = resolveIdProperty(entityType, idType); return new ImmutableRepositoryMetadata(idType, entityType, repositoryInterface, idProperty); }
@Override protected RepositoryMetadata resolveFromInterface(Class<?> repositoryInterface) { final RepositoryDefinition definition = repositoryInterface.getAnnotation(RepositoryDefinition.class); if (definition == null) { throw new RepositoryDefinitionException(repositoryInterface, "Expected the repository to be annotated with @RepositoryDefinition"); } final Class<?> entityType = definition.domainClass(); final Class<? extends Serializable> idType = definition.idClass(); String idProperty = resolveIdProperty(entityType, idType); return new ImmutableRepositoryMetadata(idType, entityType, repositoryInterface, idProperty); }