当前位置: 首页>>代码示例>>Java>>正文


Java UUID.fromString方法代码示例

本文整理汇总了Java中java.util.UUID.fromString方法的典型用法代码示例。如果您正苦于以下问题:Java UUID.fromString方法的具体用法?Java UUID.fromString怎么用?Java UUID.fromString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.UUID的用法示例。


在下文中一共展示了UUID.fromString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readDataNBT

import java.util.UUID; //导入方法依赖的package包/类
@Override
protected void readDataNBT(NBTTagCompound tag) {
	cooldown = tag.getInteger("cooldown");
	if (tag.hasKey("ritual"))
		ritual = Ritual.REGISTRY.getValue(new ResourceLocation(tag.getString("ritual")));
	if (tag.hasKey("player"))
		entityPlayer = UUID.fromString(tag.getString("player"));
	if (tag.hasKey("data"))
		ritualData = tag.getCompoundTag("data");
	if (tag.hasKey("entityList")) {
		entityList = new ArrayList<Tuple<String, String>>();
		tag.getTagList("entityList", NBT.TAG_STRING).forEach(nbts -> {
			String[] names = ((NBTTagString) nbts).getString().split("!");
			if (names.length == 2)
				entityList.add(new Tuple<String, String>(names[0], names[1]));
		});
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:19,代码来源:TileEntityGlyph.java

示例2: func_152648_b

import java.util.UUID; //导入方法依赖的package包/类
private static GameProfile func_152648_b(JsonObject p_152648_0_)
{
    if (p_152648_0_.has("uuid") && p_152648_0_.has("name"))
    {
        String s = p_152648_0_.get("uuid").getAsString();
        UUID uuid;

        try
        {
            uuid = UUID.fromString(s);
        }
        catch (Throwable var4)
        {
            return null;
        }

        return new GameProfile(uuid, p_152648_0_.get("name").getAsString());
    }
    else
    {
        return null;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:24,代码来源:UserListBansEntry.java

示例3: toGameProfile

import java.util.UUID; //导入方法依赖的package包/类
/**
 * Convert a {@linkplain com.google.gson.JsonObject JsonObject} into a {@linkplain com.mojang.authlib.GameProfile}.
 * The json object must have {@code uuid} and {@code name} attributes or {@code null} will be returned.
 */
private static GameProfile toGameProfile(JsonObject json)
{
    if (json.has("uuid") && json.has("name"))
    {
        String s = json.get("uuid").getAsString();
        UUID uuid;

        try
        {
            uuid = UUID.fromString(s);
        }
        catch (Throwable var4)
        {
            return null;
        }

        return new GameProfile(uuid, json.get("name").getAsString());
    }
    else
    {
        return null;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:28,代码来源:UserListBansEntry.java

示例4: receive

import java.util.UUID; //导入方法依赖的package包/类
@Override
public void receive(String channel, String packet)
{
    UUID player = UUID.fromString(packet);
    JoinResponse response = manager.requestJoin(player, false);
    if (!response.isAllowed())
    {
        TextComponent component = new TextComponent(response.getReason());
        component.setColor(ChatColor.RED);
        SamaGamesAPI.get().getPlayerManager().sendMessage(player, component);
    } else
    {
        SamaGamesAPI.get().getPlayerManager().connectToServer(player, SamaGamesAPI.get().getServerName());
        SamaGamesAPI.get().getGameManager().refreshArena();
    }
}
 
开发者ID:SamaGames,项目名称:SamaGamesCore,代码行数:17,代码来源:RegularJoinHandler.java

示例5: read

import java.util.UUID; //导入方法依赖的package包/类
@Override
public UUID read(Unpacker u, UUID to, boolean required) throws IOException {
    if (!required && u.trySkipNil()) {
        return null;
    }
    String path = u.readString();
    return UUID.fromString(path);
}
 
开发者ID:tiglabs,项目名称:jsf-sdk,代码行数:9,代码来源:JSFUUIDTemplate.java

示例6: getOwner

import java.util.UUID; //导入方法依赖的package包/类
public EntityLivingBase getOwner()
{
    try
    {
        UUID uuid = UUID.fromString(this.getOwnerId());
        return uuid == null ? null : this.worldObj.getPlayerEntityByUUID(uuid);
    }
    catch (IllegalArgumentException var2)
    {
        return null;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:EntityTameable.java

示例7: readPacketData

import java.util.UUID; //导入方法依赖的package包/类
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    String s = buf.readStringFromBuffer(36);
    String s1 = buf.readStringFromBuffer(16);
    UUID uuid = UUID.fromString(s);
    this.profile = new GameProfile(uuid, s1);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:S02PacketLoginSuccess.java

示例8: convert

import java.util.UUID; //导入方法依赖的package包/类
@Override
public UUID convert(Object value) {
    if (value == null) {
        return null;
    }
    else
    if (value instanceof UUID) {
        return (UUID)value;
    }
    else
    if (value instanceof String) {
        return UUID.fromString((String)value);
    }
    else
    if (value.getClass().isArray()) {
        if (value.getClass().getComponentType() == Byte.TYPE) {
            return UUID.nameUUIDFromBytes((byte[])value);
        }
        else
        if (value.getClass().getComponentType() == Character.TYPE) {
        	return UUID.fromString(String.valueOf((char[])value));
        }
        else {
            throw new IllegalArgumentException("Cannot convert to UUID "+
                "from array of \""+
                value.getClass().getComponentType()+"\"");
        }
    }
    else {
        return UUID.fromString(value.toString());
    }
}
 
开发者ID:intuit,项目名称:universal-graph-client,代码行数:33,代码来源:UUIDTypeConversion.java

示例9: getCrime

import java.util.UUID; //导入方法依赖的package包/类
public Crime getCrime() {
    String uuidString = getString(getColumnIndex(Cols.UUID));
    String title = getString(getColumnIndex(Cols.TITLE));
    long date = getLong(getColumnIndex(Cols.DATE));
    int isSolved = getInt(getColumnIndex(Cols.SOLVED));
    String suspect = getString(getColumnIndex(CrimeTable.Cols.SUSPECT));

    Crime crime = new Crime(UUID.fromString(uuidString));
    crime.setTitle(title);
    crime.setDate(new Date(date));
    crime.setSolved(isSolved != 0);
    crime.setSuspect(suspect);

    return crime;
}
 
开发者ID:rsippl,项目名称:AndroidProgramming3e,代码行数:16,代码来源:CrimeCursorWrapper.java

示例10: parseStartTag

import java.util.UUID; //导入方法依赖的package包/类
@Override
public void parseStartTag(XmlPullParser parser) {
  if (TAG_PROTECTION_HEADER.equals(parser.getName())) {
    inProtectionHeader = true;
    String uuidString = parser.getAttributeValue(null, KEY_SYSTEM_ID);
    uuidString = stripCurlyBraces(uuidString);
    uuid = UUID.fromString(uuidString);
  }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:10,代码来源:SmoothStreamingManifestParser.java

示例11: getUserId

import java.util.UUID; //导入方法依赖的package包/类
@Override
@JsonIgnore
public UUID getUserId () {

  try {

    return UUID.fromString(this.user_id);
  } catch (Exception e) {

    return super.getUserId();
  }
}
 
开发者ID:vangav,项目名称:vos_whatsapp,代码行数:13,代码来源:RequestGetMessages.java

示例12: LuxometerProfile

import java.util.UUID; //导入方法依赖的package包/类
public LuxometerProfile(@NonNull Observable<RxBleConnection> conn) {
    super(conn,
            UUID.fromString(GattServ),
            UUID.fromString(GattConf),
            UUID.fromString(GattData),
            UUID.fromString(GattPeri),
            Bconf);
}
 
开发者ID:KunYi,项目名称:SensorTag2Testing,代码行数:9,代码来源:LuxometerProfile.java

示例13: testResolveSubjectIdentity

import java.util.UUID; //导入方法依赖的package包/类
@Test
public void testResolveSubjectIdentity() {
  UUID id = UUID.fromString("00000000-0000-0000-0000-000000000001");
  SubjectIdentity identity = resolver.resolveSubjectIdentity(id);
  assertTrue(identity instanceof SubjectIdentifier);
  assertEquals(id, SubjectIdentifier.class.cast(identity).getGlobalID());
}
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:8,代码来源:PropertiesBasedIdentityResolverTest.java

示例14: ensureItemInternal

import java.util.UUID; //导入方法依赖的package包/类
@Override
protected void ensureItemInternal(Item newItem)
{
	ItemKey itemkey = params.getItemKey();

	params.setItemPack(newPack);

	String uuid = itemkey.getUuid();
	if( uuid.length() == 0 )
	{
		uuid = UUID.randomUUID().toString();
	}
	else
	{
		// Make sure valid uuid
		UUID.fromString(uuid);
	}

	itemkey = new ItemId(uuid, itemkey.getVersion());
	params.setItemKey(itemkey, 0);
	newItem.setId(0);
	newItem.setUuid(uuid);
	newItem.setVersion(itemkey.getVersion());
	newItem.setDateCreated(new Date());

	newItem.setItemDefinition(itemDefinitionService.get(newItem.getItemDefinition().getId()));
	if( itemkey.getVersion() > 1 )
	{
		long collectionId = itemDao.getCollectionIdForUuid(itemkey.getUuid());
		if( collectionId != 0 && newItem.getItemDefinition().getId() != collectionId )
		{
			throw new OperationException("com.tle.core.workflow.operations.editmeta.error.cannotchangecollection"); //$NON-NLS-1$
		}
	}

	boolean noOwner = Check.isEmpty(newItem.getOwner());
	if( noOwner )
	{
		newItem.setOwner(CurrentUser.getUserID());
	}

	newItem.setStatus(null);
	newItem.setStatus(initialStatus);

	relinkAttachments(newItem.getAttachments(), newItem.getTreeNodes());
	createHistory(Type.contributed);
}
 
开发者ID:equella,项目名称:Equella,代码行数:48,代码来源:EditNewItemMetadataOperation.java

示例15: random

import java.util.UUID; //导入方法依赖的package包/类
@Override
public UUID random() {
    return UUID.fromString("524e4f85-2d2f-4927-ab98-bd7a2f689773");
}
 
开发者ID:linagora,项目名称:openpaas-mailets,代码行数:5,代码来源:FakeUUIDGenerator.java


注:本文中的java.util.UUID.fromString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。