public class ImpliedClass extends Object implements TypeElement
TypeElement representing a class that needs to be generated.
Typically created by a Processor during user
code analysis, and subsequently generated using openSourceWriter(javax.annotation.processing.Filer).
This type implements TypeElement, as the API is stable, well-known, and lets
processors treat to-be-generated and user-supplied types the same way. However, not all methods
are implemented (those that are not are marked @Deprecated); additionally,
compilers are free to implement Elements and Types
in a manner hostile to third-party classes (e.g. by casting a TypeElement to a private
internal class), so they are, unfortunately, not fully interchangeable at present.
| Modifier and Type | Class and Description |
|---|---|
static class |
ImpliedClass.ImpliedNestedClass
TypeElement representing a nested class of a class that needs to be generated. |
| Constructor and Description |
|---|
ImpliedClass(PackageElement pkg,
CharSequence simpleName,
Element originatingElement,
Elements elementUtils)
Constructor for
ImpliedClass. |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetEnclosedElements, getEnclosingElement, getInterfaces, getNestingKind, getQualifiedName, getSimpleName, getSuperclass, getTypeParametersaccept, asType, equals, getAnnotation, getAnnotationMirrors, getKind, getModifiers, hashCodepublic ImpliedClass(PackageElement pkg, CharSequence simpleName, Element originatingElement, Elements elementUtils)
ImpliedClass.pkg - the package the class should be created insimpleName - the name the class should be given (without package)originatingElement - the element that triggered the code generationelementUtils - the compiler-provided Elements implementationpublic ImpliedClass.ImpliedNestedClass createNestedClass(CharSequence simpleName)
simpleName.
This is used to prevent namespace clashes when writing source code.
public Set<ImpliedClass.ImpliedNestedClass> getNestedClasses()
public CompilationUnitWriter openSourceWriter(Filer filer) throws FilerException
CompilationUnitWriter for creating this class. The file preamble (package and
imports) will be generated automatically.FilerException - if a Filer guarantee is violated (see the FilerException
JavaDoc for more information); propagated because this is often seen in GUIDE projects,
so should be downgraded to a warning, whereas runtime exceptions should be flagged as an
internal error to the userpublic <R,P> R accept(ElementVisitor<R,P> v, P p)
@Deprecated public TypeMirror asType()
@Deprecated public <A extends Annotation> A getAnnotation(Class<A> annotationType)
getAnnotation in interface Element@Deprecated public List<? extends AnnotationMirror> getAnnotationMirrors()
getAnnotationMirrors in interface Elementpublic ElementKind getKind()
@Deprecated public Set<Modifier> getModifiers()
getModifiers in interface Element@Deprecated public List<? extends Element> getEnclosedElements()
getEnclosedElements in interface ElementgetEnclosedElements in interface TypeElementpublic E getEnclosingElement()
getEnclosingElement in interface ElementgetEnclosingElement in interface TypeElement@Deprecated public List<? extends TypeMirror> getInterfaces()
getInterfaces in interface TypeElementpublic NestingKind getNestingKind()
getNestingKind in interface TypeElementpublic Name getQualifiedName()
getQualifiedName in interface QualifiedNameablegetQualifiedName in interface TypeElementpublic Name getSimpleName()
getSimpleName in interface ElementgetSimpleName in interface TypeElement@Deprecated public TypeMirror getSuperclass()
getSuperclass in interface TypeElement@Deprecated public List<? extends TypeParameterElement> getTypeParameters()
getTypeParameters in interface ParameterizablegetTypeParameters in interface TypeElementpublic int hashCode()
public boolean equals(Object obj)
public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType)
Copyright © 2015 Google, Inc.. All rights reserved.