$
This commit is contained in:
38
src/fr/sae/JSonInspector/Storage/Value.java
Normal file
38
src/fr/sae/JSonInspector/Storage/Value.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package fr.sae.JSonInspector.Storage;
|
||||
|
||||
public class Value<T> {
|
||||
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);
|
||||
}
|
||||
|
||||
public boolean isString() {
|
||||
return value.getClass().equals(String.class);
|
||||
}
|
||||
|
||||
public boolean isNumber() {
|
||||
return value.getClass().equals(Integer.class) || value.getClass().equals(Double.class);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user