@Override public A apply(Object o) { return cast(o, ev); } };
@Override public A apply(Object o) { return cast(o, ev); } };
/** * Get mandatory value of type <code>ev</code>. * * @return the requested value if it exists and has the required type * @deprecated */ public <A> A get(Class<A> ev, String key) { final Object v = json.get(key); if (v != null) { try { return cast(v, ev); } catch (ClassCastException e) { throw new RuntimeException(format("Key %s has not required type %s but %s", key, ev.getName(), v.getClass() .getName())); } } else { throw new RuntimeException(format("Key %s does not exist", key)); } }
/** * Get optional value of type <code>ev</code>. * * @return some if the value exists and has the required type, none otherwise * @deprecated */ public <A> Option<A> opt(Class<A> ev, String key) { final Object v = json.get(key); if (v != null) { try { return some(cast(v, ev)); } catch (ClassCastException e) { return none(); } } else { return none(); } }