类 BeanMap

  • 所有已实现的接口:
    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).
    作者:
    Chris Nokleberg
    • 嵌套类概要

      嵌套类 
      修饰符和类型 说明
      static class  BeanMap.Generator  
      • 从接口继承的嵌套类/接口 java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • 字段概要

      字段 
      修饰符和类型 字段 说明
      protected java.lang.Object bean  
      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.
    • 构造器概要

      构造器 
      限定符 构造器 说明
      protected BeanMap()  
      protected BeanMap​(java.lang.Object bean)  
    • 方法概要

      所有方法 静态方法 实例方法 抽象方法 具体方法 
      修饰符和类型 方法 说明
      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()  
      • 从类继承的方法 java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • 从接口继承的方法 java.util.Map

        compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll
    • 构造器详细资料

      • BeanMap

        protected BeanMap()
      • BeanMap

        protected BeanMap​(java.lang.Object bean)
    • 方法详细资料

      • 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.
        参数:
        bean - the JavaBean underlying the map
        返回:
        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.
        参数:
        bean - the JavaBean underlying the map
        返回:
        a new BeanMap instance
      • getPropertyType

        public abstract java.lang.Class getPropertyType​(java.lang.String name)
        Get the type of a property.
        参数:
        name - the name of the JavaBean property
        返回:
        the type of the property, or null if the property does not exist
      • get

        public java.lang.Object get​(java.lang.Object key)
        指定者:
        get 在接口中 java.util.Map
      • put

        public java.lang.Object put​(java.lang.Object key,
                                    java.lang.Object value)
        指定者:
        put 在接口中 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.
        参数:
        bean - the bean to query; must be compatible with the type of this BeanMap
        key - must be a String
        返回:
        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.
        参数:
        key - must be a String
        返回:
        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.
        参数:
        bean - the new JavaBean
        另请参阅:
        getBean()
      • getBean

        public java.lang.Object getBean()
        Return the bean currently in use by this map.
        返回:
        the current JavaBean
        另请参阅:
        setBean(java.lang.Object)
      • clear

        public void clear()
        指定者:
        clear 在接口中 java.util.Map
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        指定者:
        containsKey 在接口中 java.util.Map
      • containsValue

        public boolean containsValue​(java.lang.Object value)
        指定者:
        containsValue 在接口中 java.util.Map
      • size

        public int size()
        指定者:
        size 在接口中 java.util.Map
      • isEmpty

        public boolean isEmpty()
        指定者:
        isEmpty 在接口中 java.util.Map
      • remove

        public java.lang.Object remove​(java.lang.Object key)
        指定者:
        remove 在接口中 java.util.Map
      • putAll

        public void putAll​(java.util.Map t)
        指定者:
        putAll 在接口中 java.util.Map
      • equals

        public boolean equals​(java.lang.Object o)
        指定者:
        equals 在接口中 java.util.Map
        覆盖:
        equals 在类中 java.lang.Object
      • hashCode

        public int hashCode()
        指定者:
        hashCode 在接口中 java.util.Map
        覆盖:
        hashCode 在类中 java.lang.Object
      • entrySet

        public java.util.Set entrySet()
        指定者:
        entrySet 在接口中 java.util.Map
      • values

        public java.util.Collection values()
        指定者:
        values 在接口中 java.util.Map
      • toString

        public java.lang.String toString()
        覆盖:
        toString 在类中 java.lang.Object