Package jodd.bean

Class BeanUtilUtil

  • All Implemented Interfaces:
    BeanUtil
    Direct Known Subclasses:
    BeanUtilBean

    abstract class BeanUtilUtil
    extends java.lang.Object
    implements BeanUtil
    Various bean property utilities that makes writings of BeanUtil classes easy.
    • Field Detail

      • isDeclared

        protected boolean isDeclared
      • isForced

        protected boolean isForced
      • isSilent

        protected boolean isSilent
    • Constructor Detail

      • BeanUtilUtil

        BeanUtilUtil()
    • Method Detail

      • convertType

        protected java.lang.Object convertType​(java.lang.Object value,
                                               java.lang.Class type)
        Converts object to destination type. Invoked before the value is set into destination. Throws TypeConversionException if conversion fails.
      • convertToCollection

        protected java.lang.Object convertToCollection​(java.lang.Object value,
                                                       java.lang.Class destinationType,
                                                       java.lang.Class componentType)
        Converter to collection.
      • invokeSetter

        protected java.lang.Object invokeSetter​(Setter setter,
                                                BeanProperty bp,
                                                java.lang.Object value)
        Invokes setter, but first converts type to match the setter type.
      • arrayForcedGet

        protected java.lang.Object arrayForcedGet​(BeanProperty bp,
                                                  java.lang.Object array,
                                                  int index)
        Returns the element of an array forced. If value is null, it will be instantiated. If not the last part of indexed bean property, array will be expanded to the index if necessary.
      • arrayForcedSet

        protected void arrayForcedSet​(BeanProperty bp,
                                      java.lang.Object array,
                                      int index,
                                      java.lang.Object value)
        Sets the array element forced. If index is greater then arrays length, array will be expanded to the index. If speed is critical, it is better to allocate an array with proper size before using this method.
      • ensureArraySize

        protected java.lang.Object ensureArraySize​(BeanProperty bp,
                                                   java.lang.Object array,
                                                   java.lang.Class componentType,
                                                   int index)
      • ensureListSize

        protected void ensureListSize​(java.util.List list,
                                      int size)
      • indexOfDot

        protected int indexOfDot​(java.lang.String name)
        Finds the very first next dot. Ignores dots between index brackets. Returns -1 when dot is not found.
      • extractIndex

        protected java.lang.String extractIndex​(BeanProperty bp)
        Extract index string from non-nested property name. If index is found, it is stripped from bean property name. If no index is found, it returns null.
      • parseInt

        protected int parseInt​(java.lang.String indexString,
                               BeanProperty bp)
      • createBeanProperty

        protected java.lang.Object createBeanProperty​(BeanProperty bp)
        Creates new instance for current property name through its setter. It uses default constructor!
      • extractGenericComponentType

        protected java.lang.Class extractGenericComponentType​(Getter getter)
        Extracts generic component type of a property. Returns Object.class when property does not have component.
      • convertIndexToMapKey

        protected java.lang.Object convertIndexToMapKey​(Getter getter,
                                                        java.lang.Object index)
        Converts Map index to key type. If conversion fails, original value will be returned.
      • extractType

        protected java.lang.Class extractType​(BeanProperty bp)
        Extracts type of current property.