Package it.unimi.di.big.mg4j.document
Class DispatchingDocumentFactory.StringBasedDispatchingStrategy
- java.lang.Object
-
- it.unimi.di.big.mg4j.document.DispatchingDocumentFactory.StringBasedDispatchingStrategy
-
- All Implemented Interfaces:
DispatchingDocumentFactory.DispatchingStrategy,Serializable
- Enclosing class:
- DispatchingDocumentFactory
public static class DispatchingDocumentFactory.StringBasedDispatchingStrategy extends Object implements DispatchingDocumentFactory.DispatchingStrategy
A strategy that is based on trying to match the value of the metadata with a given key with respect to a certain set of values.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description StringBasedDispatchingStrategy(Enum<?> key, Object2IntMap<String> value)The strategy works as follows: the property namedkeyis resolved; if this property is not set, the default return value of value is returned.
-
Method Summary
Modifier and Type Method Description intfactoryNumber(Reference2ObjectMap<Enum<?>,Object> metadata, PropertyBasedDocumentFactory factory)Decides the index of the factory to be used for the given metadata, possibly using a factory to resolve property names.
-
-
-
Constructor Detail
-
StringBasedDispatchingStrategy
public StringBasedDispatchingStrategy(Enum<?> key, Object2IntMap<String> value)
The strategy works as follows: the property namedkeyis resolved; if this property is not set, the default return value of value is returned. Otherwise, its value is compared, using theequals, method with the elements of thevalueset, and the corresponding integer is returned.- Parameters:
key- the key to be resolved.value- the map of values.
-
-
Method Detail
-
factoryNumber
public int factoryNumber(Reference2ObjectMap<Enum<?>,Object> metadata, PropertyBasedDocumentFactory factory)
Description copied from interface:DispatchingDocumentFactory.DispatchingStrategyDecides the index of the factory to be used for the given metadata, possibly using a factory to resolve property names.- Specified by:
factoryNumberin interfaceDispatchingDocumentFactory.DispatchingStrategy- Parameters:
metadata- the metadata of the document to be produced.factory- the factory used to resolve metadata names.- Returns:
- the factory index.
-
-