BeanMap (cglib (Version 2.2.2))
Date: 2012-11-18

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.cglib.beans
Class BeanMap

    java.lang.Object
      net.sf.cglib.beans.BeanMap

All Implemented Interfaces:
  java.util.Map

    public abstract class BeanMap

extends java.lang.Object
implements java.util.Map

A `Map`-based view of a JavaBean. The default set of keys is the union of all property names (getters or setters). An attempt to set a read-only property will be ignored, and write-only properties will be returned as `null`. Removal of objects is not a supported (the key set is fixed).

Author:
  Chris Nokleberg

Nested Class Summary
`static class` | `BeanMap.Generator`

Nested classes/interfaces inherited from interface java.util.Map
`java.util.Map.Entry<K,V>`

Field Summary
`static int` | `REQUIRE_GETTER` Limit the properties reflected in the key set of the map to readable properties.
`static int` | `REQUIRE_SETTER` Limit the properties reflected in the key set of the map to writable properties.

Method Summary
`void` | `clear()`
`boolean` | `containsKey(java.lang.Object key)`
`boolean` | `containsValue(java.lang.Object value)`
`static BeanMap` | `create(java.lang.Object bean)` Helper method to create a new `BeanMap`.
`java.util.Set` | `entrySet()`
`boolean` | `equals(java.lang.Object o)`
`java.lang.Object` | `get(java.lang.Object key)`
`abstract java.lang.Object` | `get(java.lang.Object bean, java.lang.Object key)` Get the property of a bean.
`java.lang.Object` | `getBean()` Return the bean currently in use by this map.
`abstract java.lang.Class` | `getPropertyType(java.lang.String name)` Get the type of a property.
`int` | `hashCode()`
`boolean` | `isEmpty()`
`abstract BeanMap` | `newInstance(java.lang.Object bean)` Create a new `BeanMap` instance using the specified bean.
`java.lang.Object` | `put(java.lang.Object key, java.lang.Object value)`
`abstract java.lang.Object` | `put(java.lang.Object bean, java.lang.Object key, java.lang.Object value)` Set the property of a bean.
`void` | `putAll(java.util.Map t)`
`java.lang.Object` | `remove(java.lang.Object key)`
`void` | `setBean(java.lang.Object bean)` Change the underlying bean this map should use.
`int` | `size()`
`java.lang.String` | `toString()`
`java.util.Collection` | `values()`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Map
`keySet`

Field Detail

### REQUIRE_GETTER

    public static final int REQUIRE_GETTER

  Limit the properties reflected in the key set of the map to readable properties.

  See Also:
    `BeanMap.Generator.setRequire(int)`, Constant Field Values

### REQUIRE_SETTER

    public static final int REQUIRE_SETTER

  Limit the properties reflected in the key set of the map to writable properties.

  See Also:
    `BeanMap.Generator.setRequire(int)`, Constant Field Values

Method Detail

### create

    public static BeanMap create(java.lang.Object bean)

  Helper method to create a new `BeanMap`. For finer control over the generated instance, use a new instance of `BeanMap.Generator` instead of this static method.

  Parameters:
    `bean` - the JavaBean underlying the map
  Returns:
    a new `BeanMap` instance

### newInstance

    public abstract BeanMap newInstance(java.lang.Object bean)

  Create a new `BeanMap` instance using the specified bean. This is faster than using the `create(java.lang.Object)` static method.

  Parameters:
    `bean` - the JavaBean underlying the map
  Returns:
    a new `BeanMap` instance

### getPropertyType

    public abstract java.lang.Class getPropertyType(java.lang.String name)

  Get the type of a property.

  Parameters:
    `name` - the name of the JavaBean property
  Returns:
    the type of the property, or null if the property does not exist

### get

    public java.lang.Object get(java.lang.Object key)

  Specified by:
    `get` in interface `java.util.Map`

### put

    public java.lang.Object put(java.lang.Object key,
                                java.lang.Object value)

  Specified by:
    `put` in interface `java.util.Map`

### get

    public abstract java.lang.Object get(java.lang.Object bean,
                                         java.lang.Object key)

  Get the property of a bean. This allows a `BeanMap` to be used statically for multiple beans--the bean instance tied to the map is ignored and the bean passed to this method is used instead.

  Parameters:
    `bean` - the bean to query; must be compatible with the type of this `BeanMap`
    `key` - must be a String
  Returns:
    the current value, or null if there is no matching property

### put

    public abstract java.lang.Object put(java.lang.Object bean,
                                         java.lang.Object key,
                                         java.lang.Object value)

  Set the property of a bean. This allows a `BeanMap` to be used statically for multiple beans--the bean instance tied to the map is ignored and the bean passed to this method is used instead.

  Parameters:
    `key` - must be a String
  Returns:
    the old value, if there was one, or null

### setBean

    public void setBean(java.lang.Object bean)

  Change the underlying bean this map should use.

  Parameters:
    `bean` - the new JavaBean
  See Also:
    `getBean()`

### getBean

    public java.lang.Object getBean()

  Return the bean currently in use by this map.

  Returns:
    the current JavaBean
  See Also:
    `setBean(java.lang.Object)`

### clear

    public void clear()

  Specified by:
    `clear` in interface `java.util.Map`

### containsKey

    public boolean containsKey(java.lang.Object key)

  Specified by:
    `containsKey` in interface `java.util.Map`

### containsValue

    public boolean containsValue(java.lang.Object value)

  Specified by:
    `containsValue` in interface `java.util.Map`

### size

    public int size()

  Specified by:
    `size` in interface `java.util.Map`

### isEmpty

    public boolean isEmpty()

  Specified by:
    `isEmpty` in interface `java.util.Map`

### remove

    public java.lang.Object remove(java.lang.Object key)

  Specified by:
    `remove` in interface `java.util.Map`

### putAll

    public void putAll(java.util.Map t)

  Specified by:
    `putAll` in interface `java.util.Map`

### equals

    public boolean equals(java.lang.Object o)

  Specified by:
    `equals` in interface `java.util.Map`
  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in interface `java.util.Map`
  Overrides:
    `hashCode` in class `java.lang.Object`

### entrySet

    public java.util.Set entrySet()

  Specified by:
    `entrySet` in interface `java.util.Map`

### values

    public java.util.Collection values()

  Specified by:
    `values` in interface `java.util.Map`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2001 - Apache Software Foundation