/** * Returns the specified entry value converted to a {@link String}. * * <p> * Shortcut for <code>get(String.<jk>class</jk>, key)</code>. * * @param url The key. * @return The converted value, or <jk>null</jk> if the map contains no mapping for this key. */ public String getString(String url) { return get(url, String.class); }
/** * Returns the specified entry value converted to a {@link String}. * * <p> * Shortcut for <code>get(String.<jk>class</jk>, key)</code>. * * @param url The key. * @return The converted value, or <jk>null</jk> if the map contains no mapping for this key. */ public String getString(String url) { return get(url, String.class); }
/** * Returns the specified entry value converted to a {@link String}. * * <p> * Shortcut for <code>get(String.<jk>class</jk>, key)</code>. * * @param url The key. * @return The converted value, or <jk>null</jk> if the map contains no mapping for this key. */ public String getString(String url) { return get(url, String.class); }
/** * Returns the specified entry value converted to a {@link Boolean}. * * <p> * Shortcut for <code>get(Boolean.<jk>class</jk>, key)</code>. * * @param url The key. * @return The converted value, or <jk>null</jk> if the map contains no mapping for this key. * @throws InvalidDataConversionException If value cannot be converted. */ public Boolean getBoolean(String url) { return get(url, Boolean.class); }
/** * Returns the specified entry value converted to a {@link ObjectList}. * * <p> * Shortcut for <code>get(ObjectList.<jk>class</jk>, key)</code>. * * @param url The key. * @return The converted value, or <jk>null</jk> if the map contains no mapping for this key. * @throws InvalidDataConversionException If value cannot be converted. */ public ObjectList getObjectList(String url) { return get(url, ObjectList.class); }
/** * Returns the specified entry value converted to a {@link List}. * * <p> * Shortcut for <code>get(List.<jk>class</jk>, key)</code>. * * @param url The key. * @return The converted value, or <jk>null</jk> if the map contains no mapping for this key. * @throws InvalidDataConversionException If value cannot be converted. */ public List<?> getList(String url) { return get(url, List.class); }
/** * Returns the specified entry value converted to a {@link Map}. * * <p> * Shortcut for <code>get(ObjectMap.<jk>class</jk>, key)</code>. * * @param url The key. * @return The converted value, or <jk>null</jk> if the map contains no mapping for this key. * @throws InvalidDataConversionException If value cannot be converted. */ public ObjectMap getObjectMap(String url) { return get(url, ObjectMap.class); }
/** * Returns the specified entry value converted to an {@link Integer}. * * <p> * Shortcut for <code>get(Integer.<jk>class</jk>, key)</code>. * * @param url The key. * @return The converted value, or <jk>null</jk> if the map contains no mapping for this key. * @throws InvalidDataConversionException If value cannot be converted. */ public Integer getInt(String url) { return get(url, Integer.class); }
/** * Returns the specified entry value converted to a {@link Map}. * * <p> * Shortcut for <code>get(Map.<jk>class</jk>, key)</code>. * * @param url The key. * @return The converted value, or <jk>null</jk> if the map contains no mapping for this key. * @throws InvalidDataConversionException If value cannot be converted. */ public Map<?,?> getMap(String url) { return get(url, Map.class); }
/** * Returns the specified entry value converted to a {@link Long}. * * <p> * Shortcut for <code>get(Long.<jk>class</jk>, key)</code>. * * @param url The key. * @return The converted value, or <jk>null</jk> if the map contains no mapping for this key. * @throws InvalidDataConversionException If value cannot be converted. */ public Long getLong(String url) { return get(url, Long.class); }
/** * Returns the specified entry value converted to a {@link Map}. * * <p> * Shortcut for <code>get(Map.<jk>class</jk>, key)</code>. * * @param url The key. * @return The converted value, or <jk>null</jk> if the map contains no mapping for this key. * @throws InvalidDataConversionException If value cannot be converted. */ public Map<?,?> getMap(String url) { return get(url, Map.class); }
/** * Returns the specified entry value converted to a {@link Long}. * * <p> * Shortcut for <code>get(Long.<jk>class</jk>, key)</code>. * * @param url The key. * @return The converted value, or <jk>null</jk> if the map contains no mapping for this key. * @throws InvalidDataConversionException If value cannot be converted. */ public Long getLong(String url) { return get(url, Long.class); }
/** * Returns the specified entry value converted to a {@link Boolean}. * * <p> * Shortcut for <code>get(Boolean.<jk>class</jk>, key)</code>. * * @param url The key. * @return The converted value, or <jk>null</jk> if the map contains no mapping for this key. * @throws InvalidDataConversionException If value cannot be converted. */ public Boolean getBoolean(String url) { return get(url, Boolean.class); }
/** * Returns the specified entry value converted to a {@link List}. * * <p> * Shortcut for <code>get(List.<jk>class</jk>, key)</code>. * * @param url The key. * @return The converted value, or <jk>null</jk> if the map contains no mapping for this key. * @throws InvalidDataConversionException If value cannot be converted. */ public List<?> getList(String url) { return get(url, List.class); }
/** * Same as {@link #getAt(String,Class)}, but allows for conversion to complex maps and collections. * * @param path The path to the entry. * @param type The class type. * @param args The class parameter types. * * @param <T> The class type. * @return The value, or <jk>null</jk> if the entry doesn't exist. */ public <T> T getAt(String path, Type type, Type...args) { return getPojoRest().get(path, type, args); }
/** * Returns the list of available methods that can be passed to the {@link #invokeMethod(String, String, String)} * for the object addressed by the specified URL. * * @param url The URL. * @return The list of methods. */ public Collection<String> getPublicMethods(String url) { Object o = get(url); if (o == null) return null; return session.getClassMeta(o.getClass()).getPublicMethods().keySet(); }
/** * Returns the list of available methods that can be passed to the {@link #invokeMethod(String, String, String)} * for the object addressed by the specified URL. * * @param url The URL. * @return The list of methods. */ public Collection<String> getPublicMethods(String url) { Object o = get(url); if (o == null) return null; return session.getClassMeta(o.getClass()).getPublicMethods().keySet(); }
/** * Returns the list of available methods that can be passed to the {@link #invokeMethod(String, String, String)} * for the object addressed by the specified URL. * * @param url The URL. * @return The list of methods. */ public Collection<String> getPublicMethods(String url) { Object o = get(url); if (o == null) return null; return session.getClassMeta(o.getClass()).getPublicMethods().keySet(); }
@Test public void testAddressBook() { PojoRest model; model = new PojoRest(new AddressBook()); // Try adding a person to the address book. Person billClinton = new Person("Bill Clinton", 65, new Address("55W. 125th Street", "New York", "NY", 10027, true) ); model.post("/", billClinton); // Make sure we get the original person back. billClinton = (Person)model.get("/0"); }
@Test public void testConstructors() throws Exception { PojoRest model = new PojoRest(new AddressBook(), JsonParser.DEFAULT); // Try adding a person to the address book. Person billClinton = new Person("Bill Clinton", 65, new Address("55W. 125th Street", "New York", "NY", 10027, true) ); model.post("/", billClinton); // Make sure we get the original person back. billClinton = (Person)model.get("/0"); }