本文整理汇总了Java中javax.persistence.metamodel.MapAttribute.getKeyJavaType方法的典型用法代码示例。如果您正苦于以下问题:Java MapAttribute.getKeyJavaType方法的具体用法?Java MapAttribute.getKeyJavaType怎么用?Java MapAttribute.getKeyJavaType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.persistence.metamodel.MapAttribute
的用法示例。
在下文中一共展示了MapAttribute.getKeyJavaType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSelectedType
import javax.persistence.metamodel.MapAttribute; //导入方法依赖的package包/类
private Class<?> getSelectedType(Path entityPath, Set<TypeDefinition> typeDefinitions) {
if (entityPath.isKeyPath()) {
TypeDefinition typeDefinition = typeForAlias(entityPath.getRootAlias())
.withMetamodel(metamodel)
.filter(typeDefinitions);
MapAttribute<?, ?, ?> mapAttribute = (MapAttribute<?, ?, ?>)attributeForPath(typeDefinition.getJoinPath())
.withMetamodel(metamodel)
.filter(typeDefinitions);
Class<?> keyType = mapAttribute.getKeyJavaType();
if (!entityPath.hasSubpath()) {
return keyType;
}
return attributeForPath(new Path(entityPath.getSubpath()))
.withMetamodel(metamodel)
.withRootType(keyType)
.filter()
.getJavaType();
} else if (entityPath.hasSubpath()) {
SingularAttribute<?, ?> attribute = (SingularAttribute<?, ?>)attributeForPath(entityPath)
.withMetamodel(metamodel)
.filter(typeDefinitions);
return attribute.getType().getJavaType();
} else {
return typeForAlias(entityPath.getRootAlias()).withMetamodel(metamodel).filter(typeDefinitions).getType();
}
}
示例2: visitJoin
import javax.persistence.metamodel.MapAttribute; //导入方法依赖的package包/类
private boolean visitJoin(Node node,
Set<TypeDefinition> typeDefinitions,
boolean innerJoin,
boolean fetchJoin) {
Path fetchPath = new Path(node.jjtGetChild(0).toString());
Class<?> keyType = null;
Attribute<?, ?> attribute = TypeDefinition.Filter.attributeForPath(fetchPath)
.withMetamodel(metamodel)
.filter(typeDefinitions);
Class<?> type;
if (attribute instanceof MapAttribute) {
MapAttribute<?, ?, ?> mapAttribute = (MapAttribute<?, ?, ?>)attribute;
keyType = mapAttribute.getKeyJavaType();
type = mapAttribute.getBindableJavaType();
} else {
type = TypeDefinition.Filter.managedTypeForPath(fetchPath)
.withMetamodel(metamodel)
.filter(typeDefinitions)
.getJavaType();
}
if (keyType != null) {
typeDefinitions.add(new TypeDefinition(keyType, fetchPath, innerJoin, fetchJoin));
}
if (node.jjtGetNumChildren() == 1) {
typeDefinitions.add(new TypeDefinition(type, fetchPath, innerJoin, fetchJoin));
} else {
Alias alias = getAlias(node);
typeDefinitions.add(new TypeDefinition(alias, type, fetchPath, innerJoin, fetchJoin));
}
return false;
}