public class TypeUtils extends Object
TypeElement
and ClassName
.Constructor and Description |
---|
TypeUtils(Elements elements,
Types types) |
Modifier and Type | Method and Description |
---|---|
Stream<ExecutableElement> |
getAllPropertyMethods(TypeElement typeElement)
Returns all property methods - including inherited methods - as stream.
|
Optional<? extends AnnotationMirror> |
getAnnotationMirror(Element element,
Class<? extends Annotation> clazz) |
Optional<AnnotationValue> |
getAnnotationValue(Element element,
Class<? extends Annotation> clazz,
String name) |
com.squareup.javapoet.ClassName |
getBuilderReturnType(TypeElement typeElement)
Returns the type that the builder should return
Builder.build() . |
com.squareup.javapoet.ClassName |
getBuilderType(TypeElement typeElement) |
com.squareup.javapoet.ClassName |
getConcreteBuilderType(TypeElement typeElement) |
com.squareup.javapoet.ClassName |
getConcreteBuilderType(TypeMirror typeMirror) |
com.squareup.javapoet.ClassName |
getConcreteBuilderType(com.squareup.javapoet.TypeName type) |
com.squareup.javapoet.ClassName |
getDraftImplType(TypeElement typeElement) |
com.squareup.javapoet.ClassName |
getHasBuilderImplType(TypeElement typeElement) |
String |
getPackageName(Element element) |
Stream<ExecutableElement> |
getPropertyMethods(TypeElement typeElement)
Returns property methods - not included inherited methods - as stream.
|
com.squareup.javapoet.TypeName |
getResourceValueImplType(TypeElement resourceValueTypeElement) |
String |
getSimpleName(Element element) |
String |
getSimpleName(TypeMirror typeMirror) |
boolean |
isEnumType(com.squareup.javapoet.TypeName propertyType) |
boolean |
isPrimitiveOrEnum(com.squareup.javapoet.TypeName propertyType) |
boolean |
isPrimitiveType(com.squareup.javapoet.TypeName propertyType) |
boolean |
isPropertyMethod(ExecutableElement method)
Returns true iff.
|
public String getSimpleName(TypeMirror typeMirror)
public com.squareup.javapoet.ClassName getHasBuilderImplType(TypeElement typeElement)
public com.squareup.javapoet.ClassName getDraftImplType(TypeElement typeElement)
public com.squareup.javapoet.TypeName getResourceValueImplType(TypeElement resourceValueTypeElement)
public com.squareup.javapoet.ClassName getBuilderReturnType(TypeElement typeElement)
Builder.build()
.typeElement
- the type annotated with ResourceDraftValue
ResourceDraftValue.builderReturnsDslClass()
public com.squareup.javapoet.ClassName getConcreteBuilderType(TypeMirror typeMirror)
public com.squareup.javapoet.ClassName getConcreteBuilderType(TypeElement typeElement)
public com.squareup.javapoet.ClassName getConcreteBuilderType(com.squareup.javapoet.TypeName type)
public com.squareup.javapoet.ClassName getBuilderType(TypeElement typeElement)
public Stream<ExecutableElement> getAllPropertyMethods(TypeElement typeElement)
typeElement
- the type elementPropertyGenModel.getPropertyName(ExecutableElement)
public Stream<ExecutableElement> getPropertyMethods(TypeElement typeElement)
typeElement
- the type elementPropertyGenModel.getPropertyName(ExecutableElement)
public boolean isPropertyMethod(ExecutableElement method)
get
or is
or is annotated with JsonProperty
and if the given method doesn't have a static
, default
modifier and isn't annotated with
JsonIgnore
.method
- the methodpublic Optional<? extends AnnotationMirror> getAnnotationMirror(Element element, Class<? extends Annotation> clazz)
public Optional<AnnotationValue> getAnnotationValue(Element element, Class<? extends Annotation> clazz, String name)
public boolean isPrimitiveOrEnum(com.squareup.javapoet.TypeName propertyType)
propertyType
- the property type elementpublic boolean isPrimitiveType(com.squareup.javapoet.TypeName propertyType)
propertyType
- the property type elementpublic boolean isEnumType(com.squareup.javapoet.TypeName propertyType)
propertyType
- the property type element