Class DefaultPropertyValueService

  • All Implemented Interfaces:
    PropertyValueService

    public class DefaultPropertyValueService
    extends java.lang.Object
    implements PropertyValueService
    Default implementation of service for reading and setting property values of an object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean canProcessValueMap​(java.util.Map valueMap, java.lang.String propertyQualifier)  
      protected PropertyReadResult createPropertyResult​(java.lang.Object sourceObject, java.util.List<java.util.Locale> locales, java.lang.String qualifier)  
      protected ExpressionResolverFactory getResolverFactory()  
      protected ExpressionResolverFactory getRestrictedResolverFactory()  
      protected PropertyReadResult handleEvaluationException​(org.springframework.expression.spel.SpelEvaluationException e)  
      PropertyReadResult readRestrictedValue​(java.lang.Object sourceObject, java.lang.String propertyQualifier)
      Read property value from source object.
      java.util.Map<java.util.Locale,​PropertyReadResult> readRestrictedValue​(java.lang.Object sourceObject, java.lang.String qualifier, java.util.List<java.util.Locale> locales)
      Read localized qualifier values from source object.
      java.util.Map<java.lang.String,​PropertyReadResult> readRestrictedValues​(java.lang.Object sourceObject, java.util.List<java.lang.String> propertyQualifiers)
      Read property values from source object.
      java.util.Map<java.lang.String,​PropertyReadResult> readRestrictedValues​(java.lang.Object sourceObject, java.util.List<java.lang.String> qualifiers, java.util.List<java.util.Locale> locales)
      Read qualifiers values from the source object.
      java.lang.Object readValue​(java.lang.Object sourceObject, java.lang.String qualifier)
      Calls the readValues method and return a value of an attribute.
      java.util.Map<java.util.Locale,​java.lang.Object> readValue​(java.lang.Object sourceObject, java.lang.String qualifier, java.util.List<java.util.Locale> locales)
      Read localized qualifier values from source object.
      java.util.Map<java.lang.String,​java.lang.Object> readValues​(java.lang.Object sourceObject, java.util.List<java.lang.String> qualifiers)
      Calls the readValues method and return a map of attributes and the corresponding value of each attribute.
      java.util.Map<java.lang.String,​java.lang.Object> readValues​(java.lang.Object sourceObject, java.util.List<java.lang.String> qualifiers, java.util.List<java.util.Locale> locales)
      Read qualifiers values from the source object.
      void setLocalizedValue​(java.lang.Object sourceObject, java.lang.String propertyQualifier, java.lang.Object value, java.util.Locale locale)
      Sets the value for the specified property and locale.
      void setResolverFactory​(ExpressionResolverFactory resolverFactory)  
      void setRestrictedResolverFactory​(ExpressionResolverFactory restrictedResolverFactory)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultPropertyValueService

        public DefaultPropertyValueService()
    • Method Detail

      • setLocalizedValue

        public void setLocalizedValue​(java.lang.Object sourceObject,
                                      java.lang.String propertyQualifier,
                                      java.lang.Object value,
                                      java.util.Locale locale)
        Description copied from interface: PropertyValueService
        Sets the value for the specified property and locale. Assumes the the object has a setter with a Locale as second argument for the given property.
        Specified by:
        setLocalizedValue in interface PropertyValueService
        Parameters:
        sourceObject - a object to write a property with given qualifier and locale
        propertyQualifier - qualifier of property value to set
        value - value to set
        locale - locale for property value
      • readValue

        public java.lang.Object readValue​(java.lang.Object sourceObject,
                                          java.lang.String qualifier)
        Calls the readValues method and return a value of an attribute.
        Specified by:
        readValue in interface PropertyValueService
        Parameters:
        sourceObject - object to read from
        qualifier - property qualifier to read
        Returns:
        corresponding property value.
      • readValues

        public java.util.Map<java.lang.String,​java.lang.Object> readValues​(java.lang.Object sourceObject,
                                                                                 java.util.List<java.lang.String> qualifiers)
        Calls the readValues method and return a map of attributes and the corresponding value of each attribute.
        Specified by:
        readValues in interface PropertyValueService
        Parameters:
        sourceObject - object to read from
        qualifiers - a list of property qualifiers to read
        Returns:
        map contains all property qualifiers with corresponding values.
      • readRestrictedValue

        public PropertyReadResult readRestrictedValue​(java.lang.Object sourceObject,
                                                      java.lang.String propertyQualifier)
        Description copied from interface: PropertyValueService
        Read property value from source object. Property is first check, whether user may read it.
        Specified by:
        readRestrictedValue in interface PropertyValueService
        Parameters:
        sourceObject - object to read from
        propertyQualifier - property qualifier to read
        Returns:
        corresponding property read result.
      • readRestrictedValues

        public java.util.Map<java.lang.String,​PropertyReadResult> readRestrictedValues​(java.lang.Object sourceObject,
                                                                                             java.util.List<java.lang.String> propertyQualifiers)
        Description copied from interface: PropertyValueService
        Read property values from source object. Every property is first check, whether user may read it.
        Specified by:
        readRestrictedValues in interface PropertyValueService
        Parameters:
        sourceObject - object to read from
        propertyQualifiers - a list of property qualifiers to read
        Returns:
        map contains all property qualifiers with corresponding read result.
      • readValue

        public java.util.Map<java.util.Locale,​java.lang.Object> readValue​(java.lang.Object sourceObject,
                                                                                java.lang.String qualifier,
                                                                                java.util.List<java.util.Locale> locales)
        Description copied from interface: PropertyValueService
        Read localized qualifier values from source object. The returning map holds a locale as key and the value of this map holds the corresponding localized value of the property.
        Specified by:
        readValue in interface PropertyValueService
        Parameters:
        sourceObject - object to read from
        qualifier - property qualifier to read
        locales - a list of locales to read
        Returns:
        map where the key holds a @Locale object and the value of this map holds the corresponding value of the qualifier.
      • readRestrictedValue

        public java.util.Map<java.util.Locale,​PropertyReadResult> readRestrictedValue​(java.lang.Object sourceObject,
                                                                                            java.lang.String qualifier,
                                                                                            java.util.List<java.util.Locale> locales)
        Description copied from interface: PropertyValueService
        Read localized qualifier values from source object. Every property is first check, whether user may read it. The returning map holds a locale as key and the value of this map holds the corresponding localized value of the property.
        Specified by:
        readRestrictedValue in interface PropertyValueService
        Parameters:
        sourceObject - object to read from
        qualifier - property qualifier to read
        locales - a list of locales to read
        Returns:
        map where the key holds a @Locale object and the value of this map holds the corresponding value of the qualifier.
      • canProcessValueMap

        protected boolean canProcessValueMap​(java.util.Map valueMap,
                                             java.lang.String propertyQualifier)
      • readValues

        public java.util.Map<java.lang.String,​java.lang.Object> readValues​(java.lang.Object sourceObject,
                                                                                 java.util.List<java.lang.String> qualifiers,
                                                                                 java.util.List<java.util.Locale> locales)
        Description copied from interface: PropertyValueService
        Read qualifiers values from the source object. Also Localized property values will be read.
        Specified by:
        readValues in interface PropertyValueService
        Parameters:
        sourceObject - is the instance of a type
        qualifiers - is a list of the attribute qualifiers of the type
        locales - is a list of locales
        Returns:
        a map of attributes and their corresponding localized values
      • readRestrictedValues

        public java.util.Map<java.lang.String,​PropertyReadResult> readRestrictedValues​(java.lang.Object sourceObject,
                                                                                             java.util.List<java.lang.String> qualifiers,
                                                                                             java.util.List<java.util.Locale> locales)
        Description copied from interface: PropertyValueService
        Read qualifiers values from the source object. Also Localized property values will be read. Every property is first check, whether user may read it.
        Specified by:
        readRestrictedValues in interface PropertyValueService
        Parameters:
        sourceObject - is a instance of a type.
        qualifiers - is a list of the property qualifiers of the type.
        locales - is a list of locales.
        Returns:
        map contains all qualifiers with corresponding localized values.
      • createPropertyResult

        protected PropertyReadResult createPropertyResult​(java.lang.Object sourceObject,
                                                          java.util.List<java.util.Locale> locales,
                                                          java.lang.String qualifier)
      • handleEvaluationException

        protected PropertyReadResult handleEvaluationException​(org.springframework.expression.spel.SpelEvaluationException e)
      • setRestrictedResolverFactory

        public void setRestrictedResolverFactory​(ExpressionResolverFactory restrictedResolverFactory)