public class OptionalTypeCoercer<U,T> extends Object implements TypeCoercer<Optional<U>,Optional<T>>
Optional
.TypeCoercer.Traversal
Constructor and Description |
---|
OptionalTypeCoercer(TypeCoercer<U,T> coercer) |
Modifier and Type | Method and Description |
---|---|
Optional<T> |
coerce(CellNameResolver cellRoots,
ProjectFilesystem filesystem,
ForwardRelativePath pathRelativeToProjectRoot,
TargetConfiguration targetConfiguration,
TargetConfiguration hostConfiguration,
Optional<U> object) |
Optional<U> |
coerceToUnconfigured(CellNameResolver cellRoots,
ProjectFilesystem filesystem,
ForwardRelativePath pathRelativeToProjectRoot,
Object object)
Coerce to a value for unconfigured graph.
|
Optional<T> |
concat(Iterable<Optional<T>> elements)
Implementation of concatenation for this type.
|
com.google.common.reflect.TypeToken<Optional<T>> |
getOutputType() |
com.google.common.reflect.TypeToken<Optional<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.
|
void |
traverse(CellNameResolver cellRoots,
Optional<T> object,
TypeCoercer.Traversal traversal)
Traverse an object guided by this TypeCoercer.
|
boolean |
unconfiguredToConfiguredCoercionIsIdentity()
TypeCoercer.coerce(CellNameResolver, ProjectFilesystem, ForwardRelativePath, TargetConfiguration,
TargetConfiguration, Object) must be no-op when this returns true . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkOutputAssignableTo, checkUnconfiguredAssignableTo, coerceBoth, supportsConcatenation
public OptionalTypeCoercer(TypeCoercer<U,T> coercer)
public com.google.common.reflect.TypeToken<Optional<T>> getOutputType()
getOutputType
in interface TypeCoercer<Optional<U>,Optional<T>>
public com.google.common.reflect.TypeToken<Optional<U>> getUnconfiguredType()
getUnconfiguredType
in interface TypeCoercer<Optional<U>,Optional<T>>
public boolean hasElementClass(Class<?>... types)
TypeCoercer
hasElementClass
in interface TypeCoercer<Optional<U>,Optional<T>>
public void traverse(CellNameResolver cellRoots, Optional<T> object, TypeCoercer.Traversal traversal)
TypeCoercer
#{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.
public boolean unconfiguredToConfiguredCoercionIsIdentity()
TypeCoercer
TypeCoercer.coerce(CellNameResolver, ProjectFilesystem, ForwardRelativePath, TargetConfiguration,
TargetConfiguration, Object)
must be no-op when this returns true
.unconfiguredToConfiguredCoercionIsIdentity
in interface TypeCoercer<Optional<U>,Optional<T>>
public Optional<U> coerceToUnconfigured(CellNameResolver cellRoots, ProjectFilesystem filesystem, ForwardRelativePath pathRelativeToProjectRoot, Object object) throws CoerceFailedException
TypeCoercer
coerceToUnconfigured
in interface TypeCoercer<Optional<U>,Optional<T>>
CoerceFailedException
public Optional<T> coerce(CellNameResolver cellRoots, ProjectFilesystem filesystem, ForwardRelativePath pathRelativeToProjectRoot, TargetConfiguration targetConfiguration, TargetConfiguration hostConfiguration, Optional<U> object) throws CoerceFailedException
coerce
in interface TypeCoercer<Optional<U>,Optional<T>>
CoerceFailedException
- Input object cannot be coerced into the given type.@Nullable public Optional<T> concat(Iterable<Optional<T>> elements)
TypeCoercer
null
indicates that concatenation
isn't supported by the type.concat
in interface Concatable<Optional<T>>
concat
in interface TypeCoercer<Optional<U>,Optional<T>>
null
if concatenation is not
supported for the type