package info.vividcode.util.json;

import java.math.BigDecimal;

public class JsonNumber implements JsonValue {
	
	
	private BigDecimal val;
	
	public JsonNumber( BigDecimal val ) {
		this.val = val;
	}
	
	public JsonNumber( double val ) {
		this.val = new BigDecimal( val );
	}

	@Override
	public ValueType valueType() {
		return ValueType.NUMBER_VALUE;
	}

	@Override
	public JsonArray arrayValue() {
		// TODO Auto-generated method stub
		throw new RuntimeException();
	}

	@Override
	public JsonObject objectValue() {
		// TODO Auto-generated method stub
		throw new RuntimeException();
	}

	@Override
	public BigDecimal numberValue() {
		// TODO Auto-generated method stub
		return val;
	}

	@Override
	public String stringValue() {
		// TODO Auto-generated method stub
		throw new RuntimeException();
	}
	
	@Override
	public boolean booleanValue() {
		// TODO Auto-generated method stub
		throw new RuntimeException();
	}
	
	@Override
	public String toString() {
		return "[JSON number : " + val.toString() + "]";
	}

}

@@ -105,17 +105,133 @@
 Value %7B%0A
-%09
+%0A%09private static final String CLASS_NAME  = %22JsonNumber%22;%0A%09private static final String METHOD_NAME = %22numberValue()%22;
 %0A%09%0A%09priv
@@ -519,191 +519,427 @@
 %7B%0A%09%09
-// TODO Auto-generated method stub%0A%09%09throw new RuntimeException();%0A%09%7D%0A%0A%09@Override%0A%09public JsonObject objectValue() %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09throw new RuntimeException(
+throw new UnsupportedOperationException( %0A%09%09%09%09%22This object is a %22 + CLASS_NAME + %22 object. %22 +%0A%09%09%09%09%22if you want to get the value, please use the %22 + METHOD_NAME + %22 method instead.%22 );%0A%09%7D%0A%0A%09@Override%0A%09public JsonObject objectValue() %7B%0A%09%09throw new UnsupportedOperationException( %0A%09%09%09%09%22This object is a %22 + CLASS_NAME + %22 object. %22 +%0A%09%09%09%09%22if you want to get the value, please use the %22 + METHOD_NAME + %22 method instead.%22 
 );%0A%09
@@ -991,45 +991,8 @@
 ) %7B%0A
-%09%09// TODO Auto-generated method stub%0A
 %09%09re
@@ -1053,190 +1053,426 @@
 %7B%0A%09%09
-// TODO Auto-generated method stub%0A%09%09throw new RuntimeException();%0A%09%7D%0A%09%0A%09@Override%0A%09public boolean booleanValue() %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09throw new RuntimeException(
+throw new UnsupportedOperationException( %0A%09%09%09%09%22This object is a %22 + CLASS_NAME + %22 object. %22 +%0A%09%09%09%09%22if you want to get the value, please use the %22 + METHOD_NAME + %22 method instead.%22 );%0A%09%7D%0A%09%0A%09@Override%0A%09public boolean booleanValue() %7B%0A%09%09throw new UnsupportedOperationException( %0A%09%09%09%09%22This object is a %22 + CLASS_NAME + %22 object. %22 +%0A%09%09%09%09%22if you want to get the value, please use the %22 + METHOD_NAME + %22 method instead.%22 
 );%0A%09

change the type of the exception that may occur in the JsonValues' value...change the type of the exception that may occur in the JsonNumber's value-getter method