Add utility method
This commit is contained in:
parent
c7ebf9e32f
commit
5cb81b3450
@ -30,6 +30,14 @@ public class NullableInt52 implements Serializable, IGenericNullable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static NullableInt52 ofNullableNumber(@Nullable Number value) {
|
||||||
|
if (value == null) {
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
return new NullableInt52(Int52.fromLong(value.longValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static NullableInt52 empty() {
|
public static NullableInt52 empty() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,14 @@ public class Nullablebyte implements Serializable, IGenericNullable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Nullablebyte ofNullableNumber(@Nullable Number value) {
|
||||||
|
if (value == null) {
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
return new Nullablebyte(value.byteValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Nullablebyte empty() {
|
public static Nullablebyte empty() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,14 @@ public class Nullabledouble implements Serializable, IGenericNullable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Nullabledouble ofNullableNumber(@Nullable Number value) {
|
||||||
|
if (value == null) {
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
return new Nullabledouble(value.doubleValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Nullabledouble empty() {
|
public static Nullabledouble empty() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,14 @@ public class Nullablefloat implements Serializable, IGenericNullable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Nullablefloat ofNullableNumber(@Nullable Number value) {
|
||||||
|
if (value == null) {
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
return new Nullablefloat(value.floatValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Nullablefloat empty() {
|
public static Nullablefloat empty() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,14 @@ public class Nullableint implements Serializable, IGenericNullable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Nullableint ofNullableNumber(@Nullable Number value) {
|
||||||
|
if (value == null) {
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
return new Nullableint(value.intValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Nullableint empty() {
|
public static Nullableint empty() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,14 @@ public class Nullablelong implements Serializable, IGenericNullable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Nullablelong ofNullableNumber(@Nullable Number value) {
|
||||||
|
if (value == null) {
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
return new Nullablelong(value.longValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Nullablelong empty() {
|
public static Nullablelong empty() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,14 @@ public class Nullableshort implements Serializable, IGenericNullable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Nullableshort ofNullableNumber(@Nullable Number value) {
|
||||||
|
if (value == null) {
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
return new Nullableshort(value.shortValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static Nullableshort empty() {
|
public static Nullableshort empty() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user