Class AbstractMapper

    • Constructor Detail

      • AbstractMapper

        public AbstractMapper()
    • Method Detail

      • doPrivileged

        protected <T> T doPrivileged​(Supplier<T> block)
        Perform an action in a privileged block.
        Type Parameters:
        T - the return type
        Parameters:
        block - the lambda to executed in privileged.
        Returns:
        the result of the privileged call, may be null
      • getValueFromObject

        protected <T> T getValueFromObject​(PropertyData propertyData,
                                           Object object,
                                           ServiceRegistry serviceRegistry)
        Get a value from the specified object.
        Type Parameters:
        T - the return type
        Parameters:
        propertyData - the property data, should not be null
        object - the object for which the value should be read, should not be null
        serviceRegistry - the service registry, should not be null
        Returns:
        the value read from the object, may be null
      • getValueFromObject

        protected <T> T getValueFromObject​(String propertyName,
                                           String accessType,
                                           Object object,
                                           ServiceRegistry serviceRegistry)
        Get a value from the specified object.
        Type Parameters:
        T - the return type
        Parameters:
        propertyName - the property name, should not be null
        accessType - the property access type, should not be null
        object - the object for hwich the value should be read, should not be null
        serviceRegistry - the service registry, should not be null
        Returns:
        the value read from the object, may be null
      • setValueOnObject

        protected void setValueOnObject​(PropertyData propertyData,
                                        Object object,
                                        Object value,
                                        ServiceRegistry serviceRegistry)
        Set the specified value on the object.
        Parameters:
        propertyData - the property data, should not be null
        object - the object for which the value should be set, should not be null
        value - the value ot be set, may be null
        serviceRegistry - the service registry, should not be null
      • getAndSetValue

        protected void getAndSetValue​(PropertyData propertyData,
                                      Object source,
                                      Object destination,
                                      ServiceRegistry serviceRegistry)
        Gets the value from the source object and sets the value in the destination object.
        Parameters:
        propertyData - the property data, should not be null
        source - the source object, should not be null
        destination - the destination object, should not be null
        serviceRegistry - the service registry, should not be null
      • newObjectInstance

        protected <T> T newObjectInstance​(Class<T> clazz,
                                          Object... args)
        Creates a new object based on the specified class with the given constructor arguments.
        Type Parameters:
        T - the return class type
        Parameters:
        clazz - the class, must not be null
        args - the variadic constructor arguments, may be omitted.
        Returns:
        a new instance of the class