当前位置: 首页>>代码示例>>Java>>正文


Java MapAttribute.getKeyJavaType方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:ArneLimburg,项目名称:jpasecurity,代码行数:27,代码来源:EntityFilter.java

示例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;
}
 
开发者ID:ArneLimburg,项目名称:jpasecurity,代码行数:32,代码来源:JpqlCompiler.java


注:本文中的javax.persistence.metamodel.MapAttribute.getKeyJavaType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。