public Class<?> getDomainType() { RepositoryDefinition annotation = repositoryInterface.getAnnotation(RepositoryDefinition.class); return annotation == null ? null : annotation.domainClass(); }
private Class<?> resolveDomainType(Class<?> repositoryInterface) { RepositoryDefinition annotation = repositoryInterface.getAnnotation(RepositoryDefinition.class); if (annotation == null || annotation.domainClass() == null) { throw new IllegalArgumentException(String.format("Could not resolve domain type of %s!", repositoryInterface)); } return annotation.domainClass(); } }
@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); }