@Test public void supportsPackingMessageTypesOfLength7() { assertNotEquals(packMessageType("ABCDEFGH"), packMessageType("ABCDEFG")); }
public static long packMessageType(final String messageType) { if (messageType.length() > 8) { throw new IllegalArgumentException("Message types longer than 8 are not supported yet"); } long packed = 0; for (int index = 0; index < messageType.length(); index++) { final int asciiValue = (byte)messageType.charAt(index); packed |= asciiValue << (MESSAGE_TYPE_BITSHIFT * index); } return packed; }
GenerationUtil { public static long packMessageType(final String messageType) { if (messageType.length() > 8) { throw new IllegalArgumentException("Message types longer than 8 are not supported yet"); } long packed = 0; for (int index = 0; index < messageType.length(); index++) { final int asciiValue = (byte)messageType.charAt(index); packed |= asciiValue << (MESSAGE_TYPE_BITSHIFT * index); } return packed; } }
GenerationUtil { public static long packMessageType(final String messageType) { if (messageType.length() > 8) { throw new IllegalArgumentException("Message types longer than 8 are not supported yet"); } long packed = 0; for (int index = 0; index < messageType.length(); index++) { final int asciiValue = (byte)messageType.charAt(index); packed |= asciiValue << (MESSAGE_TYPE_BITSHIFT * index); } return packed; } private  GenerationUtil(); }
GenerationUtil { public static long packMessageType(final String messageType) { if (messageType.length() > 8) { throw new IllegalArgumentException("Message types longer than 8 are not supported yet"); } long packed = 0; for (int index = 0; index < messageType.length(); index++) { final int asciiValue = (byte)messageType.charAt(index); packed |= asciiValue << (MESSAGE_TYPE_BITSHIFT * index); } return packed; } private  GenerationUtil(); static String fileHeader(final String packageName); static long packMessageType(final String messageType); static String constantName(final String name); static String constructor(final String name, final Var... parameters); static String paramDeclaration(final Var[] parameters); static String importFor(final Class<?> cls); static String importFor(final String className); static String importStaticFor(final Class<?> cls); static String importStaticFor(final Class<?> cls, final String name); static String importStaticFor(final String cls, final String name); static String optionalStaticInit(final String containing); }
GenerationUtil { public static long packMessageType(final String messageType) { if (messageType.length() > 8) { throw new IllegalArgumentException("Message types longer than 8 are not supported yet"); } long packed = 0; for (int index = 0; index < messageType.length(); index++) { final int asciiValue = (byte)messageType.charAt(index); packed |= asciiValue << (MESSAGE_TYPE_BITSHIFT * index); } return packed; } private  GenerationUtil(); static String fileHeader(final String packageName); static long packMessageType(final String messageType); static String constantName(final String name); static String constructor(final String name, final Var... parameters); static String paramDeclaration(final Var[] parameters); static String importFor(final Class<?> cls); static String importFor(final String className); static String importStaticFor(final Class<?> cls); static String importStaticFor(final Class<?> cls, final String name); static String importStaticFor(final String cls, final String name); static String optionalStaticInit(final String containing); static final String INDENT; }