Class BuildableType
java.lang.Object
org.inferred.freebuilder.processor.BuildableType
- Direct Known Subclasses:
BuildableType_Builder.Rebuildable
Metadata about a buildable user type.
A buildable type is one with a Builder class providing a similar API to proto or @FreeBuilder:
- a public constructor, or static builder()/newBuilder() method;
- build(), buildPartial() and clear() methods; and
- a mergeFrom(Value) method.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classprivate static final classprivate static final classprivate static final classstatic enumHow to merge the values from one Builder into another.static enumHow to convert a partial value into a Builder. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Function<Element, Stream<ExecutableElement>> private static final Function<Element, Stream<TypeElement>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract BuilderFactoryabstract TypeReturns the builder type that will build instances oftype().static BuildableTypecreate(DeclaredType datatype, DeclaredType builder, Elements elements, Types types) private static BuildableType.MergeBuilderMethoddetectMergeFromBuilderMethod(DeclaredType builder, Elements elements, Types types, TypeElement datatypeElement) private static BuildableType.PartialToBuilderMethoddetectPartialToBuilderMethod(DeclaredType datatype, DeclaredType builder, Elements elements, Types types) private static booleanisBuilderType(TypeElement element) private static booleanisCallableMethod(ExecutableElement element) private static booleanisClearMethod(ExecutableElement element) static Optional<DeclaredType> maybeBuilder(DeclaredType type, Elements elements, Types types) abstract BuildableType.MergeBuilderMethodprivate static booleanmethodIsObscured(DeclaredType targetType, Elements elements, Types types, DeclaredType returnType, String methodName, DeclaredType... parameterTypes) newBuilder(BuilderFactory.TypeInference typeInference) Returns an excerpt calling the Builder factory method.abstract BuildableType.PartialToBuilderMethodabstract Excerptprivate static ExcerptsuppressUncheckedExcerptFor(DeclaredType datatype) abstract Typetype()Returns the parameterized buildable type.
-
Field Details
-
TYPES
-
METHODS
-
-
Constructor Details
-
BuildableType
public BuildableType()
-
-
Method Details
-
type
Returns the parameterized buildable type.This may be parameterized with any compatible types, including concrete types, wildcards, type variables, or generic types containing any combination of the above.
-
builderType
Returns the builder type that will build instances oftype(). -
mergeBuilder
-
partialToBuilder
-
builderFactory
-
suppressUnchecked
-
newBuilder
Returns an excerpt calling the Builder factory method. -
maybeBuilder
public static Optional<DeclaredType> maybeBuilder(DeclaredType type, Elements elements, Types types) -
methodIsObscured
private static boolean methodIsObscured(DeclaredType targetType, Elements elements, Types types, DeclaredType returnType, String methodName, DeclaredType... parameterTypes) -
create
public static BuildableType create(DeclaredType datatype, DeclaredType builder, Elements elements, Types types) -
detectMergeFromBuilderMethod
private static BuildableType.MergeBuilderMethod detectMergeFromBuilderMethod(DeclaredType builder, Elements elements, Types types, TypeElement datatypeElement) -
detectPartialToBuilderMethod
private static BuildableType.PartialToBuilderMethod detectPartialToBuilderMethod(DeclaredType datatype, DeclaredType builder, Elements elements, Types types) -
suppressUncheckedExcerptFor
-
isCallableMethod
-
isBuilderType
-
isClearMethod
-