Example usage for java.util UUID fromString

List of usage examples for java.util UUID fromString

Introduction

In this page you can find the example usage for java.util UUID fromString.

Prototype

public static UUID fromString(String name) 

Source Link

Document

Creates a UUID from the string standard representation as described in the #toString method.

Usage

From source file:Main.java

public static UUID sixteenBitUuid(long shortUuid) {
    assert shortUuid >= 0 && shortUuid <= 0xFFFF;
    return UUID.fromString(String.format(shortUuidFormat, shortUuid & 0xFFFF));
}

From source file:Main.java

public static UUID sixteenBitUuidClient(long shortUuid) {
    assert shortUuid >= 0 && shortUuid <= 0xFFFF;
    return UUID.fromString(String.format(clientUuidFormat, shortUuid & 0xFFFF));
}

From source file:com.swordlord.jalapeno.datarow.DataRowKeyBase.java

public static DataRowKeyBase fromString(String strKey) {
    return new DataRowKeyBase(UUID.fromString(strKey));
}

From source file:com.yahoo.elide.utils.coerce.converters.ToUUIDConverter.java

/**
 * Convert value to UUID./*from w  w w .  j av  a 2s . c  om*/
 *
 * @param cls class to convert to
 * @param value value to convert
 * @param <T> object type
 * @return converted object
 */
@Override
public <T> T convert(Class<T> cls, Object value) {
    if (cls == UUID.class) {
        return (T) UUID.fromString(String.valueOf(value));
    }
    throw new UnsupportedOperationException("Cannot convert to " + cls.getSimpleName());
}

From source file:Main.java

public static final UUID fromUUID16(int uuid16) {

    String s = uuidStringFromUuid16(uuid16);
    UUID uuid = UUID.fromString(s);

    return uuid;// ww w.j  a v  a 2s . c o  m
}

From source file:Main.java

private static UUID getUuid(Context c) {
    final SharedPreferences prefs = c.getSharedPreferences(ID_PREFS_FILE, Context.MODE_PRIVATE);
    final String id = prefs.getString(ID_PREFS_DEVICE_ID, null);
    final UUID uuid;
    if (id != null) {
        uuid = UUID.fromString(id);
    } else {/*from   w w w .ja  v a2 s  .co m*/
        final String androidId = Secure.getString(c.getContentResolver(), Secure.ANDROID_ID);
        try {
            if (!BAD_UUID.equals(androidId)) {
                uuid = UUID.nameUUIDFromBytes(androidId.getBytes("utf8"));
            } else {
                final String deviceId = ((TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE))
                        .getDeviceId();
                if (deviceId != null)
                    uuid = UUID.nameUUIDFromBytes(deviceId.getBytes("utf8"));
                else
                    uuid = UUID.randomUUID();
            }
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
        prefs.edit().putString(ID_PREFS_DEVICE_ID, uuid.toString()).commit();
    }
    return uuid;
}

From source file:nu.yona.server.batch.quartz.jobs.PinResetConfirmationCodeSenderQuartzJob.java

private static UUID getUserId(Map<String, Object> parameterMap) {
    return UUID.fromString((String) parameterMap.get(USER_ID_KEY));
}

From source file:com.hengyi.japp.tools.UuidUtils.java

public static String encodeBase58Uuid(String uuidString) {
    UUID uuid = UUID.fromString(uuidString);
    return base58Uuid(uuid);
}

From source file:com.microsoft.visualstudio.services.account.AccountHttpClient.java

public List<Account> getAccounts(final UUID memberId) {
    final UUID locationId = UUID.fromString("229A6A53-B428-4FFB-A835-E8F36B5B4B1E");
    final ApiResourceVersion apiVersion = new ApiResourceVersion("3.0-preview.1"); //$NON-NLS-1$
    final Map<String, String> queryParams = new HashMap<String, String>();
    queryParams.put("memberId", memberId.toString());

    final Invocation httpRequest = super.createRequest(HttpMethod.GET, locationId, null, apiVersion,
            queryParams, APPLICATION_JSON_TYPE);

    return super.sendRequest(httpRequest, new TypeReference<List<Account>>() {
    });//  w ww.  j  ava 2 s.  c  o m
}

From source file:net.mojodna.searchable.converter.UUIDConverter.java

public Object convert(final Class clazz, final Object value) {
    return UUID.fromString(value.toString());
}