Class PropertySetCache

java.lang.Object
com.atlassian.jira.propertyset.PropertySetCache

public class PropertySetCache extends Object
This class provides a cache for PropertySet values as used by JiraCachingPropertySet.

The intention is that the cache is non-blocking for reads, and it is up to the JiraCachingPropertySet to synchronise writes with reading/writing from the underlying Property Set.

This cache looks and works a lot like a PropertySet for obvious reasons, however it is not declared to implement PropertySet because it does not implement all methods - only the ones we want to cache for. With that in mind, it generally attempts to follow the contract of the PropertySet interface. Namely:

  • If a property is retrieved that exists but contains a value of different type, a InvalidPropertyTypeException should be thrown.
  • If a property is retrieved that does not exist, null (or the primitive equivalent) is returned.
    Since:
    v4.0
    See Also:
    • Method Details

      • setBoolean

        public void setBoolean(String key, boolean value)
      • getBoolean

        public boolean getBoolean(String key) throws com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
        Throws:
        com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
      • setData

        public void setData(String key, byte[] value)
      • getData

        public byte[] getData(String key) throws com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
        Throws:
        com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
      • setDate

        public void setDate(String key, Date value)
      • getDate

        public Date getDate(String key) throws com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
        Throws:
        com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
      • setDouble

        public void setDouble(String key, double value)
      • getDouble

        public double getDouble(String key) throws com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
        Throws:
        com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
      • setInt

        public void setInt(String key, int value)
      • getInt

        public int getInt(String key) throws com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
        Throws:
        com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
      • setLong

        public void setLong(String key, long value)
      • getLong

        public long getLong(String key) throws com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
        Throws:
        com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
      • setObject

        public void setObject(String key, Object value)
      • getObject

        public Object getObject(String key) throws com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
        Throws:
        com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
      • setProperties

        public void setProperties(String key, Properties value)
      • getProperties

        public Properties getProperties(String key) throws com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
        Throws:
        com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
      • setString

        public void setString(String key, String value)
      • getString

        public String getString(String key) throws com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException, com.opensymphony.module.propertyset.InvalidPropertyTypeException
        Throws:
        com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
        com.opensymphony.module.propertyset.InvalidPropertyTypeException
      • setText

        public void setText(String key, String value)
      • getText

        public String getText(String key) throws com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
        Throws:
        com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
      • setXML

        public void setXML(String key, Document value)
      • getXML

        public Document getXML(String key) throws com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
        Throws:
        com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
      • remove

        public void remove(String key)
      • clear

        public void clear()
      • bulkLoad

        public void bulkLoad(com.opensymphony.module.propertyset.PropertySet source)
        Eagerly loads all the values from the given PropertySet into this cache.
        Parameters:
        source - The PropertySet to bulk load from.
      • exists

        public Boolean exists(String key)
        Returns the cached value for whether the given key exists in the underlying PropertySet.

        It is important not to confuse this method with the Map.containsKey(java.lang.Object) method.

        Parameters:
        key - The property key.
        Returns:
        A Boolean object containing the cached existance of a value for the key, or null if we haven't cached the existance for this key.
        See Also:
      • cacheExistance

        public void cacheExistance(String key, boolean keyExists)
      • setType

        public void setType(String key, int type)
      • getType

        public int getType(String key) throws com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException
        Throws:
        com.atlassian.jira.propertyset.PropertySetCache.NoValueCachedException