@Test void throwsExceptionDecoding() { assertThrows(InvalidEntityException.class, () -> { EntityIdEndec.decode(-1, FILE); }); }
public static EntityId decode(long encodedId, EntityTypeEnum entityTypeEnum) { if (encodedId < 0) { throw new InvalidEntityException("encodedId can not be negative: " + encodedId); } long shard = encodedId >> (REALM_BITS + NUM_BITS); long realm = (encodedId >> NUM_BITS) & REALM_MASK; long num = encodedId & NUM_MASK; return EntityId.of(shard, realm, num, entityTypeEnum); }
EntityIdEndec { public static EntityId decode(long encodedId, EntityTypeEnum entityTypeEnum) { if (encodedId < 0) { throw new InvalidEntityException("encodedId can not be negative: " + encodedId); } long shard = encodedId >> (REALM_BITS + NUM_BITS); long realm = (encodedId >> NUM_BITS) & REALM_MASK; long num = encodedId & NUM_MASK; return EntityId.of(shard, realm, num, entityTypeEnum); } }
EntityIdEndec { public static EntityId decode(long encodedId, EntityTypeEnum entityTypeEnum) { if (encodedId < 0) { throw new InvalidEntityException("encodedId can not be negative: " + encodedId); } long shard = encodedId >> (REALM_BITS + NUM_BITS); long realm = (encodedId >> NUM_BITS) & REALM_MASK; long num = encodedId & NUM_MASK; return EntityId.of(shard, realm, num, entityTypeEnum); }  }
EntityIdEndec { public static EntityId decode(long encodedId, EntityTypeEnum entityTypeEnum) { if (encodedId < 0) { throw new InvalidEntityException("encodedId can not be negative: " + encodedId); } long shard = encodedId >> (REALM_BITS + NUM_BITS); long realm = (encodedId >> NUM_BITS) & REALM_MASK; long num = encodedId & NUM_MASK; return EntityId.of(shard, realm, num, entityTypeEnum); }  static Long encode(long shardNum, long realmNum, long entityNum); static EntityId decode(long encodedId, EntityTypeEnum entityTypeEnum); }
EntityIdEndec { public static EntityId decode(long encodedId, EntityTypeEnum entityTypeEnum) { if (encodedId < 0) { throw new InvalidEntityException("encodedId can not be negative: " + encodedId); } long shard = encodedId >> (REALM_BITS + NUM_BITS); long realm = (encodedId >> NUM_BITS) & REALM_MASK; long num = encodedId & NUM_MASK; return EntityId.of(shard, realm, num, entityTypeEnum); }  static Long encode(long shardNum, long realmNum, long entityNum); static EntityId decode(long encodedId, EntityTypeEnum entityTypeEnum);  }