@Test public void uuidObjectNameSupplier() { final Function<Map<String, String>, String> s = new UUIDObjectNameFunction(false); final Map<String, String> context = Maps.newHashMap(); assertThat(s.apply(context), is(not(s.apply(context)))); }
@Override public String apply(final Map<String, String> context) { if (!this.octalNamingMode) { final String objectName = UUID.randomUUID().toString().replace("-", "") + "0000"; context.put(Context.X_OG_OBJECT_NAME, objectName); return objectName; } else { UUID uuid = UUID.randomUUID(); long msl = uuid.getMostSignificantBits(); long lsl = uuid.getLeastSignificantBits(); msl = msl & 0x7777777777777777L; lsl = lsl & 0x7777777777777777L; UUID uuid2 = new UUID(msl, lsl); final String objectName = uuid2.toString().replace("-", "") + "0000"; context.put(Context.X_OG_OBJECT_NAME, objectName); return objectName; } }
UUIDObjectNameFunction implements Function<Map<String, String>, String> { @Override public String apply(final Map<String, String> context) { if (!this.octalNamingMode) { final String objectName = UUID.randomUUID().toString().replace("-", "") + "0000"; context.put(Context.X_OG_OBJECT_NAME, objectName); return objectName; } else { UUID uuid = UUID.randomUUID(); long msl = uuid.getMostSignificantBits(); long lsl = uuid.getLeastSignificantBits(); msl = msl & 0x7777777777777777L; lsl = lsl & 0x7777777777777777L; UUID uuid2 = new UUID(msl, lsl); final String objectName = uuid2.toString().replace("-", "") + "0000"; context.put(Context.X_OG_OBJECT_NAME, objectName); return objectName; } } }
UUIDObjectNameFunction implements Function<Map<String, String>, String> { @Override public String apply(final Map<String, String> context) { if (!this.octalNamingMode) { final String objectName = UUID.randomUUID().toString().replace("-", "") + "0000"; context.put(Context.X_OG_OBJECT_NAME, objectName); return objectName; } else { UUID uuid = UUID.randomUUID(); long msl = uuid.getMostSignificantBits(); long lsl = uuid.getLeastSignificantBits(); msl = msl & 0x7777777777777777L; lsl = lsl & 0x7777777777777777L; UUID uuid2 = new UUID(msl, lsl); final String objectName = uuid2.toString().replace("-", "") + "0000"; context.put(Context.X_OG_OBJECT_NAME, objectName); return objectName; } } UUIDObjectNameFunction(boolean octalNamingMode); }
UUIDObjectNameFunction implements Function<Map<String, String>, String> { @Override public String apply(final Map<String, String> context) { if (!this.octalNamingMode) { final String objectName = UUID.randomUUID().toString().replace("-", "") + "0000"; context.put(Context.X_OG_OBJECT_NAME, objectName); return objectName; } else { UUID uuid = UUID.randomUUID(); long msl = uuid.getMostSignificantBits(); long lsl = uuid.getLeastSignificantBits(); msl = msl & 0x7777777777777777L; lsl = lsl & 0x7777777777777777L; UUID uuid2 = new UUID(msl, lsl); final String objectName = uuid2.toString().replace("-", "") + "0000"; context.put(Context.X_OG_OBJECT_NAME, objectName); return objectName; } } UUIDObjectNameFunction(boolean octalNamingMode); @Override String apply(final Map<String, String> context); @Override String toString(); }
UUIDObjectNameFunction implements Function<Map<String, String>, String> { @Override public String apply(final Map<String, String> context) { if (!this.octalNamingMode) { final String objectName = UUID.randomUUID().toString().replace("-", "") + "0000"; context.put(Context.X_OG_OBJECT_NAME, objectName); return objectName; } else { UUID uuid = UUID.randomUUID(); long msl = uuid.getMostSignificantBits(); long lsl = uuid.getLeastSignificantBits(); msl = msl & 0x7777777777777777L; lsl = lsl & 0x7777777777777777L; UUID uuid2 = new UUID(msl, lsl); final String objectName = uuid2.toString().replace("-", "") + "0000"; context.put(Context.X_OG_OBJECT_NAME, objectName); return objectName; } } UUIDObjectNameFunction(boolean octalNamingMode); @Override String apply(final Map<String, String> context); @Override String toString();  }