本文整理汇总了Java中javax.persistence.metamodel.PluralAttribute.getElementType方法的典型用法代码示例。如果您正苦于以下问题:Java PluralAttribute.getElementType方法的具体用法?Java PluralAttribute.getElementType怎么用?Java PluralAttribute.getElementType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.persistence.metamodel.PluralAttribute
的用法示例。
在下文中一共展示了PluralAttribute.getElementType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitJoin
import javax.persistence.metamodel.PluralAttribute; //导入方法依赖的package包/类
public boolean visitJoin(Node node, Set<TypeDefinition> typeDefinitions) {
if (node.jjtGetNumChildren() != 2) {
return false;
}
Node pathNode = node.jjtGetChild(0);
Node aliasNode = node.jjtGetChild(1);
Alias rootAlias = new Alias(pathNode.jjtGetChild(0).toString());
Class<?> rootType = getType(rootAlias, typeDefinitions);
ManagedType<?> managedType = forModel(metamodel).filter(rootType);
for (int i = 1; i < pathNode.jjtGetNumChildren(); i++) {
Attribute<?, ?> attribute = managedType.getAttribute(pathNode.jjtGetChild(i).toString());
if (attribute.getPersistentAttributeType() == PersistentAttributeType.BASIC) {
throw new PersistenceException("Cannot navigate through basic property "
+ pathNode.jjtGetChild(i) + " of path " + pathNode);
}
if (attribute.isCollection()) {
PluralAttribute<?, ?, ?> pluralAttribute = (PluralAttribute<?, ?, ?>)attribute;
managedType = (ManagedType<?>)pluralAttribute.getElementType();
} else {
managedType = (ManagedType<?>)((SingularAttribute)attribute).getType();
}
}
typeDefinitions.add(new TypeDefinition(new Alias(aliasNode.toString()), managedType.getJavaType()));
return false;
}
示例2: RestrictingCollectionAttribute
import javax.persistence.metamodel.PluralAttribute; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
RestrictingCollectionAttribute(PluralAttribute<E,Collection<R>,R> attribute, List<Attribute<?,?>> restrictionChain) {
super((A)attribute, CollectionType.COLLECTION, attribute.getElementType());
attributes = restrictionChain;
}