* @param index the index of the chainrEntryObj, used in reporting errors
*/
public ChainrEntry( int index, Object chainrEntryObj ) {
if ( ! (chainrEntryObj instanceof Map ) ) {
throw new SpecException( "JOLT ChainrEntry expects a JSON map - Malformed spec" + getErrorMessageIndexSuffix() );
}
@SuppressWarnings( "unchecked" ) // We know it is a Map due to the check above
Map<String,Object> chainrEntryMap = (Map<String, Object>) chainrEntryObj;
this.index = index;
String opString = extractOperationString( ChainrEntry.OPERATION_KEY, chainrEntryMap );
if ( opString == null ) {
throw new SpecException( "JOLT Chainr 'operation' must implement Transform or ContextualTransform" + getErrorMessageIndexSuffix() );
}
if ( STOCK_TRANSFORMS.containsKey( opString ) ) {
operationClassName = STOCK_TRANSFORMS.get( opString );
}
else {
operationClassName = opString;
}
joltTransformClass = loadJoltTransformClass();
spec = chainrEntryMap.get( ChainrEntry.SPEC_KEY );
isSpecDriven = SpecDriven.class.isAssignableFrom( joltTransformClass );
if ( isSpecDriven && ! chainrEntryMap.containsKey( SPEC_KEY ) ) {
throw new SpecException( "JOLT Chainr - Transform className:" + joltTransformClass.getCanonicalName() + " requires a spec" + getErrorMessageIndexSuffix() );
}
}