@Override public Term fromJSONObject(Object parsed) throws MarshalException { try { if (parsed instanceof String) return new Constants.Value(fromString((String) parsed)); else return new Constants.Value(getSerializer().serialize(((Number) parsed).doubleValue())); } catch (ClassCastException exc) { throw new MarshalException(String.format( "Expected a double value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed)); } }
@Override public Term fromJSONObject(Object parsed) throws MarshalException { try { if (parsed instanceof String) return new Constants.Value(fromString((String) parsed)); else return new Constants.Value(getSerializer().serialize(((Number) parsed).doubleValue())); } catch (ClassCastException exc) { throw new MarshalException(String.format( "Expected a double value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed)); } }
@Override public Term fromJSONObject(Object parsed) throws MarshalException { try { if (parsed instanceof String) return new Constants.Value(fromString((String) parsed)); else return new Constants.Value(getSerializer().serialize(((Number) parsed).doubleValue())); } catch (ClassCastException exc) { throw new MarshalException(String.format( "Expected a double value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed)); } }
@Override public Term fromJSONObject(Object parsed) throws MarshalException { try { if (parsed instanceof String) return new Constants.Value(fromString((String) parsed)); else return new Constants.Value(getSerializer().serialize(((Number) parsed).doubleValue())); } catch (ClassCastException exc) { throw new MarshalException(String.format( "Expected a double value, but got a %s: %s", parsed.getClass().getSimpleName(), parsed)); } }