@Override public <R, P> R accept(TypeVisitor<R, P> v, P p) { return delegate.accept(v, p); }
@Override public <R, P> R accept(TypeVisitor<R, P> v, P p) { return this.originalType.accept(v, p); } }
@Override public <R, P> R accept(TypeVisitor<R, P> v, P p) { return this.originalType.accept(v, p); } }
@Override public <R, P> R accept(TypeVisitor<R, P> v, P p) { return this.originalType.accept(v, p); } }
@Override public <R, P> R accept(TypeVisitor<R, P> v, P p) { return this.originalType.accept(v, p); } }
@Override public <R, P> R accept(TypeVisitor<R, P> v, P p) { return this.originalType.accept(v, p); } }
@Override public <R, P> R accept(TypeVisitor<R, P> v, P p) { return this.originalType.accept(v, p); } }
@Override public T visitAnnotation(AnnotationMirror annotationMirror, Void aVoid) { if (type.isAssignableFrom(ASTAnnotation.class)){ ASTType annotationType = annotationMirror.getAnnotationType().accept(astTypeBuilderVisitor, null); return (T) astFactory.buildASTElementAnnotation(annotationMirror, annotationType); } return null; } }
@Override public T visitAnnotation(AnnotationMirror annotationMirror, Void aVoid) { if (type.isAssignableFrom(ASTAnnotation.class)){ ASTType annotationType = annotationMirror.getAnnotationType().accept(astTypeBuilderVisitor, null); return (T) astFactory.buildASTElementAnnotation(annotationMirror, annotationType); } return null; } }
private ImmutableSet<ASTAnnotation> getAnnotations(Element element) { ImmutableSet.Builder<ASTAnnotation> annotationBuilder = ImmutableSet.builder(); for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) { ASTType type = annotationMirror.getAnnotationType().accept(astTypeBuilderVisitor, null); annotationBuilder.add(astFactory.buildASTElementAnnotation(annotationMirror, type)); } return annotationBuilder.build(); }
/** Which {@code Optional} type is used. */ OptionalKind kind() { return declaredOptionalType().accept(OPTIONAL_KIND, null).get(); }
/** * Return a JSON type for the given declared type. The caller is responsible for * providing a list of concrete types to use to replace parameterized type placeholders. */ private JsonType jsonTypeForDeclaredType(DeclaredType type, List<? extends TypeMirror> concreteTypes, Collection<String> typeRecursionGuard) { JsonType jt = _memoizedDeclaredTypes.get(type); if (jt == null) { TypeVisitorImpl visitor = new TypeVisitorImpl(type, concreteTypes, typeRecursionGuard); jt = type.accept(visitor, null); _memoizedDeclaredTypes.put(type, jt); } return jt; }
@Override public JsonType visitTypeVariable(TypeVariable typeVariable, Void o) { DeclaredType type = getDeclaredTypeForTypeVariable(typeVariable); if (type != null) { // null: un-parameterized usage of a generics-having type try { return type.accept(this, o); } catch (UnsupportedOperationException e) { // likely we ran into a type we can't work with (e.g. ErrorType), continue with best effort return null; } } else { return null; } }
@Override public String visitAnnotation(AnnotationMirror a, TypeAndUtils utils) { final String annotationType = a.getAnnotationType().accept(TypeSourceFormatter.INSTANCE, utils.getUtils()); StringBuilder sb = new StringBuilder("net.peachjean.tater.utils.AnnotationInvocationHandler.<") .append(annotationType) .append(">implement(") .append(annotationType) .append(".class)"); for(ExecutableElement element : a.getElementValues().keySet()) { sb.append(".withMemberValue(\"") .append(element.getSimpleName().toString()) .append("\", ") .append(a.getElementValues().get(element).accept(this, utils)) .append(")"); } return sb.append(".build()").toString(); }
void scanAnnotation(TypeRecord owningType, Element annotated, AnnotationMirror annotation) { TypeElement type = annotation.getAnnotationType().accept(getTypeElement, null); if (type != null) { addUse(owningType, annotated, type, UseSite.Type.ANNOTATES); addType(type, true); } }
void scanAnnotation(TypeRecord owningType, Element annotated, AnnotationMirror annotation) { TypeElement type = annotation.getAnnotationType().accept(getTypeElement, null); if (type != null) { addUse(owningType, annotated, type, UseSite.Type.ANNOTATES); addType(type, true); } }
@Override public AnnotationRef apply(AnnotationMirror item) { TypeRef annotationType = item.getAnnotationType().accept(new TypeRefTypeVisitor(), 0); Map<String, Object> parameters = new HashMap<String, Object>(); if (annotationType instanceof ClassRef) { for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : item.getElementValues().entrySet()) { String key = entry.getKey().toString().replace(EMPTY_PARENTHESIS, EMPTY); Object value = mapAnnotationValue(entry.getValue().getValue()); parameters.put(key, value); } return new AnnotationRefBuilder() .withClassRef((ClassRef) annotationType) .withParameters(parameters) .build(); } throw new IllegalStateException("Annotation type: ["+annotationType+"] is not a class reference."); } });