use of javax.lang.model.type.TypeMirror in project buck by facebook.
the class TreeResolver method getType.
@Nullable
public TypeMirror getType(TreePath path) {
Tree tree = path.getLeaf();
TypeMirror result = treesToTypes.get(tree);
if (result != null) {
return result;
}
treesToTypes.put(tree, resolveType(path));
return treesToTypes.get(tree);
}
use of javax.lang.model.type.TypeMirror in project hibernate-orm by hibernate.
the class JPAMetaModelEntityProcessor method modelGenerationNeedsToBeDeferred.
private boolean modelGenerationNeedsToBeDeferred(Collection<MetaEntity> entities, MetaEntity containedEntity) {
ContainsAttributeTypeVisitor visitor = new ContainsAttributeTypeVisitor(containedEntity.getTypeElement(), context);
for (MetaEntity entity : entities) {
if (entity.equals(containedEntity)) {
continue;
}
for (Element subElement : ElementFilter.fieldsIn(entity.getTypeElement().getEnclosedElements())) {
TypeMirror mirror = subElement.asType();
if (!TypeKind.DECLARED.equals(mirror.getKind())) {
continue;
}
boolean contains = mirror.accept(visitor, subElement);
if (contains) {
return true;
}
}
for (Element subElement : ElementFilter.methodsIn(entity.getTypeElement().getEnclosedElements())) {
TypeMirror mirror = subElement.asType();
if (!TypeKind.DECLARED.equals(mirror.getKind())) {
continue;
}
boolean contains = mirror.accept(visitor, subElement);
if (contains) {
return true;
}
}
}
return false;
}
use of javax.lang.model.type.TypeMirror in project hibernate-orm by hibernate.
the class BasicAttributeVisitor method visitExecutable.
@Override
public AnnotationMetaAttribute visitExecutable(ExecutableType t, Element p) {
if (!p.getKind().equals(ElementKind.METHOD)) {
return null;
}
String string = p.getSimpleName().toString();
if (!StringUtil.isProperty(string, TypeUtils.toTypeString(t.getReturnType()))) {
return null;
}
TypeMirror returnType = t.getReturnType();
return returnType.accept(this, p);
}
use of javax.lang.model.type.TypeMirror in project hibernate-orm by hibernate.
the class BasicAttributeVisitor method visitTypeVariable.
@Override
public AnnotationMetaAttribute visitTypeVariable(TypeVariable t, Element element) {
// METAGEN-29 - for a type variable we use the upper bound
TypeMirror mirror = t.getUpperBound();
TypeMirror erasedType = context.getTypeUtils().erasure(mirror);
return new AnnotationMetaSingleAttribute(entity, element, erasedType.toString());
}
use of javax.lang.model.type.TypeMirror in project hibernate-orm by hibernate.
the class BasicAttributeVisitor method getFullyQualifiedClassNameOfTargetEntity.
private String getFullyQualifiedClassNameOfTargetEntity(AnnotationMirror mirror, String parameterName) {
assert mirror != null;
assert parameterName != null;
String targetEntityName = null;
Object parameterValue = TypeUtils.getAnnotationValue(mirror, parameterName);
if (parameterValue != null) {
TypeMirror parameterType = (TypeMirror) parameterValue;
if (!parameterType.getKind().equals(TypeKind.VOID)) {
targetEntityName = parameterType.toString();
}
}
return targetEntityName;
}
Aggregations