Class Type
- java.lang.Object
-
- org.inferred.freebuilder.processor.source.ValueType
-
- org.inferred.freebuilder.processor.source.Type
-
- All Implemented Interfaces:
Excerpt
- Direct Known Subclasses:
Type.TypeImpl,TypeClass
public abstract class Type extends ValueType implements Excerpt
Representation of a parameterized class or interface type.Similar to
DeclaredType, with a code-generation and test-friendly focus.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classType.JavadocLink(package private) static classType.TypeImpl-
Nested classes/interfaces inherited from class org.inferred.freebuilder.processor.source.ValueType
ValueType.FieldReceiver
-
-
Constructor Summary
Constructors Constructor Description Type()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddTo(SourceBuilder source)Excerptconstructor()Returns a source excerpt suitable for constructing an instance of this type, including "new" keyword but excluding brackets.ExcerptdiamondOperator()Returns a source excerpt equivalent to the diamond operator for this type.static Typefrom(java.lang.Class<?> cls)static Typefrom(javax.lang.model.type.DeclaredType declaredType)abstract QualifiedNamegetQualifiedName()Returns the qualified name of the type class.java.lang.StringgetSimpleName()Returns the simple name of the type class.protected abstract java.util.List<?>getTypeParameters()booleanisParameterized()Returns true if the type class is generic.Type.JavadocLinkjavadocLink()Returns a source excerpt of a JavaDoc link to this type.Type.JavadocLinkjavadocMethodLink(java.lang.String memberName, Type... types)Returns a source excerpt of a JavaDoc link to a method on this type.Type.JavadocLinkjavadocNoArgMethodLink(java.lang.String memberName)Returns a source excerpt of a JavaDoc link to a no-args method on this type.ExcerpttypeParameters()Returns a source excerpt of the type parameters of this type, including angle brackets.TypewithWildcards()Returns a new type of the same class, parameterized with wildcards ("?").
-
-
-
Method Detail
-
from
public static Type from(javax.lang.model.type.DeclaredType declaredType)
-
from
public static Type from(java.lang.Class<?> cls)
-
getQualifiedName
public abstract QualifiedName getQualifiedName()
Returns the qualified name of the type class.
-
getTypeParameters
protected abstract java.util.List<?> getTypeParameters()
-
getSimpleName
public java.lang.String getSimpleName()
Returns the simple name of the type class.
-
isParameterized
public boolean isParameterized()
Returns true if the type class is generic.
-
constructor
public Excerpt constructor()
Returns a source excerpt suitable for constructing an instance of this type, including "new" keyword but excluding brackets.
-
javadocLink
public Type.JavadocLink javadocLink()
Returns a source excerpt of a JavaDoc link to this type.
-
javadocNoArgMethodLink
public Type.JavadocLink javadocNoArgMethodLink(java.lang.String memberName)
Returns a source excerpt of a JavaDoc link to a no-args method on this type.
-
javadocMethodLink
public Type.JavadocLink javadocMethodLink(java.lang.String memberName, Type... types)
Returns a source excerpt of a JavaDoc link to a method on this type.
-
typeParameters
public Excerpt typeParameters()
Returns a source excerpt of the type parameters of this type, including angle brackets. Always an empty string if the type class is not generic.e.g.
<N, C>
-
diamondOperator
public Excerpt diamondOperator()
Returns a source excerpt equivalent to the diamond operator for this type.Always an empty string if the type class is not generic.
-
withWildcards
public Type withWildcards()
Returns a new type of the same class, parameterized with wildcards ("?").If the type class is not generic, the returned object will be equal to this one.
-
addTo
public void addTo(SourceBuilder source)
-
-