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


Java From.get方法代码示例

本文整理汇总了Java中javax.persistence.criteria.From.get方法的典型用法代码示例。如果您正苦于以下问题:Java From.get方法的具体用法?Java From.get怎么用?Java From.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.persistence.criteria.From的用法示例。


在下文中一共展示了From.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFieldPath

import javax.persistence.criteria.From; //导入方法依赖的package包/类
public FieldPath getFieldPath(From root, String fullPropertyName) {
    String[] pieces = fullPropertyName.split("\\.");
    List<String> associationPath = new ArrayList<String>();
    List<String> basicProperties = new ArrayList<String>();
    int j = 0;
    for (String piece : pieces) {
        checkPiece: {
            if (j == 0) {
                Path path = root.get(piece);
                if (path instanceof PluralAttributePath) {
                    associationPath.add(piece);
                    break checkPiece;
                }
            }
            basicProperties.add(piece);
        }
        j++;
    }
    FieldPath fieldPath = new FieldPath()
        .withAssociationPath(associationPath)
        .withTargetPropertyPieces(basicProperties);

    return fieldPath;
}
 
开发者ID:passion1014,项目名称:metaworks_framework,代码行数:25,代码来源:FieldPathBuilder.java

示例2: createPredicate

import javax.persistence.criteria.From; //导入方法依赖的package包/类
@Override
public javax.persistence.criteria.Predicate createPredicate(From<?, ?> from, CriteriaBuilder criteriaBuilder, String attributeName) {
    Expression<?> expression = from.get(attributeName);

    if (values.isEmpty()) {
        return addNullCase ? expression.isNull() : criteriaBuilder.conjunction();
    } else if (isBasicFilter()) {
        return super.createPredicate(from, criteriaBuilder, attributeName);
    }

    javax.persistence.criteria.Predicate predicate;
    if (isBooleanComparison) {
        predicate = expression.in(booleanValues);
    } else {
        predicate = expression.as(String.class).in(values);
    }
    if (addNullCase) predicate = criteriaBuilder.or(predicate, expression.isNull());

    return predicate;
}
 
开发者ID:darrachequesne,项目名称:spring-data-jpa-datatables,代码行数:21,代码来源:ColumnFilter.java

示例3: getNextPath

import javax.persistence.criteria.From; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private <X> PathImplementor<X> getNextPath(final String pathFragment, final From<?, ?> from) {
	PathImplementor<?> currentPath = (PathImplementor<?>) from.get(pathFragment);
	fixAlias(from, aliasCounter);

	// Handle join. Does not manage many-to-many
	if (currentPath.getAttribute().getPersistentAttributeType() != PersistentAttributeType.BASIC) {
		currentPath = getJoinPath(from, currentPath.getAttribute());
		if (currentPath == null) {
			// if no join, we create it
			currentPath = fixAlias(from.join(pathFragment, JoinType.LEFT), aliasCounter);
		}
	}
	return (PathImplementor<X>) currentPath;
}
 
开发者ID:ligoj,项目名称:bootstrap,代码行数:16,代码来源:AbstractSpecification.java

示例4: getExpression

import javax.persistence.criteria.From; //导入方法依赖的package包/类
/**
 * Cree une expression Criteria API avec l'atribut de l'entité passé en parametre
 * 
 * @param root
 *            entité JPA contenant le champ
 * @param columnData
 *            nom du champ
 * @param clazz
 *            class du champ
 * @param <S>
 *            type du champ
 * @return l'expression de l'atribut
 */
public static <S> Path<S> getExpression(final Root<?> root, final String columnData, final Class<S> clazz) {
    if (!columnData.contains(DatatableSpecification.ATTRIBUTE_SEPARATOR)) {
        // columnData is like "attribute" so nothing particular to do
        return root.get(columnData);
    }
    // columnData is like "joinedEntity.attribute" so add a join clause
    final String[] values = columnData.split(DatatableSpecification.ESCAPED_ATTRIBUTE_SEPARATOR);
    final Attribute<?, ?> attribute = root.getModel().getAttribute(values[0]);
    if (attribute == null) {
        throw new IllegalArgumentException(
            "Colonne '" + values[0] + "' (" + columnData + ") introuvable depuis l'entité '" + root.getJavaType()
                + "'");
    }
    if (attribute.getPersistentAttributeType() == PersistentAttributeType.EMBEDDED) {
        // with @Embedded attribute
        return root.get(values[0]).get(values[1]);
    }
    From<?, ?> from = root;
    for (int i = 0; i < values.length - 1; i++) {

        Join<?, ?> join = null;
        for (final Join<?, ?> joinCandidate : from.getJoins()) {
            if (joinCandidate.getAttribute().getName().equals(values[i])) {
                // LOGGER.debug("Trouve joint d'entite: '{}'", values[i]);
                join = joinCandidate;
            }
        }
        if (join == null) {
            // LOGGER.debug("Joigant entite '{}'...", values[i]);
            join = from.join(values[i], JoinType.INNER);
        }
        from = join;
    }
    return from.get(values[values.length - 1]);
}
 
开发者ID:andresoviedo,项目名称:datatable-java,代码行数:49,代码来源:DatatableHelper.java

示例5: getPath

import javax.persistence.criteria.From; //导入方法依赖的package包/类
protected <T, S> Path<?> getPath(From<T, S> root, String name) {
	int index = name.indexOf(".");
	if (index > 0 ) {
		String attribute = name.substring(0, index);
		From<S, ?> join = getJoin(attribute, root.getJoins());
		if (join == null) {
			join = root.join(attribute);
		}
		return getPath(join, name.substring(index + 1));
	} else {
		return root.get(name);
	}
}
 
开发者ID:ActiveJpa,项目名称:activejpa,代码行数:14,代码来源:AbstractConstruct.java

示例6: createPredicate

import javax.persistence.criteria.From; //导入方法依赖的package包/类
@Override
public Predicate createPredicate(From<?, ?> from, CriteriaBuilder criteriaBuilder, String attributeName) {
    Expression<?> expression = from.get(attributeName);
    return criteriaBuilder.like(criteriaBuilder.lower(expression.as(String.class)), escapedRawValue, '~');
}
 
开发者ID:darrachequesne,项目名称:spring-data-jpa-datatables,代码行数:6,代码来源:GlobalFilter.java


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