Package jodd.bean

Class BeanUtilBean

All Implemented Interfaces:
BeanUtil

public class BeanUtilBean extends BeanUtilUtil implements BeanUtil
Instantiable version of BeanUtil.
  • Field Details

    • INDEX_CHARS

      private static final char[] INDEX_CHARS
  • Constructor Details

    • BeanUtilBean

      public BeanUtilBean()
  • Method Details

    • 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(Object bean, 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(Object bean, String property)
      Description copied from interface: BeanUtil
      Reads simple property.
      Specified by:
      getSimpleProperty in interface BeanUtil
    • getSimpleProperty

      protected Object getSimpleProperty(BeanProperty bp)
    • setSimpleProperty

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

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

      protected boolean hasIndexProperty(BeanProperty bp)
    • getIndexProperty

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

      protected 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 Object _getIndexProperty(BeanProperty bp)
    • setIndexProperty

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

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

      private void _setIndexProperty(BeanProperty bp, Object value)
    • setProperty

      public void setProperty(Object bean, String name, 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(Object bean, String name)
      Returns value of bean's property.
      Specified by:
      getProperty in interface BeanUtil
    • hasProperty

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

      public boolean hasRootProperty(Object bean, 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 Class<?> getPropertyType(Object bean, String name)
      Description copied from interface: BeanUtil
      Returns property type.
      Specified by:
      getPropertyType in interface BeanUtil
    • extractThisReference

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