public class FunctionalType extends ValueType
ValueType.FieldReceiver| Modifier and Type | Method and Description |
|---|---|
protected void |
addFields(ValueType.FieldReceiver fields)
Implement this method to report the name and value of each field.
|
boolean |
canReturnNull() |
static FunctionalType |
consumer(javax.lang.model.type.TypeMirror type)
Returns
Consumer<type>. |
static FunctionalType |
functionalTypeAcceptedByMethod(javax.lang.model.type.DeclaredType type,
java.lang.String methodName,
FunctionalType prototype,
javax.lang.model.util.Elements elements,
javax.lang.model.util.Types types)
Returns the functional type accepted by
methodName on type, assignable to
prototype, or prototype itself if no such method has been declared. |
static java.util.List<FunctionalType> |
functionalTypesAcceptedByMethod(javax.lang.model.type.DeclaredType type,
java.lang.String methodName,
javax.lang.model.util.Elements elements,
javax.lang.model.util.Types types)
Returns the functional types accepted by
methodName on type. |
Type |
getFunctionalInterface() |
java.lang.String |
getMethodName() |
java.util.List<javax.lang.model.type.TypeMirror> |
getParameters() |
javax.lang.model.type.TypeMirror |
getReturnType() |
static boolean |
isAssignable(FunctionalType fromType,
FunctionalType toType,
javax.lang.model.util.Types types) |
static java.util.Optional<FunctionalType> |
maybeFunctionalType(javax.lang.model.type.DeclaredType type,
javax.lang.model.util.Elements elements,
javax.lang.model.util.Types types) |
static java.util.Optional<FunctionalType> |
maybeFunctionalType(javax.lang.model.type.TypeMirror type,
javax.lang.model.util.Elements elements,
javax.lang.model.util.Types types) |
static FunctionalType |
primitiveUnaryOperator(javax.lang.model.type.PrimitiveType type)
Returns one of
IntUnaryOperator, LongUnaryOperator or
DoubleUnaryOperator, depending on type. |
java.lang.String |
toString() |
static FunctionalType |
unaryOperator(javax.lang.model.type.TypeMirror type)
Returns
UnaryOperator<type>. |
static FunctionalType |
unboxedUnaryOperator(javax.lang.model.type.TypeMirror type,
javax.lang.model.util.Types types)
Returns a unary operator that will accept
type, without autoboxing if possible. |
public static FunctionalType consumer(javax.lang.model.type.TypeMirror type)
Consumer<type>.java.lang.IllegalArgumentException - if type is primitivepublic static FunctionalType unaryOperator(javax.lang.model.type.TypeMirror type)
UnaryOperator<type>.java.lang.IllegalArgumentException - if type is primitivepublic static FunctionalType primitiveUnaryOperator(javax.lang.model.type.PrimitiveType type)
IntUnaryOperator, LongUnaryOperator or
DoubleUnaryOperator, depending on type.java.lang.IllegalArgumentException - if type is not one of int, long or doublepublic static FunctionalType unboxedUnaryOperator(javax.lang.model.type.TypeMirror type, javax.lang.model.util.Types types)
type, without autoboxing if possible.public static FunctionalType functionalTypeAcceptedByMethod(javax.lang.model.type.DeclaredType type, java.lang.String methodName, FunctionalType prototype, javax.lang.model.util.Elements elements, javax.lang.model.util.Types types)
methodName on type, assignable to
prototype, or prototype itself 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.
public static java.util.List<FunctionalType> functionalTypesAcceptedByMethod(javax.lang.model.type.DeclaredType type, java.lang.String methodName, javax.lang.model.util.Elements elements, javax.lang.model.util.Types types)
methodName on type.public static java.util.Optional<FunctionalType> maybeFunctionalType(javax.lang.model.type.TypeMirror type, javax.lang.model.util.Elements elements, javax.lang.model.util.Types types)
public static java.util.Optional<FunctionalType> maybeFunctionalType(javax.lang.model.type.DeclaredType type, javax.lang.model.util.Elements elements, javax.lang.model.util.Types types)
public static boolean isAssignable(FunctionalType fromType, FunctionalType toType, javax.lang.model.util.Types types)
public Type getFunctionalInterface()
public java.lang.String getMethodName()
public java.util.List<javax.lang.model.type.TypeMirror> getParameters()
public javax.lang.model.type.TypeMirror getReturnType()
public boolean canReturnNull()
protected void addFields(ValueType.FieldReceiver fields)
ValueType