Class ClassFieldDescription

    • Field Detail

      • maxRecursionLevel

        public static int maxRecursionLevel
        maximum recursion depth that is being explored default is 10: anything beyond that is typically an indication if infinite recursion
    • Constructor Detail

      • ClassFieldDescription

        public ClassFieldDescription​(java.lang.Class<?> referenceClass,
                                     boolean fullScan)
        This should be called only once with the root class as an argument
        Parameters:
        referenceClass - the root node containing further Field children
        fullScan - true if the class field should be serialised according to Serializable (ie. object's non-static and non-transient fields); false otherwise.
      • ClassFieldDescription

        protected ClassFieldDescription​(java.lang.Class<?> referenceClass,
                                        java.lang.reflect.Field field,
                                        ClassFieldDescription parent,
                                        int recursionLevel)
      • ClassFieldDescription

        public ClassFieldDescription​(java.lang.reflect.Field field,
                                     ClassFieldDescription parent,
                                     int recursionLevel,
                                     boolean fullScan)
        This should be called for individual class field members
        Parameters:
        field - Field reference for the given class member
        parent - pointer to the root/parent reference class field description
        recursionLevel - hierarchy level (i.e. '0' being the root class, '1' the sub-class etc.
        fullScan - true if the class field should be serialised according to Serializable (ie. object's non-static and non-transient fields); false otherwise.
    • Method Detail

      • allocateMemberClassField

        protected java.lang.Object allocateMemberClassField​(java.lang.Object fieldParent,
                                                            ClassFieldDescription localParent)
                                                     throws java.lang.IllegalAccessException
        Throws:
        java.lang.IllegalAccessException
      • getActualTypeArgumentNames

        public java.util.List<java.lang.String> getActualTypeArgumentNames()
        Returns:
        generic type argument name of the class (e.g. for List<String> this would return 'java.lang.String')
      • getActualTypeArguments

        public java.util.List<java.lang.Class<?>> getActualTypeArguments()
        Returns:
        generic type argument objects of the class (e.g. for List<String> this would return 'String.class')
      • getChildren

        public java.util.List<ClassFieldDescription> getChildren()
        Returns:
        the children (if any) from the super classes
      • getDataType

        public DataType getDataType()
        Returns:
        the DataType (if known) for the detected Field, DataType.OTHER in all other cases
      • getField

        public java.lang.reflect.Field getField()
        Returns:
        the underlying Field type or null if it's a root node
      • getFieldMap

        public java.util.Map<java.lang.String,​ClassFieldDescription> getFieldMap()
        Returns:
        the hashMap containing the child references by field name
      • getFieldName

        public java.lang.String getFieldName()
        Returns:
        the underlying field name
      • getFieldNameRelative

        public java.lang.String getFieldNameRelative()
        Returns:
        relative field name within class hierarchy (ie. field_level0.field_level1.variable_0)
      • getGenericFieldTypeString

        public java.lang.String getGenericFieldTypeString()
        Returns:
        field type strings (e.g. for the class Map<Integer,String> this returns '<java.lang.Integer,java.lang.String>'
      • getGenericType

        public java.lang.reflect.Type getGenericType()
      • getHierarchyDepth

        public int getHierarchyDepth()
        Returns:
        hierarchy level depth w.r.t. root object (ie. '0' being a variable in the root object)
      • getMemberClassObject

        public java.lang.Object getMemberClassObject​(java.lang.Object rootObject)
        Parameters:
        rootObject - reference to the root object
        Returns:
        the specific object link corresponding to this field
      • getModifierID

        public int getModifierID()
        Returns:
        the modifierID
      • getModifierString

        public java.lang.String getModifierString()
        Returns:
        the full modifier string (cached)
      • getParent

        public ClassFieldDescription getParent​(ClassFieldDescription field,
                                               int hierarchyLevel)
        Parameters:
        field - class Field description for which
        hierarchyLevel - the recursion level of the parent (e.g. '1' yields the immediate parent, '2' the parent of the parent etc.)
        Returns:
        the parent field reference description for the provided field
      • getType

        public java.lang.Class<?> getType()
        Returns:
        field class type
      • getTypeName

        public java.lang.String getTypeName()
        Returns:
        field class type name
      • isAbstract

        public boolean isAbstract()
        Returns:
        the isAbstract
      • isClass

        public boolean isClass()
        Returns:
        the isClass
      • isEnum

        public boolean isEnum()
        Returns:
        whether class is an Enum type
      • isFinal

        public boolean isFinal()
        Returns:
        true if the class field includes the final modifier; false otherwise.
      • isInterface

        public boolean isInterface()
        Returns:
        true if the class field is an interface
      • isNative

        public boolean isNative()
        Returns:
        the isNative
      • isPrimitive

        public boolean isPrimitive()
        Returns:
        true if the class field is a primitive type (ie. boolean, byte, ..., int, float, double)
      • isPrivate

        public boolean isPrivate()
        Returns:
        true if the class field includes the private modifier; false otherwise.
      • isProtected

        public boolean isProtected()
        Returns:
        the isProtected
      • isPublic

        public boolean isPublic()
        Returns:
        true if the class field includes the public modifier; false otherwise.
      • isRoot

        public boolean isRoot()
        Returns:
        the isRoot
      • isSerializable

        public boolean isSerializable()
        Returns:
        true if the class field should be serialised according to Serializable (ie. object's non-static and non-transient fields); false otherwise.
      • isStatic

        public boolean isStatic()
        Returns:
        true if the class field includes the static modifier; false otherwise.
      • isStrict

        public boolean isStrict()
        Returns:
        true if the class field includes the strictfp modifier; false otherwise.
      • isSynchronized

        public boolean isSynchronized()
        Returns:
        true if the class field includes the synchronized modifier; false otherwise.
      • isTransient

        public boolean isTransient()
        Returns:
        true if the class field includes the transient modifier; false otherwise.
      • isVolatile

        public boolean isVolatile()
        Returns:
        true if the class field includes the volatile modifier; false otherwise.
      • readCount

        public java.util.concurrent.atomic.AtomicInteger readCount()
        Returns:
        the readCount
      • reset

        public void reset()
        resets read and write count
      • resetReadCount

        public void resetReadCount()
        resets the read counter
      • resetWriteCount

        public void resetWriteCount()
        resets the write counter
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • writeCount

        public java.util.concurrent.atomic.AtomicInteger writeCount()
        Returns:
        the writeCount
      • dataTypeFomClassType

        protected static DataType dataTypeFomClassType​(java.lang.Class<?> classType)
        Returns the data type matching the given java class type, if any.
        Parameters:
        classType - the value to be searched
        Returns:
        the matching data type
      • exploreClass

        protected static void exploreClass​(java.lang.Class<? extends java.lang.Object> classType,
                                           ClassFieldDescription parent,
                                           int recursionLevel,
                                           boolean fullScan)