Class FunctionalType
java.lang.Object
org.inferred.freebuilder.processor.source.ValueType
org.inferred.freebuilder.processor.source.FunctionalType
Metadata about a functional interface.
-
Nested Class Summary
Nested classes/interfaces inherited from class ValueType
ValueType.FieldReceiver -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Typeprivate final Stringprivate final List<TypeMirror> private final TypeMirror -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateFunctionalType(Type functionalInterface, String methodName, Collection<? extends TypeMirror> parameters, TypeMirror returnType) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddFields(ValueType.FieldReceiver fields) Implement this method to report the name and value of each field.booleanstatic FunctionalTypeconsumer(TypeMirror type) ReturnsConsumer<type>.static FunctionalTypefunctionalTypeAcceptedByMethod(DeclaredType type, String methodName, FunctionalType prototype, Elements elements, Types types) Returns the functional type accepted bymethodNameontype, assignable toprototype, orprototypeitself if no such method has been declared.static List<FunctionalType> functionalTypesAcceptedByMethod(DeclaredType type, String methodName, Elements elements, Types types) Returns the functional types accepted bymethodNameontype.private static booleanisAssignable(TypeMirror fromParam, TypeMirror toParam, Types types) static booleanisAssignable(FunctionalType fromType, FunctionalType toType, Types types) private static booleanisVoid(TypeMirror type) static Optional<FunctionalType> maybeFunctionalType(DeclaredType type, Elements elements, Types types) static Optional<FunctionalType> maybeFunctionalType(TypeMirror type, Elements elements, Types types) static FunctionalTypetoString()static FunctionalTypeunaryOperator(TypeMirror type) ReturnsUnaryOperator<type>.static FunctionalTypeunboxedUnaryOperator(TypeMirror type, Types types) Returns a unary operator that will accepttype, without autoboxing if possible.
-
Field Details
-
functionalInterface
-
methodName
-
parameters
-
returnType
-
-
Constructor Details
-
FunctionalType
private FunctionalType(Type functionalInterface, String methodName, Collection<? extends TypeMirror> parameters, TypeMirror returnType)
-
-
Method Details
-
consumer
ReturnsConsumer<type>.- Throws:
IllegalArgumentException- iftypeis primitive
-
unaryOperator
ReturnsUnaryOperator<type>.- Throws:
IllegalArgumentException- iftypeis primitive
-
primitiveUnaryOperator
- Throws:
IllegalArgumentException- iftypeis not one of int, long or double
-
unboxedUnaryOperator
Returns a unary operator that will accepttype, without autoboxing if possible. -
functionalTypeAcceptedByMethod
public static FunctionalType functionalTypeAcceptedByMethod(DeclaredType type, String methodName, FunctionalType prototype, Elements elements, Types types) Returns the functional type accepted bymethodNameontype, assignable toprototype, orprototypeitself if no such method has been declared.Used to allow the user to override the functional interface used on builder methods, e.g. to force boxing, or to use Guava types.
-
functionalTypesAcceptedByMethod
public static List<FunctionalType> functionalTypesAcceptedByMethod(DeclaredType type, String methodName, Elements elements, Types types) Returns the functional types accepted bymethodNameontype. -
maybeFunctionalType
public static Optional<FunctionalType> maybeFunctionalType(TypeMirror type, Elements elements, Types types) -
maybeFunctionalType
public static Optional<FunctionalType> maybeFunctionalType(DeclaredType type, Elements elements, Types types) -
isAssignable
-
isAssignable
-
isVoid
-
getFunctionalInterface
-
getMethodName
-
getParameters
-
getReturnType
-
canReturnNull
public boolean canReturnNull() -
addFields
Description copied from class:ValueTypeImplement this method to report the name and value of each field. -
toString
-