Make boolean convenience based of generic convenience.
This commit is contained in:
parent
8f6bcf2be9
commit
f133149321
@ -174,6 +174,7 @@ public class Entity<E extends Entity<E>>
|
|||||||
// CONVENIENCE: DATABASE
|
// CONVENIENCE: DATABASE
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
// GENERIC
|
||||||
public <T> T convertGet(T value, T defaultValue)
|
public <T> T convertGet(T value, T defaultValue)
|
||||||
{
|
{
|
||||||
return value != null ? value : defaultValue;
|
return value != null ? value : defaultValue;
|
||||||
@ -185,16 +186,15 @@ public class Entity<E extends Entity<E>>
|
|||||||
return Objects.equals(value, defaultValue) ? null : value;
|
return Objects.equals(value, defaultValue) ? null : value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Boolean specific
|
// BOOLEAN
|
||||||
public boolean convertGet(Boolean wrapper)
|
public boolean convertGet(Boolean value)
|
||||||
{
|
{
|
||||||
return wrapper != null ? wrapper.booleanValue() : false;
|
return convertGet(value, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean convertSet(boolean primitive)
|
public Boolean convertSet(Boolean value)
|
||||||
{
|
{
|
||||||
this.changed();
|
return convertSet(value, false);
|
||||||
return primitive ? Boolean.TRUE : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
Loading…
Reference in New Issue
Block a user