T
- resulting typeU
- input typepublic interface TypeCoercer<U,T> extends Concatable<T>
Used to coerce JSON parser output from BUCK files into the proper type to populate Description rule args.
Modifier and Type | Interface and Description |
---|---|
static interface |
TypeCoercer.Traversal |
Modifier and Type | Method and Description |
---|---|
default <S> TypeCoercer<U,S> |
checkOutputAssignableTo(com.google.common.reflect.TypeToken<S> type)
Runtime checked cast.
|
default <S> TypeCoercer<S,T> |
checkUnconfiguredAssignableTo(com.google.common.reflect.TypeToken<S> type)
Runtime checked cast.
|
T |
coerce(CellNameResolver cellRoots,
ProjectFilesystem filesystem,
ForwardRelativePath pathRelativeToProjectRoot,
TargetConfiguration targetConfiguration,
TargetConfiguration hostConfiguration,
U object) |
default T |
coerceBoth(CellNameResolver cellRoots,
ProjectFilesystem filesystem,
ForwardRelativePath pathRelativeToProjectRoot,
TargetConfiguration targetConfiguration,
TargetConfiguration hostConfiguration,
Object object)
|
U |
coerceToUnconfigured(CellNameResolver cellRoots,
ProjectFilesystem filesystem,
ForwardRelativePath pathRelativeToProjectRoot,
Object object)
Coerce to a value for unconfigured graph.
|
default T |
concat(Iterable<T> elements)
Implementation of concatenation for this type.
|
com.google.common.reflect.TypeToken<T> |
getOutputType() |
com.google.common.reflect.TypeToken<U> |
getUnconfiguredType() |
boolean |
hasElementClass(Class<?>... types)
Returns whether the leaf nodes of this type coercer outputs value that is an instance of the
given class or its subclasses.
|
default boolean |
supportsConcatenation() |
void |
traverse(CellNameResolver cellRoots,
T object,
TypeCoercer.Traversal traversal)
Traverse an object guided by this TypeCoercer.
|
default boolean |
unconfiguredToConfiguredCoercionIsIdentity()
coerce(CellNameResolver, ProjectFilesystem, ForwardRelativePath, TargetConfiguration,
TargetConfiguration, Object) must be no-op when this returns true . |
com.google.common.reflect.TypeToken<T> getOutputType()
com.google.common.reflect.TypeToken<U> getUnconfiguredType()
default boolean unconfiguredToConfiguredCoercionIsIdentity()
coerce(CellNameResolver, ProjectFilesystem, ForwardRelativePath, TargetConfiguration,
TargetConfiguration, Object)
must be no-op when this returns true
.boolean hasElementClass(Class<?>... types)
void traverse(CellNameResolver cellRoots, T object, TypeCoercer.Traversal traversal)
#{link Traversal#traverse} function will be called once for the object. If the object is a collection or map, it will also recursively traverse all elements of the map.
U coerceToUnconfigured(CellNameResolver cellRoots, ProjectFilesystem filesystem, ForwardRelativePath pathRelativeToProjectRoot, Object object) throws CoerceFailedException
CoerceFailedException
T coerce(CellNameResolver cellRoots, ProjectFilesystem filesystem, ForwardRelativePath pathRelativeToProjectRoot, TargetConfiguration targetConfiguration, TargetConfiguration hostConfiguration, U object) throws CoerceFailedException
CoerceFailedException
- Input object cannot be coerced into the given type.default T coerceBoth(CellNameResolver cellRoots, ProjectFilesystem filesystem, ForwardRelativePath pathRelativeToProjectRoot, TargetConfiguration targetConfiguration, TargetConfiguration hostConfiguration, Object object) throws CoerceFailedException
coerceToUnconfigured(CellNameResolver, ProjectFilesystem, ForwardRelativePath,
Object)
followed by coerce(CellNameResolver, ProjectFilesystem, ForwardRelativePath,
TargetConfiguration, TargetConfiguration, Object)
.CoerceFailedException
@Nullable default T concat(Iterable<T> elements)
null
indicates that concatenation
isn't supported by the type.concat
in interface Concatable<T>
null
if concatenation is not
supported for the typedefault boolean supportsConcatenation()
true
is this coercer supports concatenation.default <S> TypeCoercer<U,S> checkOutputAssignableTo(com.google.common.reflect.TypeToken<S> type)
default <S> TypeCoercer<S,T> checkUnconfiguredAssignableTo(com.google.common.reflect.TypeToken<S> type)