Package jodd.bean

Class BeanUtilBean

    • Field Detail

      • INDEX_CHARS

        private static final char[] INDEX_CHARS
    • Constructor Detail

      • BeanUtilBean

        public BeanUtilBean()
    • Method Detail

      • declared

        public BeanUtilBean declared​(boolean declared)
        Sets the declared flag.
      • forced

        public BeanUtilBean forced​(boolean forced)
        Sets the forced flag.
      • silent

        public BeanUtilBean silent​(boolean silent)
        Sets the silent flag.
      • resolveNestedProperties

        protected void resolveNestedProperties​(BeanProperty bp)
        Resolves nested property name to the very last indexed property. If forced, null or non-existing properties will be created.
      • resolveExistingNestedProperties

        protected boolean resolveExistingNestedProperties​(BeanProperty bp)
      • hasSimpleProperty

        public boolean hasSimpleProperty​(java.lang.Object bean,
                                         java.lang.String property)
        Description copied from interface: BeanUtil
        Returns true if simple property exist.
        Specified by:
        hasSimpleProperty in interface BeanUtil
      • hasSimpleProperty

        protected boolean hasSimpleProperty​(BeanProperty bp)
      • getSimpleProperty

        public <T> T getSimpleProperty​(java.lang.Object bean,
                                       java.lang.String property)
        Description copied from interface: BeanUtil
        Reads simple property.
        Specified by:
        getSimpleProperty in interface BeanUtil
      • getSimpleProperty

        protected java.lang.Object getSimpleProperty​(BeanProperty bp)
      • setSimpleProperty

        public void setSimpleProperty​(java.lang.Object bean,
                                      java.lang.String property,
                                      java.lang.Object value)
        Description copied from interface: BeanUtil
        Sets simple property.
        Specified by:
        setSimpleProperty in interface BeanUtil
      • setSimpleProperty

        protected void setSimpleProperty​(BeanProperty bp,
                                         java.lang.Object value)
        Sets a value of simple property.
      • hasIndexProperty

        protected boolean hasIndexProperty​(BeanProperty bp)
      • getIndexProperty

        public <T> T getIndexProperty​(java.lang.Object bean,
                                      java.lang.String property,
                                      int index)
        Description copied from interface: BeanUtil
        Returns value of indexed property.
        Specified by:
        getIndexProperty in interface BeanUtil
      • getIndexProperty

        protected java.lang.Object getIndexProperty​(BeanProperty bp)
        Get non-nested property value: either simple or indexed property. If forced, missing bean will be created if possible.
      • _getIndexProperty

        private java.lang.Object _getIndexProperty​(BeanProperty bp)
      • setIndexProperty

        public void setIndexProperty​(java.lang.Object bean,
                                     java.lang.String property,
                                     int index,
                                     java.lang.Object value)
        Description copied from interface: BeanUtil
        Sets indexed property.
        Specified by:
        setIndexProperty in interface BeanUtil
      • setIndexProperty

        protected void setIndexProperty​(BeanProperty bp,
                                        java.lang.Object value)
        Sets indexed or regular properties (no nested!).
      • _setIndexProperty

        private void _setIndexProperty​(BeanProperty bp,
                                       java.lang.Object value)
      • setProperty

        public void setProperty​(java.lang.Object bean,
                                java.lang.String name,
                                java.lang.Object value)
        Description copied from interface: BeanUtil
        Sets Java Bean property.
        Specified by:
        setProperty in interface BeanUtil
        Parameters:
        bean - Java POJO bean or a Map
        name - property name
        value - property value
      • getProperty

        public <T> T getProperty​(java.lang.Object bean,
                                 java.lang.String name)
        Returns value of bean's property.
        Specified by:
        getProperty in interface BeanUtil
      • hasProperty

        public boolean hasProperty​(java.lang.Object bean,
                                   java.lang.String name)
        Description copied from interface: BeanUtil
        Returns true if bean has a property.
        Specified by:
        hasProperty in interface BeanUtil
      • hasRootProperty

        public boolean hasRootProperty​(java.lang.Object bean,
                                       java.lang.String name)
        Description copied from interface: BeanUtil
        Returns true if bean has only a root property. If yes, this means that property may be injected into the bean. If not, bean does not contain the property.
        Specified by:
        hasRootProperty in interface BeanUtil
      • getPropertyType

        public java.lang.Class<?> getPropertyType​(java.lang.Object bean,
                                                  java.lang.String name)
        Description copied from interface: BeanUtil
        Returns property type.
        Specified by:
        getPropertyType in interface BeanUtil
      • extractThisReference

        public java.lang.String extractThisReference​(java.lang.String propertyName)
        Extract the first name of this reference.
        Specified by:
        extractThisReference in interface BeanUtil