2023-01-15 20:37:28 +01:00
|
|
|
package fr.sae.JSonInspector.Storage;
|
2023-01-15 20:08:18 +01:00
|
|
|
|
2023-01-15 20:37:28 +01:00
|
|
|
public class Value<T> {
|
2023-01-15 20:08:18 +01:00
|
|
|
private T value;
|
|
|
|
|
|
|
|
public Value(T value) {
|
|
|
|
this.value = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public T getValue() {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isObjectOrArray() {
|
|
|
|
if (value.getClass().equals(Node.class)) {
|
|
|
|
Node node = (Node) value;
|
|
|
|
if (node.getType() == Type.OBJECT || node.getType() == Type.ARRAY) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isNode() {
|
|
|
|
return value.getClass().equals(Node.class);
|
|
|
|
}
|
|
|
|
|
2023-01-15 20:37:28 +01:00
|
|
|
public boolean isString() {
|
2023-01-15 20:08:18 +01:00
|
|
|
return value.getClass().equals(String.class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isNumber() {
|
|
|
|
return value.getClass().equals(Integer.class) || value.getClass().equals(Double.class);
|
|
|
|
}
|
|
|
|
}
|