public class MapTypeCoercer<KU,VU,K,V> extends Object implements TypeCoercer<com.google.common.collect.ImmutableMap<KU,VU>,com.google.common.collect.ImmutableMap<K,V>>
ImmutableMap
.TypeCoercer.Traversal
Constructor and Description |
---|
MapTypeCoercer(TypeCoercer<KU,K> keyTypeCoercer,
TypeCoercer<VU,V> valueTypeCoercer) |
Modifier and Type | Method and Description |
---|---|
com.google.common.collect.ImmutableMap<K,V> |
coerce(CellNameResolver cellRoots,
ProjectFilesystem filesystem,
ForwardRelativePath pathRelativeToProjectRoot,
TargetConfiguration targetConfiguration,
TargetConfiguration hostConfiguration,
com.google.common.collect.ImmutableMap<KU,VU> object) |
com.google.common.collect.ImmutableMap<KU,VU> |
coerceToUnconfigured(CellNameResolver cellRoots,
ProjectFilesystem filesystem,
ForwardRelativePath pathRelativeToProjectRoot,
Object object)
Coerce to a value for unconfigured graph.
|
com.google.common.collect.ImmutableMap<K,V> |
concat(Iterable<com.google.common.collect.ImmutableMap<K,V>> elements)
Implementation of concatenation for this type.
|
com.google.common.reflect.TypeToken<com.google.common.collect.ImmutableMap<K,V>> |
getOutputType() |
com.google.common.reflect.TypeToken<com.google.common.collect.ImmutableMap<KU,VU>> |
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,
com.google.common.collect.ImmutableMap<K,V> 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 MapTypeCoercer(TypeCoercer<KU,K> keyTypeCoercer, TypeCoercer<VU,V> valueTypeCoercer)
public com.google.common.reflect.TypeToken<com.google.common.collect.ImmutableMap<K,V>> getOutputType()
getOutputType
in interface TypeCoercer<com.google.common.collect.ImmutableMap<KU,VU>,com.google.common.collect.ImmutableMap<K,V>>
public com.google.common.reflect.TypeToken<com.google.common.collect.ImmutableMap<KU,VU>> getUnconfiguredType()
getUnconfiguredType
in interface TypeCoercer<com.google.common.collect.ImmutableMap<KU,VU>,com.google.common.collect.ImmutableMap<K,V>>
public boolean hasElementClass(Class<?>... types)
TypeCoercer
hasElementClass
in interface TypeCoercer<com.google.common.collect.ImmutableMap<KU,VU>,com.google.common.collect.ImmutableMap<K,V>>
public void traverse(CellNameResolver cellRoots, com.google.common.collect.ImmutableMap<K,V> 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 com.google.common.collect.ImmutableMap<KU,VU> coerceToUnconfigured(CellNameResolver cellRoots, ProjectFilesystem filesystem, ForwardRelativePath pathRelativeToProjectRoot, Object object) throws CoerceFailedException
TypeCoercer
coerceToUnconfigured
in interface TypeCoercer<com.google.common.collect.ImmutableMap<KU,VU>,com.google.common.collect.ImmutableMap<K,V>>
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<com.google.common.collect.ImmutableMap<KU,VU>,com.google.common.collect.ImmutableMap<K,V>>
public com.google.common.collect.ImmutableMap<K,V> coerce(CellNameResolver cellRoots, ProjectFilesystem filesystem, ForwardRelativePath pathRelativeToProjectRoot, TargetConfiguration targetConfiguration, TargetConfiguration hostConfiguration, com.google.common.collect.ImmutableMap<KU,VU> object) throws CoerceFailedException
coerce
in interface TypeCoercer<com.google.common.collect.ImmutableMap<KU,VU>,com.google.common.collect.ImmutableMap<K,V>>
CoerceFailedException
- Input object cannot be coerced into the given type.@Nullable public com.google.common.collect.ImmutableMap<K,V> concat(Iterable<com.google.common.collect.ImmutableMap<K,V>> elements)
TypeCoercer
null
indicates that concatenation
isn't supported by the type.concat
in interface Concatable<com.google.common.collect.ImmutableMap<K,V>>
concat
in interface TypeCoercer<com.google.common.collect.ImmutableMap<KU,VU>,com.google.common.collect.ImmutableMap<K,V>>
null
if concatenation is not
supported for the type