public interface IMapperRegistry
IMapper
implementations by tag.
Implementations of this interface can be found in the ILookup.lookup(Class)
of the default IGraph
implementations in the framework.
Using IMapperRegistry
is described in the section
Associating Data with Graph Elements.
MapperRegistry
Modifier and Type | Method and Description |
---|---|
<K,V> void |
addMapper(Class<K> keyType,
Class<V> valueType,
Object tag,
IMapper<K,V> mapper)
Registers a mapper for the given tag.
|
default <V> void |
addMapper(Class<V> valueType,
EdgeDpKey<V> tag,
IMapper<IEdge,V> mapper)
Adds a previously created mapper to this instance for the given tag.
|
default <V> void |
addMapper(Class<V> valueType,
ILabelLayoutDpKey<V> tag,
IMapper<ILabel,V> mapper)
Adds a previously created mapper to this instance for the given tag.
|
default <V> void |
addMapper(Class<V> valueType,
NodeDpKey<V> tag,
IMapper<INode,V> mapper)
Adds a previously created mapper to this instance for the given tag.
|
default <K,V> IMapper<K,V> |
createConstantMapper(Class<K> kType,
Class<V> vType,
Object tag,
V constant)
|
default <V> IMapper<IEdge,V> |
createConstantMapper(Class<V> valueType,
EdgeDpKey<V> tag,
V constant)
|
default <V> IMapper<ILabel,V> |
createConstantMapper(Class<V> valueType,
ILabelLayoutDpKey<V> tag,
V constant)
|
default <V> IMapper<INode,V> |
createConstantMapper(Class<V> valueType,
NodeDpKey<V> tag,
V constant)
|
default <K,V> IMapper<K,V> |
createDelegateMapper(Class<K> kType,
Class<V> vType,
Object tag,
Function<K,V> getter)
|
default <V> IMapper<IEdge,V> |
createDelegateMapper(Class<V> valueType,
EdgeDpKey<V> tag,
Function<IEdge,V> getter)
|
default <V> IMapper<ILabel,V> |
createDelegateMapper(Class<V> valueType,
ILabelLayoutDpKey<V> tag,
Function<ILabel,V> getter)
|
default <V> IMapper<INode,V> |
createDelegateMapper(Class<V> valueType,
NodeDpKey<V> tag,
Function<INode,V> getter)
|
default <K,V> Mapper<K,V> |
createMapper(Class<K> kType,
Class<V> vType,
Object tag)
|
default <V> Mapper<IEdge,V> |
createMapper(Class<V> valueType,
EdgeDpKey<V> tag)
|
default <V> Mapper<ILabel,V> |
createMapper(Class<V> valueType,
ILabelLayoutDpKey<V> tag)
|
default <V> Mapper<INode,V> |
createMapper(Class<V> valueType,
NodeDpKey<V> tag)
|
default <K,V> Mapper<K,V> |
createWeakMapper(Class<K> kType,
Class<V> vType,
Object tag)
|
default <V> Mapper<IEdge,V> |
createWeakMapper(Class<V> valueType,
EdgeDpKey<V> tag)
|
default <V> Mapper<ILabel,V> |
createWeakMapper(Class<V> valueType,
ILabelLayoutDpKey<V> tag)
|
default <V> Mapper<INode,V> |
createWeakMapper(Class<V> valueType,
NodeDpKey<V> tag)
|
<K,V> IMapper<K,V> |
getMapper(Class<K> keyType,
Class<V> valueType,
Object tag)
Returns a mapper that has previously been registered with this instance for the given tag.
|
default <V> IMapper<IEdge,V> |
getMapper(Class<V> valueType,
EdgeDpKey<V> tag)
Returns a mapper that has previously been registered with this instance for the given tag.
|
default <V> IMapper<ILabel,V> |
getMapper(Class<V> valueType,
ILabelLayoutDpKey<V> tag)
Returns a mapper that has previously been registered with this instance for the given tag.
|
default <V> IMapper<INode,V> |
getMapper(Class<V> valueType,
NodeDpKey<V> tag)
Returns a mapper that has previously been registered with this instance for the given tag.
|
MapperMetadata |
getMapperMetadata(Object tag)
Gets the mapper
meta data for the mapper that is registered using the tag . |
default IMapper<Object,Object> |
getObjectObjectMapper(Object tag)
Returns a mapper instance for which there has previously been registered an instance for the given tag, however using a
different type parameter set.
|
IEnumerable<Object> |
getRegisteredTags()
Gets an enumerable over all tags that have been used to register mapper implementations with this interface.
|
void |
removeMapper(Object tag)
Removes a previously registered mapper for the given tag.
|
void |
setMapperMetadata(Object tag,
MapperMetadata metadata)
Sets the mapper meta data for the mapper that has been
registered
using the provided tag . |
<K,V> void addMapper(Class<K> keyType, Class<V> valueType, Object tag, IMapper<K,V> mapper)
If there already was a mapper for tag
, it will be replaced.
K
- The key type for the mapper.V
- The value type for the mapper.valueType
- The value type for the mapper.keyType
- The key type for the mapper.tag
- The tag to use.mapper
- The mapper to register.default <V> void addMapper(Class<V> valueType, EdgeDpKey<V> tag, IMapper<IEdge,V> mapper)
The key type of the mapper is IEdge
while the value type of the mapper is inferred by the provided tag
.
V
- The value type for the mapper.tag
- The tag to use to look up the mapper.mapper
- The mapper instance to register.default <V> void addMapper(Class<V> valueType, ILabelLayoutDpKey<V> tag, IMapper<ILabel,V> mapper)
The key type of the mapper is ILabel
while the value type of the mapper is inferred by the provided
tag
.
V
- The value type for the mapper.tag
- The tag to use to look up the mapper.mapper
- The mapper instance to register.default <V> void addMapper(Class<V> valueType, NodeDpKey<V> tag, IMapper<INode,V> mapper)
The key type of the mapper is INode
while the value type of the mapper is inferred by the provided tag
.
V
- The value type for the mapper.tag
- The tag to use to look up the mapper.mapper
- The mapper instance to register.default <K,V> IMapper<K,V> createConstantMapper(Class<K> kType, Class<V> vType, Object tag, V constant)
IMapper
implementation and adds
it
to the registry
using the provided tag
.
If there already was a mapper for tag
, it will be replaced.
K
- The type of the keys of the mapper.V
- The type of the values of the mapper.tag
- The tag.constant
- The value to yield during IMapper
reads.IMapper.fromConstant(Object)
default <V> IMapper<IEdge,V> createConstantMapper(Class<V> valueType, EdgeDpKey<V> tag, V constant)
IMapper
implementation with key type IEdge
and adds
it to the registry
using the provided tag
.
The value type of the mapper is inferred by the provided tag
. If there already was a mapper for
tag
, it will be replaced.
V
- The type of the values of the mapper.tag
- The tag.constant
- The value to yield during IMapper
reads.IMapper.fromFunction(Function)
default <V> IMapper<ILabel,V> createConstantMapper(Class<V> valueType, ILabelLayoutDpKey<V> tag, V constant)
IMapper
implementation with key type ILabel
and adds
it to the registry
using the provided tag
.
The value type of the mapper is inferred by the provided tag
. If there already was a mapper for
tag
, it will be replaced.
V
- The type of the values of the mapper.tag
- The tag.constant
- The value to yield during IMapper
reads.IMapper.fromFunction(Function)
default <V> IMapper<INode,V> createConstantMapper(Class<V> valueType, NodeDpKey<V> tag, V constant)
IMapper
implementation with key type INode
and adds
it to the registry
using the provided tag
.
The value type of the mapper is inferred by the provided tag
. If there already was a mapper for
tag
, it will be replaced.
V
- The type of the values of the mapper.tag
- The tag.constant
- The value to yield during IMapper
reads.IMapper.fromFunction(Function)
default <K,V> IMapper<K,V> createDelegateMapper(Class<K> kType, Class<V> vType, Object tag, Function<K,V> getter)
IMapper
implementation and adds
it to the registry
using the provided tag
.
If there already was a mapper for tag
, it will be replaced.
K
- The type of the keys of the mapper.V
- The type of the values of the mapper.tag
- The tag.getter
- The getter delegate to which IMapper
reads will be delegated.IMapper.fromFunction(Function)
default <V> IMapper<IEdge,V> createDelegateMapper(Class<V> valueType, EdgeDpKey<V> tag, Function<IEdge,V> getter)
IMapper
implementation with key type IEdge
and adds
it to the registry
using the provided tag
.
The value type of the mapper is inferred by the provided tag
. If there already was a mapper for
tag
, it will be replaced.
V
- The type of the values of the mapper.tag
- The tag.getter
- The getter delegate to which IMapper
reads will be delegated.IMapper.fromFunction(Function)
default <V> IMapper<ILabel,V> createDelegateMapper(Class<V> valueType, ILabelLayoutDpKey<V> tag, Function<ILabel,V> getter)
IMapper
implementation with key type ILabel
and adds
it to the registry
using the provided tag
.
The value type of the mapper is inferred by the provided tag
. If there already was a mapper for
tag
, it will be replaced.
V
- The type of the values of the mapper.tag
- The tag.getter
- The getter delegate to which IMapper
reads will be delegated.IMapper.fromFunction(Function)
default <V> IMapper<INode,V> createDelegateMapper(Class<V> valueType, NodeDpKey<V> tag, Function<INode,V> getter)
IMapper
implementation with key type INode
and adds
it to the registry
using the provided tag
.
The value type of the mapper is inferred by the provided tag
. If there already was a mapper for
tag
, it will be replaced.
V
- The type of the values of the mapper.tag
- The tag.getter
- The getter delegate to which IMapper
reads will be delegated.IMapper.fromFunction(Function)
default <K,V> Mapper<K,V> createMapper(Class<K> kType, Class<V> vType, Object tag)
adds
a new Mapper
to the registry
using
the provided tag
.
If there already was a mapper for tag
, it will be replaced.
K
- The type of the keys of the mapper.V
- The type of the values of the mapper.tag
- The tag.Mapper
default <V> Mapper<IEdge,V> createMapper(Class<V> valueType, EdgeDpKey<V> tag)
adds
a new Mapper
with key type IEdge
to
the registry
using the provided tag
.
The value type of the mapper is inferred by the provided tag
. If there already was a mapper for
tag
, it will be replaced.
V
- The type of the values of the mapper.tag
- The tag.Mapper
default <V> Mapper<ILabel,V> createMapper(Class<V> valueType, ILabelLayoutDpKey<V> tag)
adds
a new Mapper
with key type ILabel
to
the registry
using the provided tag
.
The value type of the mapper is inferred by the provided tag
. If there already was a mapper for
tag
, it will be replaced.
V
- The type of the values of the mapper.tag
- The tag.Mapper
default <V> Mapper<INode,V> createMapper(Class<V> valueType, NodeDpKey<V> tag)
adds
a new Mapper
with key type INode
to
the registry
using the provided tag
.
The value type of the mapper is inferred by the provided tag
. If there already was a mapper for
tag
, it will be replaced.
V
- The type of the values of the mapper.tag
- The tag.Mapper
default <K,V> Mapper<K,V> createWeakMapper(Class<K> kType, Class<V> vType, Object tag)
adds
a new Mapper
to the registry
using
the provided tag
.
If there already was a mapper for tag
, it will be replaced.
K
- The type of the keys of the mapper.V
- The type of the values of the mapper.tag
- The tag.Mapper
default <V> Mapper<IEdge,V> createWeakMapper(Class<V> valueType, EdgeDpKey<V> tag)
adds
a new Mapper
with key type IEdge
to
the registry
using the provided tag
.
The value type of the mapper is inferred by the provided tag
. If there already was a mapper for
tag
, it will be replaced.
V
- The type of the values of the mapper.tag
- The tag.Mapper
default <V> Mapper<ILabel,V> createWeakMapper(Class<V> valueType, ILabelLayoutDpKey<V> tag)
adds
a new Mapper
with key type ILabel
to
the registry
using the provided tag
.
The value type of the mapper is inferred by the provided tag
. If there already was a mapper for
tag
, it will be replaced.
V
- The type of the values of the mapper.tag
- The tag.Mapper
default <V> Mapper<INode,V> createWeakMapper(Class<V> valueType, NodeDpKey<V> tag)
adds
a new Mapper
with key type INode
to
the registry
using the provided tag
.
The value type of the mapper is inferred by the provided tag
. If there already was a mapper for
tag
, it will be replaced.
V
- The type of the values of the mapper.tag
- The tag.Mapper
<K,V> IMapper<K,V> getMapper(Class<K> keyType, Class<V> valueType, Object tag)
K
- The key type for the mapper.V
- The value type for the mapper.valueType
- The value type for the mapper.keyType
- The key type for the mapper.tag
- The tag to use to look up the mapper.null
.default <V> IMapper<IEdge,V> getMapper(Class<V> valueType, EdgeDpKey<V> tag)
The key type of the mapper is IEdge
while the value type of the mapper is inferred by the provided tag
.
V
- The value type for the mapper.tag
- The tag to use to look up the mapper.null
.default <V> IMapper<ILabel,V> getMapper(Class<V> valueType, ILabelLayoutDpKey<V> tag)
The key type of the mapper is ILabel
while the value type of the mapper is inferred by the provided
tag
.
V
- The value type for the mapper.tag
- The tag to use to look up the mapper.null
.default <V> IMapper<INode,V> getMapper(Class<V> valueType, NodeDpKey<V> tag)
The key type of the mapper is INode
while the value type of the mapper is inferred by the provided tag
.
V
- The value type for the mapper.tag
- The tag to use to look up the mapper.null
.MapperMetadata getMapperMetadata(Object tag)
meta data
for the mapper that is registered using the tag
.tag
- The tag.null
if there is no such mapper registered for the given tag.default IMapper<Object,Object> getObjectObjectMapper(Object tag)
If the original mapper instance matches the type parameters, it will be returned, otherwise a dynamic wrapping implementation will be returned. This method can be used by generic code that does not know about the exact type parameters.
tag
- The tag to use to look up the mapper.null
if no mapper has been found for the provided tag.IEnumerable<Object> getRegisteredTags()
void removeMapper(Object tag)
tag
- The tag that has been used for registering the mapper.void setMapperMetadata(Object tag, MapperMetadata metadata)
registered
using the provided tag
.IllegalArgumentException
- If the KeyType
or ValueType
mismatch the
mapper instance in the registry.tag
- The tag.metadata
- The meta data to store with the mapper.