Package java.util

Examples of java.util.UUID.version()


            catch (IllegalArgumentException e)
            {
                throw new MarshalException(String.format("Unable to make UUID from '%s'", source), e);
            }

            if (uuid.version() != 1)
                throw new MarshalException("TimeUUID supports only version 1 UUIDs");
        } else
        {
            throw new MarshalException(String.format("Unknown timeuuid representation: %s", source));
        }
View Full Code Here


    UUID uuid1 = new UUID(
        strategy.getMostSignificantBits(),
        CustomVersionOneStrategy.generateLeastSignificantBits( now )
    );
    assertEquals( 2, uuid1.variant() );
    assertEquals( 1, uuid1.version() );

    for ( int i = 0; i < 100; i++ ) {
      UUID uuidX = new UUID(
          strategy.getMostSignificantBits(),
          CustomVersionOneStrategy.generateLeastSignificantBits( now )
View Full Code Here

      UUID uuidX = new UUID(
          strategy.getMostSignificantBits(),
          CustomVersionOneStrategy.generateLeastSignificantBits( now )
      );
      assertEquals( 2, uuidX.variant() );
      assertEquals( 1, uuidX.version() );
      assertFalse( uuid1.equals( uuidX ) );
      assertEquals( uuid1.getMostSignificantBits(), uuidX.getMostSignificantBits() );
    }
  }
View Full Code Here

    UUID uuid = new UUID(
        strategy.getMostSignificantBits(),
        CustomVersionOneStrategy.generateLeastSignificantBits( 0 )
    );
    assertEquals( 2, uuid.variant() );
    assertEquals( 1, uuid.version() );

    uuid = new UUID(
        strategy.getMostSignificantBits(),
        CustomVersionOneStrategy.generateLeastSignificantBits( Long.MAX_VALUE )
    );
View Full Code Here

    uuid = new UUID(
        strategy.getMostSignificantBits(),
        CustomVersionOneStrategy.generateLeastSignificantBits( Long.MAX_VALUE )
    );
    assertEquals( 2, uuid.variant() );
    assertEquals( 1, uuid.version() );
  }
}
View Full Code Here

        if (bytes.remaining() != 16)
        {
            throw new MarshalException("UUIDs must be exactly 16 bytes");
        }
        UUID uuid = UUIDGen.getUUID(bytes);
        if (uuid.version() != 1)
        {
            throw new MarshalException("TimeUUID only makes sense with version 1 UUIDs");
        }
        return uuid.toString();
    }
View Full Code Here

            catch (IllegalArgumentException e)
            {
                throw new MarshalException(String.format("unable to make UUID from '%s'", source), e);
            }
           
            if (uuid.version() != 1)
                throw new MarshalException("TimeUUID supports only version 1 UUIDs");
        }
        else if (source.toLowerCase().equals("now"))
        {
            idBytes = ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.makeType1UUIDFromHost(FBUtilities.getLocalAddress())));
View Full Code Here

        if (bytes.remaining() != 16)
        {
            throw new MarshalException("UUIDs must be exactly 16 bytes");
        }
        UUID uuid = UUIDGen.getUUID(bytes);
        if (uuid.version() != 1)
        {
            throw new MarshalException("TimeUUID only makes sense with version 1 UUIDs");
        }
        return uuid.toString();
    }
View Full Code Here

    public ByteBuffer fromString(String source)
    {
        UUID uuid = UUID.fromString(source);

        if (uuid.version() != 1)
            throw new IllegalArgumentException("TimeUUID supports only version 1 UUIDs");

        return ByteBuffer.wrap(UUIDGen.decompose(uuid));
    }
View Full Code Here

        if (bytes.length != 16)
        {
            throw new MarshalException("UUIDs must be exactly 16 bytes");
        }
        UUID uuid = LexicalUUIDType.getUUID(bytes);
        if (uuid.version() != 1)
        {
            throw new MarshalException("TimeUUID only makes sense with version 1 UUIDs");
        }
        return uuid.toString();
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.