@Test public void testConvertRdef01Strategy() { FromCobolChoiceStrategy customChoiceStrategy = new FromCobolChoiceStrategy() { public CobolType choose(String choiceFieldName, CobolChoiceType choiceType, Map < String, Object > variables, byte[] hostData, int start, int length) { int select = ((Number) variables.get("comSelect")) .intValue(); switch (select) { case 0: return choiceType.getAlternatives().get( "ComDetail1"); case 1: return choiceType.getAlternatives().get( "ComDetail2"); default: return null; } } public Set < String > getVariableNames() { Set < String > variables = new HashSet < String >(); variables.add("comSelect"); return variables; } }; Cob2HashMapConverter converter = new Cob2HashMapConverter.Builder() .cobolComplexType(new com.legstar.base.type.gen.CobolRdef01Record()) .customChoiceStrategy(customChoiceStrategy) .build(); FromHostResult < Map <String, Object> > result = converter.convert( HexUtils.decodeHex("00010250000F40404040404000010260000F404040404040")); assertEquals(6, result.getBytesProcessed()); assertEquals("{comSelect=1, comDetail1Choice={comDetail2={comAmount=2500.00}}}", result.getValue().toString()); }
@SuppressWarnings("unchecked") public FromHostResult < Map < String, Object > > convert(byte[] hostData, int start, int length) { Cob2ObjectVisitor visitor = new Cob2ObjectVisitor(getCobolContext(), hostData, start, length, getCustomChoiceStrategy(), getCustomVariables()); visitor.visit(getCobolComplexType()); return new FromHostResult < Map < String, Object > >( visitor.getLastPos(), (Map < String, Object >) visitor.getResultObject()); }
Cob2HashMapConverter extends
        AbstractCob2ObjectConverter < Map < String, Object >> { @SuppressWarnings("unchecked") public FromHostResult < Map < String, Object > > convert(byte[] hostData, int start, int length) { Cob2ObjectVisitor visitor = new Cob2ObjectVisitor(getCobolContext(), hostData, start, length, getCustomChoiceStrategy(), getCustomVariables()); visitor.visit(getCobolComplexType()); return new FromHostResult < Map < String, Object > >( visitor.getLastPos(), (Map < String, Object >) visitor.getResultObject()); } }
Cob2HashMapConverter extends
        AbstractCob2ObjectConverter < Map < String, Object >> { @SuppressWarnings("unchecked") public FromHostResult < Map < String, Object > > convert(byte[] hostData, int start, int length) { Cob2ObjectVisitor visitor = new Cob2ObjectVisitor(getCobolContext(), hostData, start, length, getCustomChoiceStrategy(), getCustomVariables()); visitor.visit(getCobolComplexType()); return new FromHostResult < Map < String, Object > >( visitor.getLastPos(), (Map < String, Object >) visitor.getResultObject()); } private  Cob2HashMapConverter(Builder builder); }
Cob2HashMapConverter extends
        AbstractCob2ObjectConverter < Map < String, Object >> { @SuppressWarnings("unchecked") public FromHostResult < Map < String, Object > > convert(byte[] hostData, int start, int length) { Cob2ObjectVisitor visitor = new Cob2ObjectVisitor(getCobolContext(), hostData, start, length, getCustomChoiceStrategy(), getCustomVariables()); visitor.visit(getCobolComplexType()); return new FromHostResult < Map < String, Object > >( visitor.getLastPos(), (Map < String, Object >) visitor.getResultObject()); } private  Cob2HashMapConverter(Builder builder); @SuppressWarnings("unchecked") FromHostResult < Map < String, Object > > convert(byte[] hostData,
            int start, int length); }
Cob2HashMapConverter extends
        AbstractCob2ObjectConverter < Map < String, Object >> { @SuppressWarnings("unchecked") public FromHostResult < Map < String, Object > > convert(byte[] hostData, int start, int length) { Cob2ObjectVisitor visitor = new Cob2ObjectVisitor(getCobolContext(), hostData, start, length, getCustomChoiceStrategy(), getCustomVariables()); visitor.visit(getCobolComplexType()); return new FromHostResult < Map < String, Object > >( visitor.getLastPos(), (Map < String, Object >) visitor.getResultObject()); } private  Cob2HashMapConverter(Builder builder); @SuppressWarnings("unchecked") FromHostResult < Map < String, Object > > convert(byte[] hostData,
            int start, int length);  }