Jval redundancy cleanup
@@ -98,15 +98,15 @@ public class Jval{
public boolean isFalse(){ return value == Boolean.FALSE; }
public boolean isNull(){ return value == null; }
- public JsonMap asObject(){ if(!(value instanceof JsonMap)) throw new UnsupportedOperationException("Not an object: " + toString()); return (JsonMap)value; }
- public JsonArray asArray(){ if(!(value instanceof JsonArray)) throw new UnsupportedOperationException("Not an array: " + toString()); return (JsonArray)value; }
+ public JsonMap asObject(){ if(!(value instanceof JsonMap)) throw new UnsupportedOperationException("Not an object: " + this); return (JsonMap)value; }
+ public JsonArray asArray(){ if(!(value instanceof JsonArray)) throw new UnsupportedOperationException("Not an array: " + this); return (JsonArray)value; }
public int asInt(){ return asNumber().intValue(); }
public long asLong(){ return asNumber().longValue(); }
public float asFloat(){ return asNumber().floatValue(); }
public double asDouble(){ return asNumber().doubleValue(); }
- public String asString(){ if(!(value instanceof String) && !(value instanceof Number)) throw new UnsupportedOperationException("Not a string: " + toString()); return String.valueOf(value); }
- public boolean asBool(){ if(!(value instanceof Boolean)) throw new UnsupportedOperationException("Not a bool: " + toString()); return (Boolean)value; }
- public Number asNumber(){ if(!(value instanceof Number)) throw new UnsupportedOperationException("Not a number: " + toString()); return ((Number)value); }
+ public String asString(){ if(!(value instanceof String) && !(value instanceof Number)) throw new UnsupportedOperationException("Not a string: " + this); return String.valueOf(value); }
+ public boolean asBool(){ if(!(value instanceof Boolean)) throw new UnsupportedOperationException("Not a bool: " + this); return (Boolean)value; }
+ public Number asNumber(){ if(!(value instanceof Number)) throw new UnsupportedOperationException("Not a number: " + this); return ((Number)value); }
public Jval get(String name){
if(name == null) throw new NullPointerException("name is null");
