class UuidId implements Id {

        private final UUID uuid;

        public UuidId(String string) {
            this(StringEncoding.uuid(string));
        }

        public UuidId(byte[] bytes) {
            this(fromBytes(bytes));
        }

        public UuidId(UUID uuid) {
            E.checkArgument(uuid != null, "The uuid can't be null");
            this.uuid = uuid;
        }

        @Override
        public IdType type() {
            return IdType.UUID;
        }

        @Override
        public Object asObject() {
            return this.uuid;
        }

        @Override
        public String asString() {
            return this.uuid.toString();
        }

        @Override
        public long asLong() {
            throw new UnsupportedOperationException();
        }

        @Override
        public byte[] asBytes() {
            BytesBuffer buffer = BytesBuffer.allocate(16);
            buffer.writeLong(this.uuid.getMostSignificantBits());
            buffer.writeLong(this.uuid.getLeastSignificantBits());
            return buffer.bytes();
        }

        private static UUID fromBytes(byte[] bytes) {<FILL_FUNCTION_BODY>}

        @Override
        public int length() {
            return UUID_LENGTH;
        }

        @Override
        public int compareTo(Id other) {
            E.checkNotNull(other, "compare id");
            int cmp = compareType(this, other);
            if (cmp != 0) {
                return cmp;
            }
            return this.uuid.compareTo(((UuidId) other).uuid);
        }

        @Override
        public int hashCode() {
            return this.uuid.hashCode();
        }

        @Override
        public boolean equals(Object other) {
            if (!(other instanceof UuidId)) {
                return false;
            }
            return this.uuid.equals(((UuidId) other).uuid);
        }

        @Override
        public String toString() {
            return this.uuid.toString();
        }
    }

            E.checkArgument(bytes != null, "The UUID can't be null");
            BytesBuffer buffer = BytesBuffer.wrap(bytes);
            long high = buffer.readLong();
            long low = buffer.readLong();
            return new UUID(high, low);
        
<no_super_class>