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


Java PathBuilder.getType方法代码示例

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


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

示例1: getFieldType1

import com.mysema.query.types.path.PathBuilder; //导入方法依赖的package包/类
/**
 * Obtains the class type of the property named as {@code fieldName} of the
 * entity.
 * 
 * @param fieldName the field name.
 * @param entity the entity with a property named as {@code fieldName}
 * @return the class type
 */
public static <T> Class<?> getFieldType1(String fieldName,
        PathBuilder<T> entity) {
    Class<?> entityType = entity.getType();
    String fieldNameToFindType = fieldName;

    // Makes the array of classes to find fieldName agains them
    Class<?>[] classArray = ArrayUtils.<Class<?>> toArray(entityType);
    if (fieldName.contains(SEPARATOR_FIELDS)) {
        String[] fieldNameSplitted = StringUtils.split(fieldName,
                SEPARATOR_FIELDS);
        for (int i = 0; i < fieldNameSplitted.length - 1; i++) {
            Class<?> fieldType = BeanUtils.findPropertyType(
                    fieldNameSplitted[i],
                    ArrayUtils.<Class<?>> toArray(entityType));
            classArray = ArrayUtils.add(classArray, fieldType);
            entityType = fieldType;
        }
        fieldNameToFindType = fieldNameSplitted[fieldNameSplitted.length - 1];
    }

    return BeanUtils.findPropertyType(fieldNameToFindType, classArray);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:31,代码来源:QuerydslUtils.java

示例2: getTypeDescriptor

import com.mysema.query.types.path.PathBuilder; //导入方法依赖的package包/类
/**
 * Obtains the descriptor of the filtered field
 * 
 * @param fieldName
 * @param entity
 * @return
 */
public static <T> TypeDescriptor getTypeDescriptor(String fieldName,
        PathBuilder<T> entity) {
    Class<?> entityType = entity.getType();
    if (entityType == Object.class) {
        // Remove from path the root "entity" alias
        String fromRootPath = entity.toString().replaceFirst("^[^.]+[.]",
                "");
        TypeDescriptor fromRoot = getTypeDescriptor(fromRootPath, entity
                .getRoot().getType());
        if (fromRoot == null) {
            return null;
        }
        entityType = fromRoot.getType();
    }
    return getTypeDescriptor(fieldName, entityType);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:24,代码来源:QuerydslUtils.java

示例3: getFieldType1

import com.mysema.query.types.path.PathBuilder; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public <T> Class<?> getFieldType1(String fieldName, PathBuilder<T> entity) {
    Class<?> entityType = entity.getType();
    String fieldNameToFindType = fieldName;

    // Makes the array of classes to find fieldName agains them
    Class<?>[] classArray = ArrayUtils.<Class<?>> toArray(entityType);
    if (fieldName.contains(SEPARATOR_FIELDS)) {
        String[] fieldNameSplitted = StringUtils.split(fieldName,
                SEPARATOR_FIELDS);
        for (int i = 0; i < fieldNameSplitted.length - 1; i++) {
            Class<?> fieldType = BeanUtils.findPropertyType(
                    fieldNameSplitted[i],
                    ArrayUtils.<Class<?>> toArray(entityType));
            classArray = ArrayUtils.add(classArray, fieldType);
            entityType = fieldType;
        }
        fieldNameToFindType = fieldNameSplitted[fieldNameSplitted.length - 1];
    }

    return BeanUtils.findPropertyType(fieldNameToFindType, classArray);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:26,代码来源:QuerydslUtilsBeanImpl.java

示例4: getTypeDescriptor

import com.mysema.query.types.path.PathBuilder; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public <T> TypeDescriptor getTypeDescriptor(String fieldName,
        PathBuilder<T> entity) {
    Class<?> entityType = entity.getType();
    if (entityType == Object.class) {
        // Remove from path the root "entity" alias
        String fromRootPath = entity.toString().replaceFirst("^[^.]+[.]",
                "");
        TypeDescriptor fromRoot = getTypeDescriptor(fromRootPath, entity
                .getRoot().getType());
        if (fromRoot == null) {
            return null;
        }
        entityType = fromRoot.getType();
    }
    return getTypeDescriptor(fieldName, entityType);
}
 
开发者ID:gvSIGAssociation,项目名称:gvnix1,代码行数:21,代码来源:QuerydslUtilsBeanImpl.java


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