public class EitherTypeCoercer<LU,RU,Left,Right> extends Object implements TypeCoercer<Either<LU,RU>,Either<Left,Right>>
TypeCoercer.Traversal
Constructor and Description |
---|
EitherTypeCoercer(TypeCoercer<LU,Left> leftTypeCoercer,
TypeCoercer<RU,Right> rightTypeCoercer) |
Modifier and Type | Method and Description |
---|---|
Either<Left,Right> |
coerce(CellNameResolver cellRoots,
ProjectFilesystem filesystem,
ForwardRelativePath pathRelativeToProjectRoot,
TargetConfiguration targetConfiguration,
TargetConfiguration hostConfiguration,
Either<LU,RU> object) |
Either<LU,RU> |
coerceToUnconfigured(CellNameResolver cellRoots,
ProjectFilesystem filesystem,
ForwardRelativePath pathRelativeToProjectRoot,
Object object)
Coerce to a value for unconfigured graph.
|
com.google.common.reflect.TypeToken<Either<Left,Right>> |
getOutputType() |
com.google.common.reflect.TypeToken<Either<LU,RU>> |
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,
Either<Left,Right> 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, concat, supportsConcatenation
public EitherTypeCoercer(TypeCoercer<LU,Left> leftTypeCoercer, TypeCoercer<RU,Right> rightTypeCoercer)
public com.google.common.reflect.TypeToken<Either<Left,Right>> getOutputType()
getOutputType
in interface TypeCoercer<Either<LU,RU>,Either<Left,Right>>
public com.google.common.reflect.TypeToken<Either<LU,RU>> getUnconfiguredType()
getUnconfiguredType
in interface TypeCoercer<Either<LU,RU>,Either<Left,Right>>
public boolean hasElementClass(Class<?>... types)
TypeCoercer
hasElementClass
in interface TypeCoercer<Either<LU,RU>,Either<Left,Right>>
public void traverse(CellNameResolver cellRoots, Either<Left,Right> 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 Either<LU,RU> coerceToUnconfigured(CellNameResolver cellRoots, ProjectFilesystem filesystem, ForwardRelativePath pathRelativeToProjectRoot, Object object) throws CoerceFailedException
TypeCoercer
coerceToUnconfigured
in interface TypeCoercer<Either<LU,RU>,Either<Left,Right>>
CoerceFailedException
public boolean unconfiguredToConfiguredCoercionIsIdentity()
TypeCoercer
TypeCoercer.coerce(CellNameResolver, ProjectFilesystem, ForwardRelativePath, TargetConfiguration,
TargetConfiguration, Object)
must be no-op when this returns true
.unconfiguredToConfiguredCoercionIsIdentity
in interface TypeCoercer<Either<LU,RU>,Either<Left,Right>>
public Either<Left,Right> coerce(CellNameResolver cellRoots, ProjectFilesystem filesystem, ForwardRelativePath pathRelativeToProjectRoot, TargetConfiguration targetConfiguration, TargetConfiguration hostConfiguration, Either<LU,RU> object) throws CoerceFailedException
coerce
in interface TypeCoercer<Either<LU,RU>,Either<Left,Right>>
CoerceFailedException
- Input object cannot be coerced into the given type.