List of usage examples for java.util UUID equals
public boolean equals(Object obj)
From source file:Main.java
public static void main(String[] args) { // creating two UUIDs UUID u1 = UUID.randomUUID(); UUID u2 = UUID.randomUUID(); // checking equality System.out.println("Is two UUIDs equal: " + u1.equals(u2)); }
From source file:Main.java
public static BluetoothGattService findService(UUID uuid, List<BluetoothGattService> gattServices) { if (gattServices == null) return null; for (BluetoothGattService gattService : gattServices) { if (uuid.equals(gattService.getUuid())) { return gattService; }/*from w ww.j ava 2s. co m*/ } return null; }
From source file:com.microsoft.azuretools.adauth.ResponseUtils.java
public static AuthorizationResult parseAuthorizeResponse(String webAuthenticationResult, CallState callState) throws URISyntaxException, UnsupportedEncodingException { AuthorizationResult result = null;//from w w w. j a v a 2s . c o m URI resultUri = new URI(webAuthenticationResult); // NOTE: The Fragment property actually contains the leading '#' character and that must be dropped String resultData = resultUri.getQuery(); if (resultData != null && !resultData.isEmpty()) { // Remove the leading '?' first Map<String, String> map = UriUtils.formQueryStirng(resultData); if (map.containsKey(OAuthHeader.CorrelationId)) { String correlationIdHeader = (map.get(OAuthHeader.CorrelationId)).trim(); try { UUID correlationId = UUID.fromString(correlationIdHeader); if (!correlationId.equals(callState.correlationId)) { log.log(Level.WARNING, "Returned correlation id '" + correlationId + "' does not match the sent correlation id '" + callState.correlationId + "'"); } } catch (IllegalArgumentException ex) { log.log(Level.WARNING, "Returned correlation id '" + correlationIdHeader + "' is not in GUID format."); } } if (map.containsKey(OAuthReservedClaim.Code)) { result = new AuthorizationResult(map.get(OAuthReservedClaim.Code)); } else if (map.containsKey(OAuthReservedClaim.Error)) { result = new AuthorizationResult(map.get(OAuthReservedClaim.Error), map.get(OAuthReservedClaim.ErrorDescription), map.get(OAuthReservedClaim.ErrorSubcode)); } else { result = new AuthorizationResult(AuthError.AuthenticationFailed, AuthErrorMessage.AuthorizationServerInvalidResponse); } } return result; }
From source file:com.scottwoodward.chestmail.manager.ChestMailManager.java
public static boolean isMailBoxOwner(Player player, String name) { boolean isMailBoxOwner = false; ChestMailDatabaseManager dbManager = new ChestMailDatabaseManager(ChestMail.getPluginName()); Connection connection = dbManager.getConnection(); String uuidString = dbManager.getOwnerOfMailbox(connection, name); UUID uuid = convertStringToUUID(uuidString); System.out.println(uuid);/*from w w w .j av a2 s . c o m*/ System.out.println(player.getUniqueId()); isMailBoxOwner = (uuid.equals(player.getUniqueId())); dbManager.closeConnection(connection); return isMailBoxOwner; }
From source file:Main.java
/** * check if full style or short (16bits) style UUID matches * * @param src the UUID to be compared// w w w . j a va 2s . c o m * @param dst the UUID to be compared * @return true if the both of UUIDs matches */ public static boolean matches(@NonNull final UUID src, @NonNull final UUID dst) { if (isShortUuid(src) || isShortUuid(dst)) { // at least one instance is short style: check only 16bits long srcShortUUID = src.getMostSignificantBits() & 0x0000ffff00000000L; long dstShortUUID = dst.getMostSignificantBits() & 0x0000ffff00000000L; return srcShortUUID == dstShortUUID; } else { return src.equals(dst); } }
From source file:wordnice.api.bukkit.Craft.java
public static void getWorldsUUID(Collection<World> out, Collection<String> comp) { Collection<World> worlds = getWorlds(); UUID id = null;// w w w . ja v a2s.c om Iterator<String> req = comp.iterator(); while (req.hasNext()) { try { id = UUID.fromString(req.next()); } catch (IllegalArgumentException ign) { continue; } for (World p : worlds) { if (p == null) continue; UUID cid = p.getUID(); if (cid.equals(id)) { out.add(p); req.remove(); break; } } } }
From source file:wordnice.api.bukkit.Craft.java
public static void getPlayersUUID(Collection<Player> out, Collection<String> comp) { Collection<Player> players = getPlayers(); UUID id = null;//from w ww. j ava 2 s.co m Iterator<String> req = comp.iterator(); while (req.hasNext()) { try { id = UUID.fromString(req.next()); } catch (IllegalArgumentException ign) { continue; } for (Player p : players) { if (p == null) continue; UUID cid = p.getUniqueId(); if (cid.equals(id)) { out.add(p); req.remove(); break; } } } }
From source file:org.unidle.test.Conditions.java
public static Condition<Object> hasUuid(final UUID uuid) { return new Condition<Object>(format("has uuid: %s", uuid)) { @Override//from ww w . j ava 2s.c o m public boolean matches(final Object value) { return uuid.equals(getField(value, "uuid")); } }; }
From source file:com.spectralogic.ds3client.helpers.RequestMatchers.java
public static AllocateJobChunkSpectraS3Request hasChunkId(final UUID chunkId) { return argThat(new TypeSafeMatcher<AllocateJobChunkSpectraS3Request>() { @Override// ww w.j a v a 2 s. co m public void describeTo(final Description description) { describeRequest(chunkId, description); } @Override protected boolean matchesSafely(final AllocateJobChunkSpectraS3Request item) { return chunkId.equals(UUID.fromString(item.getJobChunkId())); } @Override protected void describeMismatchSafely(final AllocateJobChunkSpectraS3Request item, final Description mismatchDescription) { describeRequest(UUID.fromString(item.getJobChunkId()), mismatchDescription); } private void describeRequest(final UUID chunkIdValue, final Description description) { description.appendText("AllocateJobChunkResponse with chunk id: ").appendValue(chunkIdValue); } }); }
From source file:com.spectralogic.ds3client.helpers.RequestMatchers.java
public static GetJobChunksReadyForClientProcessingSpectraS3Request hasJobId(final UUID jobId) { return argThat(new TypeSafeMatcher<GetJobChunksReadyForClientProcessingSpectraS3Request>() { @Override// ww w . j av a 2 s .c o m public void describeTo(final Description description) { describeRequest(jobId, description); } @Override protected boolean matchesSafely(final GetJobChunksReadyForClientProcessingSpectraS3Request item) { return jobId.equals(UUID.fromString(item.getJob())); } @Override protected void describeMismatchSafely(final GetJobChunksReadyForClientProcessingSpectraS3Request item, final Description mismatchDescription) { describeRequest(UUID.fromString(item.getJob()), mismatchDescription); } private void describeRequest(final UUID jobIdValue, final Description description) { description.appendText("GetAvailableJobChunksRequest with job id: ").appendValue(jobIdValue); } }); }