List of usage examples for java.util UUID randomUUID
public static UUID randomUUID()
From source file:ai.grakn.graql.VarName.java
public static VarName anon() { return new VarName(UUID.randomUUID().toString()); }
From source file:com.pros.jsontransform.expression.FunctionRandomUUID.java
public static JsonNode evaluate(final JsonNode argsNode, final JsonNode valueNode, final ObjectTransformer transformer) throws ObjectTransformerException { ObjectNode resultNode = (ObjectNode) argsNode; resultNode.put("returnValue", UUID.randomUUID().toString()); return resultNode.get("returnValue"); }
From source file:Main.java
public synchronized static String getUniqueId(Context context) { if (uniqueID == null) { SharedPreferences sharedPrefs = context.getSharedPreferences(PREF_UNIQUE_ID, Context.MODE_PRIVATE); uniqueID = sharedPrefs.getString(PREF_UNIQUE_ID, null); if (uniqueID == null) { uniqueID = UUID.randomUUID().toString(); Editor editor = sharedPrefs.edit(); editor.putString(PREF_UNIQUE_ID, uniqueID); editor.commit();/*from ww w .j av a2 s. com*/ } } return uniqueID; }
From source file:Main.java
private static String generateKeevaId(Context context) { SharedPreferences sharedPrefs = context.getSharedPreferences("store.kv.db", Context.MODE_PRIVATE); String generatedId = sharedPrefs.getString(DB_KEY_SOOMLA_GENERATED_ID, null); if (TextUtils.isEmpty(generatedId)) { generatedId = UUID.randomUUID().toString(); sharedPrefs.edit().putString(DB_KEY_SOOMLA_GENERATED_ID, generatedId).commit(); }//from w ww. j av a2s . c o m return generatedId; }
From source file:com.vmware.demo.sgf.lucene.LuceneIndexBuilder.java
/** * Create the index directory also remove the write.lock file if it exists. * /*from w w w .jav a 2 s.c om*/ * @throws IOException */ private static String createIndexDirectory(final String indexDirectory) throws IOException { String dirPath = indexDirectory + "-" + UUID.randomUUID(); FileUtils.forceMkdir(new File(dirPath)); FileUtils.deleteQuietly(new File(dirPath + "/write.lock")); return dirPath; }
From source file:org.mule.modules.cmis.automation.functional.TestDataBuilder.java
public static InputStream generateRandomInputStream() throws Exception { return IOUtils.toInputStream(UUID.randomUUID().toString()); }
From source file:com.twosigma.beakerx.kernel.GroupName.java
public static GroupName generate() { return new GroupName(UUID.randomUUID().toString()); }
From source file:com.amazonaws.services.kinesis.producer.KinesisProducerConfigurationTest.java
private static String writeFile(String contents) { try {// w w w. j a v a 2 s . c om File f = File.createTempFile(UUID.randomUUID().toString(), ""); f.deleteOnExit(); FileUtils.write(f, contents); return f.getAbsolutePath(); } catch (Exception e) { throw new RuntimeException(e); } }
From source file:com.pinterest.deployservice.common.CommonUtils.java
/** * TODO figure out how to use guava to achive this * * @return base64 encoded shorten UUID, e.g. 11YozyYYTvKmuUXpRDvoJA *///from w w w .j av a 2s. c om public static String getBase64UUID() { UUID uuid = UUID.randomUUID(); ByteBuffer buffer = ByteBuffer.wrap(new byte[16]); buffer.putLong(uuid.getMostSignificantBits()); buffer.putLong(uuid.getLeastSignificantBits()); String base64 = BaseEncoding.base64Url().omitPadding().encode(buffer.array()); if (base64.charAt(0) == '_') { return 'x' + base64.substring(1); } if (base64.charAt(0) == '-') { return 'X' + base64.substring(1); } return base64; }
From source file:com.fengduo.bee.commons.core.utils.Identities.java
/** * ?JDKUUID, Random?, -. */ public static String uuid() { return UUID.randomUUID().toString(); }