本文整理汇总了Java中org.apache.deltaspike.data.api.Repository类的典型用法代码示例。如果您正苦于以下问题:Java Repository类的具体用法?Java Repository怎么用?Java Repository使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Repository类属于org.apache.deltaspike.data.api包,在下文中一共展示了Repository类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.apache.deltaspike.data.api.Repository; //导入依赖的package包/类
public RepositoryMethodMetadata init(RepositoryMetadata repositoryMetadata, Method method, BeanManager beanManager)
{
RepositoryMethodMetadata repositoryMethodMetadata = new RepositoryMethodMetadata();
repositoryMethodMetadata.setMethod(method);
repositoryMethodMetadata.setReturnsOptional(
OptionalUtil.isOptionalReturned(method));
repositoryMethodMetadata.setReturnsStream(
StreamUtil.isStreamReturned(method));
repositoryMethodMetadata.setQuery(method.isAnnotationPresent(Query.class)
? method.getAnnotation(Query.class) : null);
repositoryMethodMetadata.setModifying(method.isAnnotationPresent(Modifying.class)
? method.getAnnotation(Modifying.class) : null);
repositoryMethodMetadata.setTransactional(AnnotationUtils.extractAnnotationFromMethodOrClass(
beanManager, method, repositoryMetadata.getRepositoryClass(), Transactional.class));
repositoryMethodMetadata.setMethodPrefix(new RepositoryMethodPrefix(
repositoryMetadata.getRepositoryClass().getAnnotation(Repository.class).methodPrefix(),
method.getName()));
repositoryMethodMetadata.setMethodType(
extractMethodType(repositoryMetadata, repositoryMethodMetadata));
repositoryMethodMetadata.setQueryProcessor(queryProcessorFactory.build(repositoryMethodMetadata));
repositoryMethodMetadata.setQueryInOutMapperClass(
extractMapper(method, repositoryMetadata));
initQueryRoot(repositoryMetadata, repositoryMethodMetadata);
initQueryInOutMapperIsNormalScope(repositoryMetadata, repositoryMethodMetadata, beanManager);
initSingleResultType(repositoryMethodMetadata);
initRequiresTransaction(repositoryMethodMetadata);
return repositoryMethodMetadata;
}
示例2: extract
import org.apache.deltaspike.data.api.Repository; //导入依赖的package包/类
private EntityMetadata extract(Class<?> repositoryClass)
{
// get from annotation
Repository repository = repositoryClass.getAnnotation(Repository.class);
Class<?> entityClass = repository.forEntity();
boolean isEntityClass = !Object.class.equals(entityClass) && EntityUtils.isEntityClass(entityClass);
if (isEntityClass)
{
return new EntityMetadata(entityClass, EntityUtils.primaryKeyClass(entityClass));
}
// get from type
for (Type inf : repositoryClass.getGenericInterfaces())
{
EntityMetadata result = extractFromType(inf);
if (result != null)
{
return result;
}
}
EntityMetadata entityMetadata = extractFromType(repositoryClass.getGenericSuperclass());
if (entityMetadata != null)
{
return entityMetadata;
}
for (Type intf : repositoryClass.getGenericInterfaces())
{
entityMetadata = extractFromType(intf);
if (entityMetadata != null)
{
return entityMetadata;
}
}
if (repositoryClass.getSuperclass() != null)
{
return extract(repositoryClass.getSuperclass());
}
return null;
}
示例3: dummyRepoMethod
import org.apache.deltaspike.data.api.Repository; //导入依赖的package包/类
private RepositoryMethodMetadata dummyRepoMethod(RepositoryMetadata metadata)
{
RepositoryMethodMetadata methodMetadata = new RepositoryMethodMetadata(dummyMethod());
methodMetadata.setMethodPrefix(new RepositoryMethodPrefix(
metadata.getRepositoryClass().getAnnotation(Repository.class).methodPrefix(),
dummyMethod().getName()));
return methodMetadata;
}
示例4: isRepository
import org.apache.deltaspike.data.api.Repository; //导入依赖的package包/类
private <X> boolean isRepository(AnnotatedType<X> annotatedType)
{
return (annotatedType.isAnnotationPresent(Repository.class) ||
annotatedType.getJavaClass().isAnnotationPresent(Repository.class)) &&
!InvocationHandler.class.isAssignableFrom(annotatedType.getJavaClass());
}