/** * Return the value for the specified key from * the decorated {@link DynaBean}. * * @param key The {@link DynaBean}'s property name * @return The value for the specified property. */ public Object get(final Object key) { return getDynaBean().get(toString(key)); }
/** * Convenience method to retrieve the {@link DynaProperty}s * for this {@link DynaClass}. * * @return The an array of the {@link DynaProperty}s. */ private DynaProperty[] getDynaProperties() { return getDynaBean().getDynaClass().getDynaProperties(); }
/** * Return the value for the specified key from * the decorated {@link DynaBean}. * * @param key The {@link DynaBean}'s property name * @return The value for the specified property. */ public Object get(final Object key) { return getDynaBean().get(toString(key)); }
/** * Convenience method to retrieve the {@link DynaProperty}s * for this {@link DynaClass}. * * @return The an array of the {@link DynaProperty}s. */ private DynaProperty[] getDynaProperties() { return getDynaBean().getDynaClass().getDynaProperties(); }
/** * Returns the set of property values in the * decorated {@link DynaBean}. * * @return Unmodifiable collection of values. */ public Collection<Object> values() { final DynaProperty[] properties = getDynaProperties(); final List<Object> values = new ArrayList<Object>(properties.length); for (DynaProperty propertie : properties) { final String key = propertie.getName(); final Object value = getDynaBean().get(key); values.add(value); } return Collections.unmodifiableList(values); }
/** * Returns the set of property values in the * decorated {@link DynaBean}. * * @return Unmodifiable collection of values. */ public Collection<Object> values() { final DynaProperty[] properties = getDynaProperties(); final List<Object> values = new ArrayList<Object>(properties.length); for (DynaProperty propertie : properties) { final String key = propertie.getName(); final Object value = getDynaBean().get(key); values.add(value); } return Collections.unmodifiableList(values); }
/** * Set the value for the specified property in * the decorated {@link DynaBean}. * * @param key The {@link DynaBean}'s property name * @param value The value for the specified property. * @return The previous property's value. * @throws UnsupportedOperationException if * <code>isReadOnly()</code> is true. */ public Object put(final K key, final Object value) { if (isReadOnly()) { throw new UnsupportedOperationException("Map is read only"); } final String property = toString(key); final Object previous = getDynaBean().get(property); getDynaBean().set(property, value); return previous; }
/** * Set the value for the specified property in * the decorated {@link DynaBean}. * * @param key The {@link DynaBean}'s property name * @param value The value for the specified property. * @return The previous property's value. * @throws UnsupportedOperationException if * <code>isReadOnly()</code> is true. */ public Object put(final K key, final Object value) { if (isReadOnly()) { throw new UnsupportedOperationException("Map is read only"); } final String property = toString(key); final Object previous = getDynaBean().get(property); getDynaBean().set(property, value); return previous; }
/** * Indicate whether the {@link DynaBean} contains a specified * value for one (or more) of its properties. * * @param key The {@link DynaBean}'s property name * @return <code>true</code> if one of the {@link DynaBean}'s * properties contains a specified value. */ public boolean containsKey(final Object key) { final DynaClass dynaClass = getDynaBean().getDynaClass(); final DynaProperty dynaProperty = dynaClass.getDynaProperty(toString(key)); return (dynaProperty == null ? false : true); }
/** * Indicate whether the {@link DynaBean} contains a specified * value for one (or more) of its properties. * * @param key The {@link DynaBean}'s property name * @return <code>true</code> if one of the {@link DynaBean}'s * properties contains a specified value. */ public boolean containsKey(final Object key) { final DynaClass dynaClass = getDynaBean().getDynaClass(); final DynaProperty dynaProperty = dynaClass.getDynaProperty(toString(key)); return (dynaProperty == null ? false : true); }
/** * Indicates whether the decorated {@link DynaBean} contains * a specified value. * * @param value The value to check for. * @return <code>true</code> if one of the the {@link DynaBean}'s * properties contains the specified value, otherwise * <code>false</code>. */ public boolean containsValue(final Object value) { final DynaProperty[] properties = getDynaProperties(); for (DynaProperty propertie : properties) { final String key = propertie.getName(); final Object prop = getDynaBean().get(key); if (value == null) { if (prop == null) { return true; } } else { if (value.equals(prop)) { return true; } } } return false; }
/** * <p>Returns the Set of the property * names in the decorated {@link DynaBean}.</p> * * <p><b>N.B.</b>For {@link DynaBean}s whose associated {@link DynaClass} * is a {@link MutableDynaClass} a new Set is created every * time, otherwise the Set is created only once and cached.</p> * * @return An unmodifiable set of the {@link DynaBean}s * property names. */ public Set<K> keySet() { if (keySet != null) { return keySet; } // Create a Set of the keys final DynaProperty[] properties = getDynaProperties(); Set<K> set = new HashSet<K>(properties.length); for (DynaProperty propertie : properties) { set.add(convertKey(propertie.getName())); } set = Collections.unmodifiableSet(set); // Cache the keySet if Not a MutableDynaClass final DynaClass dynaClass = getDynaBean().getDynaClass(); if (!(dynaClass instanceof MutableDynaClass)) { keySet = set; } return set; }
/** * <p>Returns the Set of the property * names in the decorated {@link DynaBean}.</p> * * <p><b>N.B.</b>For {@link DynaBean}s whose associated {@link DynaClass} * is a {@link MutableDynaClass} a new Set is created every * time, otherwise the Set is created only once and cached.</p> * * @return An unmodifiable set of the {@link DynaBean}s * property names. */ public Set<K> keySet() { if (keySet != null) { return keySet; } // Create a Set of the keys final DynaProperty[] properties = getDynaProperties(); Set<K> set = new HashSet<K>(properties.length); for (DynaProperty propertie : properties) { set.add(convertKey(propertie.getName())); } set = Collections.unmodifiableSet(set); // Cache the keySet if Not a MutableDynaClass final DynaClass dynaClass = getDynaBean().getDynaClass(); if (!(dynaClass instanceof MutableDynaClass)) { keySet = set; } return set; }
/** * Indicates whether the decorated {@link DynaBean} contains * a specified value. * * @param value The value to check for. * @return <code>true</code> if one of the the {@link DynaBean}'s * properties contains the specified value, otherwise * <code>false</code>. */ public boolean containsValue(final Object value) { final DynaProperty[] properties = getDynaProperties(); for (DynaProperty propertie : properties) { final String key = propertie.getName(); final Object prop = getDynaBean().get(key); if (value == null) { if (prop == null) { return true; } } else { if (value.equals(prop)) { return true; } } } return false; }
/** * <p>Returns the Set of the property/value mappings * in the decorated {@link DynaBean}.</p> * * <p>Each element in the Set is a <code>Map.Entry</code> * type.</p> * * @return An unmodifiable set of the DynaBean * property name/value pairs */ public Set<Map.Entry<K, Object>> entrySet() { final DynaProperty[] properties = getDynaProperties(); final Set<Map.Entry<K, Object>> set = new HashSet<Map.Entry<K, Object>>(properties.length); for (DynaProperty propertie : properties) { final K key = convertKey(propertie.getName()); final Object value = getDynaBean().get(propertie.getName()); set.add(new MapEntry<K>(key, value)); } return Collections.unmodifiableSet(set); }
/** * <p>Returns the Set of the property/value mappings * in the decorated {@link DynaBean}.</p> * * <p>Each element in the Set is a <code>Map.Entry</code> * type.</p> * * @return An unmodifiable set of the DynaBean * property name/value pairs */ public Set<Map.Entry<K, Object>> entrySet() { final DynaProperty[] properties = getDynaProperties(); final Set<Map.Entry<K, Object>> set = new HashSet<Map.Entry<K, Object>>(properties.length); for (DynaProperty propertie : properties) { final K key = convertKey(propertie.getName()); final Object value = getDynaBean().get(propertie.getName()); set.add(new MapEntry<K>(key, value)); } return Collections.unmodifiableSet(set); }
/** * Convenience method to retrieve the {@link DynaProperty}s * for this {@link DynaClass}. * * @return The an array of the {@link DynaProperty}s. */ private DynaProperty[] getDynaProperties() { return getDynaBean().getDynaClass().getDynaProperties(); }
/** * Return the value for the specified key from * the decorated {@link DynaBean}. * * @param key The {@link DynaBean}'s property name * @return The value for the specified property. */ public Object get(final Object key) { return getDynaBean().get(toString(key)); }
/** * Returns the set of property values in the * decorated {@link DynaBean}. * * @return Unmodifiable collection of values. */ public Collection<Object> values() { final DynaProperty[] properties = getDynaProperties(); final List<Object> values = new ArrayList<Object>(properties.length); for (DynaProperty propertie : properties) { final String key = propertie.getName(); final Object value = getDynaBean().get(key); values.add(value); } return Collections.unmodifiableList(values); }
/** * Indicate whether the {@link DynaBean} contains a specified * value for one (or more) of its properties. * * @param key The {@link DynaBean}'s property name * @return <code>true</code> if one of the {@link DynaBean}'s * properties contains a specified value. */ public boolean containsKey(final Object key) { final DynaClass dynaClass = getDynaBean().getDynaClass(); final DynaProperty dynaProperty = dynaClass.getDynaProperty(toString(key)); return (dynaProperty == null ? false : true); }