本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}