public Object toJava(JSONValue aValue, Class aRequestedClass) throws MapperException { if (!aValue.isString()) throw new MapperException("CharacterMapper cannot map class: " + aValue.getClass().getName()); final String lRepr = ((JSONString) aValue).getValue(); if(lRepr.length() != 1) throw new MapperException("CharacterMapper cannot map value: " + lRepr); return lRepr.charAt(0); } }
public Object parseValue(JSONObject aObjectElement, JSONMarshall aMarshall, HashMap aPool) throws MarshallException { JSONMarshall.requireStringAttribute(aObjectElement, JSONMarshall.RNDR_ATTR_VALUE); return Color.decode(((JSONString) aObjectElement.get(JSONMarshall.RNDR_ATTR_VALUE)).getValue()); }
public Object parseValue(JSONObject aObjectElement, JSONMarshall aMarshall, HashMap aPool) throws MarshallException { JSONMarshall.requireStringAttribute(aObjectElement, JSONMarshall.RNDR_ATTR_VALUE); return new BigDecimal(((JSONString) aObjectElement.get(JSONMarshall.RNDR_ATTR_VALUE)).getValue()); }
public Object parseValue(JSONObject aObjectElement, JSONMarshall aMarshall, HashMap aPool) throws MarshallException { JSONMarshall.requireStringAttribute(aObjectElement, JSONMarshall.RNDR_ATTR_VALUE); return new BigInteger(((JSONString) aObjectElement.get(JSONMarshall.RNDR_ATTR_VALUE)).getValue()); }
public Object parseValue(JSONObject aObjectElement, JSONMarshall aMarshall, HashMap aPool) throws MarshallException { JSONMarshall.requireStringAttribute(aObjectElement, JSONMarshall.RNDR_ATTR_VALUE); return new Long(((JSONString) aObjectElement.get(JSONMarshall.RNDR_ATTR_VALUE)).getValue()); }
public Object parseValue(JSONObject aObjectValue, JSONMarshall aMarshall, HashMap aPool) throws MarshallException { JSONMarshall.requireStringAttribute(aObjectValue, JSONMarshall.RNDR_ATTR_VALUE); return new Float(((JSONString) aObjectValue.get(JSONMarshall.RNDR_ATTR_VALUE)).getValue()); }
public Object parseValue(JSONObject aObjectElement, JSONMarshall aMarshall, HashMap aPool) throws MarshallException { JSONMarshall.requireStringAttribute(aObjectElement, JSONMarshall.RNDR_ATTR_VALUE); return new Integer(((JSONString) aObjectElement.get(JSONMarshall.RNDR_ATTR_VALUE)).getValue()); }
public Object parseValue(JSONObject aObjectElement, JSONMarshall aMarshall, HashMap aPool) throws MarshallException { JSONMarshall.requireStringAttribute(aObjectElement, JSONMarshall.RNDR_ATTR_VALUE); return new Double(((JSONString) aObjectElement.get(JSONMarshall.RNDR_ATTR_VALUE)).getValue()); }
public Object parseValue(JSONObject aObjectElement, JSONMarshall aMarshall, HashMap aPool) throws MarshallException { JSONMarshall.requireStringAttribute(aObjectElement, JSONMarshall.RNDR_ATTR_VALUE); return new Byte(((JSONString) aObjectElement.get(JSONMarshall.RNDR_ATTR_VALUE)).getValue()); }
public Object parseValue(JSONObject aObjectElement, JSONMarshall aMarshall, HashMap aPool) throws MarshallException { JSONMarshall.requireStringAttribute(aObjectElement, JSONMarshall.RNDR_ATTR_VALUE); return new Short(((JSONString) aObjectElement.get(JSONMarshall.RNDR_ATTR_VALUE)).getValue()); }
public Object parseValue(JSONObject aObjectElement, JSONMarshall aMarshall, HashMap aPool) throws MarshallException { JSONMarshall.requireStringAttribute(aObjectElement, JSONMarshall.RNDR_ATTR_VALUE); return Boolean.valueOf(((JSONString) aObjectElement.get(JSONMarshall.RNDR_ATTR_VALUE)).getValue()); }
public Object toJava(JSONValue aValue, Class aRequestedClass) throws MapperException { if (!aValue.isString()) throw new MapperException("DateMapper cannot map class: " + aValue.getClass().getName()); if(DateMapper.isTimeZoneIgnored()) return fromISO8601(((JSONString) aValue).getValue().trim()); else return fromISO8601(((JSONString) aValue).getValue().trim(),false); } //Created on 5/12/2006 by Changdong Li
public Object parseValue(JSONObject aObjectElement, JSONMarshall aMarshall, HashMap aPool) throws MarshallException { JSONMarshall.requireStringAttribute(aObjectElement, JSONMarshall.RNDR_ATTR_VALUE); return ((JSONString) aObjectElement.get(JSONMarshall.RNDR_ATTR_VALUE)).getValue(); }
public Object parseValue(JSONObject aObjectElement, JSONMarshall aMarshall, HashMap aPool) throws MarshallException { JSONMarshall.requireStringAttribute(aObjectElement, JSONMarshall.RNDR_ATTR_VALUE); try { return dateFormat.parse(((JSONString) aObjectElement.get(JSONMarshall.RNDR_ATTR_VALUE)).getValue().trim()); } catch(Exception e) { throw new MarshallException(e.getMessage()); } }
public Object parseValue(JSONObject aObjectElement, JSONMarshall aMarshall, HashMap aPool) throws MarshallException { JSONMarshall.requireStringAttribute(aObjectElement, JSONMarshall.RNDR_ATTR_VALUE); final String lValue = ((JSONString) aObjectElement.get(JSONMarshall.RNDR_ATTR_VALUE)).getValue(); if(lValue.length() < 1) throw new MarshallException("Length of value too short: " + lValue); return lValue.charAt(0); }
public void validate(JSONValue aValue) throws ValidationException { if(!aValue.isString()) fail("The value is not a JSONString." ,aValue); final String lString = ((JSONString) aValue).getValue(); Matcher lMatcher = pattern.matcher(lString); if(!lMatcher.matches()) { fail("The string: \"" + lString + "\" does not match the pattern: \"" + representation + "\".", aValue); } } }
public Ref(String aName, JSONObject aRule, HashMap<String,Validator> aRuleset) throws ValidationException { super(aName, aRule); ruleset = aRuleset; ValidatorUtil.requiresAttribute(aRule, ValidatorUtil.PARAM_REF, JSONString.class); ref = ((JSONString) aRule.get(ValidatorUtil.PARAM_REF)).getValue(); }
public Object toJava(JSONValue aValue, Class aRequestedClass) throws MapperException { if(aValue.isString()) { return Boolean.parseBoolean(((JSONString)aValue).getValue()); } else if(aValue.isBoolean()) { return ((JSONBoolean) aValue).getValue(); } else throw new MapperException("BooleanMapper cannot map: " + aValue.getClass().getName()); }
public Object toJava(JSONValue aValue, Class aRequestedClass) throws MapperException { //lenient to the data to be converted. if(aValue.isDecimal()) return ((JSONDecimal)aValue).getValue().toString(); if(aValue.isInteger()) return ((JSONInteger)aValue).getValue().toString(); if (!aValue.isString()) throw new MapperException("StringMapper cannot map class: " + aValue.getClass().getName()); return ((JSONString) aValue).getValue(); } }
public Object parseValue(JSONObject aObjectElement, JSONMarshall aMarshall, HashMap aPool) throws MarshallException { JSONMarshall.requireStringAttribute(aObjectElement, JSONMarshall.RNDR_ATTR_VALUE); return Font.decode(((JSONString) aObjectElement.get(JSONMarshall.RNDR_ATTR_VALUE)).getValue()); }