Package com.bazaarvoice.jolt.common
Enum ExecutionStrategy
- All Implemented Interfaces:
Serializable
,Comparable<ExecutionStrategy>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThis is identical to AVAILABLE_LITERALS, except for the fact that it does not skip keys if its missing in the input, like literal does Given this works like defaultr, a missing key is our point of entry to insert a default value, either from a passed context or a hardcoded value.The performance assumption built into this code is that the literal values in the spec, are generally smaller than the number of potential keys to check in the input.We have both literal and computed children, but we have determined that there is no way an input key could match one of our literal and computed children.If the CompositeSpec only has computed children, we can avoid checking the getLiteralChildren() altogether, and we can do a slightly better iteration (HashSet.entrySet) across the input.In order to implement the key precedence order, we have to process each input "key", first to see if it matches any literals, and if it does not, check against each of the computed -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static <T extends BaseSpec>
voidapplyKeyToComputed
(List<T> computedChildren, WalkedPath walkedPath, Map<String, Object> output, String subKeyStr, Optional<Object> subInputOptional, Map<String, Object> context) private static <T extends OrderedCompositeSpec>
voidapplyKeyToLiteralAndComputed
(T spec, String subKeyStr, Optional<Object> subInputOptional, WalkedPath walkedPath, Map<String, Object> output, Map<String, Object> context) This is the method we are trying to avoid calling.void
process
(OrderedCompositeSpec spec, Optional<Object> inputOptional, WalkedPath walkedPath, Map<String, Object> output, Map<String, Object> context) (package private) abstract void
processList
(OrderedCompositeSpec spec, List<Object> inputList, WalkedPath walkedPath, Map<String, Object> output, Map<String, Object> context) (package private) abstract void
processMap
(OrderedCompositeSpec spec, Map<String, Object> inputMap, WalkedPath walkedPath, Map<String, Object> output, Map<String, Object> context) (package private) abstract void
processScalar
(OrderedCompositeSpec spec, String scalarInput, WalkedPath walkedPath, Map<String, Object> output, Map<String, Object> context) static ExecutionStrategy
Returns the enum constant of this type with the specified name.static ExecutionStrategy[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
AVAILABLE_LITERALS
The performance assumption built into this code is that the literal values in the spec, are generally smaller than the number of potential keys to check in the input. More specifically, the assumption here is that the set of literalChildren is smaller than the input "keyset". -
ALL_LITERALS
This is identical to AVAILABLE_LITERALS, except for the fact that it does not skip keys if its missing in the input, like literal does Given this works like defaultr, a missing key is our point of entry to insert a default value, either from a passed context or a hardcoded value. -
COMPUTED
If the CompositeSpec only has computed children, we can avoid checking the getLiteralChildren() altogether, and we can do a slightly better iteration (HashSet.entrySet) across the input. -
CONFLICT
In order to implement the key precedence order, we have to process each input "key", first to see if it matches any literals, and if it does not, check against each of the computed -
AVAILABLE_LITERALS_WITH_COMPUTED
We have both literal and computed children, but we have determined that there is no way an input key could match one of our literal and computed children. Hence we can safely run each one. -
ALL_LITERALS_WITH_COMPUTED
-
-
Constructor Details
-
ExecutionStrategy
private ExecutionStrategy()
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
process
public void process(OrderedCompositeSpec spec, Optional<Object> inputOptional, WalkedPath walkedPath, Map<String, Object> output, Map<String, Object> context) -
processMap
-
processList
abstract void processList(OrderedCompositeSpec spec, List<Object> inputList, WalkedPath walkedPath, Map<String, Object> output, Map<String, Object> context) -
processScalar
abstract void processScalar(OrderedCompositeSpec spec, String scalarInput, WalkedPath walkedPath, Map<String, Object> output, Map<String, Object> context) -
applyKeyToLiteralAndComputed
private static <T extends OrderedCompositeSpec> void applyKeyToLiteralAndComputed(T spec, String subKeyStr, Optional<Object> subInputOptional, WalkedPath walkedPath, Map<String, Object> output, Map<String, Object> context) This is the method we are trying to avoid calling. It implements the matching behavior when we have both literal and computed children. For each input key, we see if it matches a literal, and it not, try to match the key with every computed child. Worse case : n + n * c, where n is number of input keys c is number of computed children -
applyKeyToComputed
-