本文整理了Java中com.querydsl.core.types.Path.getAnnotatedElement()
方法的一些代码示例,展示了Path.getAnnotatedElement()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.getAnnotatedElement()
方法的具体详情如下:
包路径:com.querydsl.core.types.Path
类名称:Path
方法名:getAnnotatedElement
[英]Return the annotated element related to the given path
For property paths the annotated element contains the annotations of the related field and/or getter method and for all others paths the annotated element is the expression type.
[中]返回与给定路径相关的带注释的元素
对于属性路径,带注释的元素包含相关字段和/或getter方法的注释,对于所有其他路径,带注释的元素是表达式类型。
代码示例来源:origin: querydsl/querydsl
@Override
protected boolean isId(Path<?> arg) {
return arg.getAnnotatedElement().isAnnotationPresent(Id.class);
}
代码示例来源:origin: querydsl/querydsl
@Override
protected boolean isReference(Path<?> arg) {
return arg.getAnnotatedElement().isAnnotationPresent(Reference.class);
}
代码示例来源:origin: querydsl/querydsl
@Override
protected String getKeyForPath(Path<?> expr, PathMetadata metadata) {
AnnotatedElement annotations = expr.getAnnotatedElement();
if (annotations.isAnnotationPresent(Id.class)) {
Path<?> parent = expr.getMetadata().getParent();
if (parent.getAnnotatedElement().isAnnotationPresent(Reference.class)) {
return null; // go to parent
} else {
return "_id";
}
} else if (annotations.isAnnotationPresent(Property.class)) {
Property property = annotations.getAnnotation(Property.class);
if (!property.value().equals(Mapper.IGNORED_FIELDNAME)) {
return property.value();
}
} else if (annotations.isAnnotationPresent(Reference.class)) {
Reference reference = annotations.getAnnotation(Reference.class);
if (!reference.value().equals(Mapper.IGNORED_FIELDNAME)) {
return reference.value();
}
}
return super.getKeyForPath(expr, metadata);
}
代码示例来源:origin: com.querydsl/querydsl-hibernate-search
@Override
public String toField(Path<?> path) {
if (path.getAnnotatedElement() != null) {
Field fieldAnn = path.getAnnotatedElement().getAnnotation(Field.class);
if (fieldAnn != null && fieldAnn.name().length() > 0) {
return fieldAnn.name();
}
}
return super.toField(path);
}
代码示例来源:origin: com.querydsl/querydsl-jpa
@Override
protected void appendAsColumnName(Path<?> path, boolean precededByDot) {
if (path.getAnnotatedElement().isAnnotationPresent(Column.class)) {
Column column = path.getAnnotatedElement().getAnnotation(Column.class);
if (!column.name().isEmpty()) {
append(getTemplates().quoteIdentifier(column.name(), precededByDot));
} else {
super.appendAsColumnName(path, precededByDot);
}
} else {
super.appendAsColumnName(path, precededByDot);
}
}
代码示例来源:origin: com.querydsl/querydsl-jpa
projection = ExpressionUtils.as(projection, alias);
modified = true;
} else if (path.getAnnotatedElement().isAnnotationPresent(Column.class)) {
Column column = path.getAnnotatedElement().getAnnotation(Column.class);
if (!column.name().isEmpty()) {
aliases.put(path, column.name());
Path<?> path = (Path<?>) fargs.get(j);
String columnName;
if (path.getAnnotatedElement().isAnnotationPresent(Column.class)) {
Column column = path.getAnnotatedElement().getAnnotation(Column.class);
if (!column.name().isEmpty()) {
columnName = column.name();
内容来源于网络,如有侵权,请联系作者删除!