protected Object getRealId(Object id) { return id instanceof IdProxy ? ((IdProxy) id).getNN() : id; } }
@Override public long longValue() { T v = get(); return v == null ? 0 : v.longValue(); }
pkValue = pkDatatype.parse(idString); if (entity instanceof BaseDbGeneratedIdEntity) { pkValue = IdProxy.of((Number) pkValue); JsonPrimitive uuidPrimitive = jsonObject.getAsJsonPrimitive("uuid"); if (uuidPrimitive != null) { UUID uuid = UUID.fromString(uuidPrimitive.getAsString()); ((IdProxy) pkValue).setUuid(uuid);
if (BaseDbGeneratedIdEntity.class.isAssignableFrom(metaClass.getJavaClass())) { if (BaseIdentityIdEntity.class.isAssignableFrom(metaClass.getJavaClass())) { return IdProxy.of(Long.valueOf(entityId)); } else if (BaseIntIdentityIdEntity.class.isAssignableFrom(metaClass.getJavaClass())) { return IdProxy.of(Integer.valueOf(entityId)); } else { Class<?> clazz = metaClass.getJavaClass();
/** * Create proxy for the specified ID value. You might need it for providing ID to the {@code EntityManager.find()} * method. * @param value real ID value */ public static <T extends Number> IdProxy<T> of(T value) { return new IdProxy<>(value); }
/** * Returns a shared copy of this IdProxy cleaned from a reference to entity. * <p>DO NOT use shared copies when assigning the same ID to another entity! * @see #copy(boolean) */ public IdProxy<T> copy() { return copy(true); }
if (BaseDbGeneratedIdEntity.class.isAssignableFrom(metaClass.getJavaClass())) { if (BaseIdentityIdEntity.class.isAssignableFrom(metaClass.getJavaClass())) { return IdProxy.of(Long.valueOf(entityId)); } else if (BaseIntIdentityIdEntity.class.isAssignableFrom(metaClass.getJavaClass())) { return IdProxy.of(Integer.valueOf(entityId)); } else { Class<?> clazz = metaClass.getJavaClass();
/** * Returns a copy of this IdProxy cleaned from a reference to entity. * @param shared if true, a shared instance of the copy will be returned to avoid creating new object. * DO NOT use shared copies when assigning the same ID to another entity! */ public IdProxy<T> copy(boolean shared) { if (copy == null || !shared || !Objects.equals(value, copy.value) || !Objects.equals(uuid, copy.uuid) || (copy.value == null && entity != null && entity.getDbGeneratedId() != null)) { copy = new IdProxy<>(); if (value != null) copy.value = value; else if (entity != null && entity.getDbGeneratedId() != null) copy.value = entity.getDbGeneratedId(); copy.uuid = uuid; copy.hashCode = hashCode; } return copy; }
@Override public float floatValue() { T v = get(); return v == null ? 0 : v.floatValue(); }
Object id = ((Entity) object).getId(); if (id instanceof IdProxy) { entityIds.add(((IdProxy) id).getNN()); } else { entityIds.add(id); Object id = ((Entity) object).getId(); if (id instanceof IdProxy) { entityIds.add(((IdProxy) id).getNN()); } else { entityIds.add(id); Object id = ((Entity) input).getId(); if (id instanceof IdProxy) { return (T) ((IdProxy) id).getNN(); } else { return (T) id;
((BaseStringIdEntity) entity).setId(string); } else if (entity instanceof BaseIdentityIdEntity) { ((BaseIdentityIdEntity) entity).setId(IdProxy.of(Long.valueOf(string))); } else if (entity instanceof BaseIntIdentityIdEntity) { ((BaseIntIdentityIdEntity) entity).setId(IdProxy.of(Integer.valueOf(string))); } else if (entity instanceof HasUuid) { ((HasUuid) entity).setUuid(UUID.fromString(string));
@Override public int intValue() { T v = get(); return v == null ? 0 : v.intValue(); }
Object id = ((Entity) object).getId(); if (id instanceof IdProxy) { entityIds.add(dbSpecificConvert(((IdProxy) id).getNN())); } else { entityIds.add(dbSpecificConvert(id)); Object id = ((Entity) object).getId(); if (id instanceof IdProxy) { entityIds.add(dbSpecificConvert(((IdProxy) id).getNN())); } else { entityIds.add(dbSpecificConvert(id)); Object id = ((Entity) input).getId(); if (id instanceof IdProxy) { return (T) dbSpecificConvert(((IdProxy) id).getNN()); } else { return (T) dbSpecificConvert(id);
@Override public double doubleValue() { T v = get(); return v == null ? 0 : v.doubleValue(); }
Object entityId = entity.getValue(idProperty.getName()); if (entityId instanceof IdProxy) { entityId = ((IdProxy) entityId).getNN();
protected Object getEntityId(Entity entity) { Object entityId = entity.getId(); if (entityId instanceof IdProxy) { return ((IdProxy) entityId).get(); } else { return entityId; } }
loadedEntities.stream() .filter(e -> { Object id = e.getId() instanceof IdProxy ? ((IdProxy) e.getId()).getNN() : e.getId(); return id.equals(relatedPropertyValue); })