@Test public void testIsValidTrueCases() { assertTrue(isValid(1, "00")); assertTrue(isValid(1, "40")); assertTrue(isValid(1, "FF")); assertTrue(isValid(2, "4000")); assertTrue(isValid(2, "4040")); assertTrue(isValid(2, "40FF")); }
public boolean isValid(Class < T > javaClass, CobolContext cobolContext, byte[] hostData, int start) { int hostBytesLen = getBytesLen(charNum); if (hostData.length < start + hostBytesLen) { return false; } if (javaClass.equals(String.class)) { return isValidString(cobolContext, hostData, start); } else if (javaClass.equals(ByteBuffer.class)) { return true; } else { throw new IllegalArgumentException("Unsupported java type " + javaClass); } }
CobolStringType extends CobolPrimitiveType < T > { public boolean isValid(Class < T > javaClass, CobolContext cobolContext, byte[] hostData, int start) { int hostBytesLen = getBytesLen(charNum); if (hostData.length < start + hostBytesLen) { return false; } if (javaClass.equals(String.class)) { return isValidString(cobolContext, hostData, start); } else if (javaClass.equals(ByteBuffer.class)) { return true; } else { throw new IllegalArgumentException("Unsupported java type " + javaClass); } } }
CobolStringType extends CobolPrimitiveType < T > { public boolean isValid(Class < T > javaClass, CobolContext cobolContext, byte[] hostData, int start) { int hostBytesLen = getBytesLen(charNum); if (hostData.length < start + hostBytesLen) { return false; } if (javaClass.equals(String.class)) { return isValidString(cobolContext, hostData, start); } else if (javaClass.equals(ByteBuffer.class)) { return true; } else { throw new IllegalArgumentException("Unsupported java type " + javaClass); } } private  CobolStringType(Builder < T > builder); }
CobolStringType extends CobolPrimitiveType < T > { public boolean isValid(Class < T > javaClass, CobolContext cobolContext, byte[] hostData, int start) { int hostBytesLen = getBytesLen(charNum); if (hostData.length < start + hostBytesLen) { return false; } if (javaClass.equals(String.class)) { return isValidString(cobolContext, hostData, start); } else if (javaClass.equals(ByteBuffer.class)) { return true; } else { throw new IllegalArgumentException("Unsupported java type " + javaClass); } } private  CobolStringType(Builder < T > builder); boolean isValid(Class < T > javaClass, CobolContext cobolContext,
            byte[] hostData, int start); FromHostPrimitiveResult < T > fromHost(Class < T > javaClass,
            CobolContext cobolContext, byte[] hostData, int start); int getBytesLen(); static int getBytesLen(int charNum); }
CobolStringType extends CobolPrimitiveType < T > { public boolean isValid(Class < T > javaClass, CobolContext cobolContext, byte[] hostData, int start) { int hostBytesLen = getBytesLen(charNum); if (hostData.length < start + hostBytesLen) { return false; } if (javaClass.equals(String.class)) { return isValidString(cobolContext, hostData, start); } else if (javaClass.equals(ByteBuffer.class)) { return true; } else { throw new IllegalArgumentException("Unsupported java type " + javaClass); } } private  CobolStringType(Builder < T > builder); boolean isValid(Class < T > javaClass, CobolContext cobolContext,
            byte[] hostData, int start); FromHostPrimitiveResult < T > fromHost(Class < T > javaClass,
            CobolContext cobolContext, byte[] hostData, int start); int getBytesLen(); static int getBytesLen(int charNum);  }