-
Notifications
You must be signed in to change notification settings - Fork 692
Closed
Labels
type: documentationA documentation updateA documentation update
Milestone
Description
The javadoc for the class reads as such:
/**
* Base class for implementations of {@link EntityInformation}. Considers an entity to be new whenever
* {@link #getId(Object)} returns {@literal null}.
However, the implementation of the isNew(T entity)
method also considers the object new if the object's id is set to 0:
public boolean isNew(T entity) {
ID id = getId(entity);
Class<ID> idType = getIdType();
if (!idType.isPrimitive()) {
return id == null;
}
if (id instanceof Number) {
return ((Number) id).longValue() == 0L;
}
throw new IllegalArgumentException(String.format("Unsupported primitive id type %s!", idType));
}
This has surfaced as a problem with a project I'm working on because the project's design relied upon 0 being considered a valid ID.
Metadata
Metadata
Assignees
Labels
type: documentationA documentation updateA documentation update