Package java.util

Examples of java.util.UUID.version()


        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 decompose(uuid);
    }
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.getBroadcastAddress())));
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
        {
            idBytes = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes(DateType.dateStringToTimestamp(source)));
View Full Code Here


      UUID uuid = new UUID( strategy.mostSignificantBits, leastSignificantBits );
      System.out.println( "  uuid : " + uuid.toString() );
      System.out.println( "  variant : " + uuid.variant() );
      System.out.println( "  version : " + uuid.version() );
      if ( uuid.variant() != 2 ) {
        throw new RuntimeException( "bad variant" );
      }
      System.out.println( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
    }
View Full Code Here


      UUID uuid = new UUID( strategy.mostSignificantBits, leastSignificantBits );
      System.out.println( "  uuid : " + uuid.toString() );
      System.out.println( "  variant : " + uuid.variant() );
      System.out.println( "  version : " + uuid.version() );
      if ( uuid.variant() != 2 ) {
        throw new RuntimeException( "bad variant" );
      }
      System.out.println( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
    }
View Full Code Here


      UUID uuid = new UUID( strategy.mostSignificantBits, leastSignificantBits );
      System.out.println( "  uuid : " + uuid.toString() );
      System.out.println( "  variant : " + uuid.variant() );
      System.out.println( "  version : " + uuid.version() );
      if ( uuid.variant() != 2 ) {
        throw new RuntimeException( "bad variant" );
      }
      System.out.println( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" );
    }
View Full Code Here

 
  private void testRandom(TestHarness harness)
  {
    UUID id = UUID.randomUUID();
    harness.check(id.variant(), 2);
    harness.check(id.version(), 4);
  }

  /**
   * Test variant, version, timestamp, clocksequence, node
   */
 
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
        {
            idBytes = ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes(TimestampSerializer.dateStringToTimestamp(source)));
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.