BindingGeneratorUtil { public static long computeDefaultSUID(final GeneratedTypeBuilderBase<?> to) { final ByteArrayOutputStream bout = new ByteArrayOutputStream(); try (DataOutputStream dout = new DataOutputStream(bout)) { dout.writeUTF(to.getName()); dout.writeInt(to.isAbstract() ? 3 : 7); for (final Type ifc : sortedCollection(SUID_NAME_COMPARATOR, filteredImplementsTypes(to))) { dout.writeUTF(ifc.getFullyQualifiedName()); } for (final GeneratedPropertyBuilder gp : sortedCollection(SUID_MEMBER_COMPARATOR, to.getProperties())) { dout.writeUTF(gp.getName()); } for (final MethodSignatureBuilder m : sortedCollection(SUID_MEMBER_COMPARATOR, to.getMethodDefinitions())) { if (!m.getAccessModifier().equals(AccessModifier.PRIVATE)) { dout.writeUTF(m.getName()); dout.write(m.getAccessModifier().ordinal()); } } dout.flush(); } catch (final IOException e) { throw new IllegalStateException("Failed to hash object " + to, e); } final byte[] hashBytes = SHA1_MD.get().digest(bout.toByteArray()); long hash = 0; for (int i = Math.min(hashBytes.length, 8) - 1; i >= 0; i--) { hash = hash << 8 | hashBytes[i] & 0xFF; } return hash; } private  BindingGeneratorUtil(); static String resolveJavaReservedWordEquivalency(final String parameterName); static String packageNameForGeneratedType(final String basePackageName, final SchemaPath schemaPath); static String packageNameForAugmentedGeneratedType(final String basePackageName,
            final SchemaPath schemaPath); static long computeDefaultSUID(final GeneratedTypeBuilderBase<?> to); static Restrictions getRestrictions(final TypeDefinition<?> type); static String encodeAngleBrackets(String description); static String replaceAllIllegalChars(final String str);  }
@Test public void computeDefaultSUIDTest() { CodegenGeneratedTypeBuilder generatedTypeBuilder = new CodegenGeneratedTypeBuilder( JavaTypeName.create("my.package", "MyName")); MethodSignatureBuilder method = generatedTypeBuilder.addMethod("myMethodName"); method.setAccessModifier(AccessModifier.PUBLIC); generatedTypeBuilder.addProperty("myProperty"); generatedTypeBuilder.addImplementsType(Types.typeForClass(Serializable.class)); assertEquals(6788238694991761868L, BindingGeneratorUtil.computeDefaultSUID(generatedTypeBuilder)); }