Class XProperties

All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class XProperties extends Properties
An extension to the Properties class which performs the following when you call getProperty: 1. Checks to see if there are any variables in the property 2. If so it replaces the variable with with the first match it finds in the following order - The java properties (java -Dkey=value) - The component context properties (set using setBundleContext) - The properties set in the object itself - The container's environment variables This class operates identically to a standard Properties object in all other respects.
See Also:
  • Field Details

  • Constructor Details

    • XProperties

      public XProperties()
  • Method Details

    • getProperty

      public String getProperty(String key)
      See the class description for more details.
      Overrides:
      getProperty in class Properties
      See Also:
    • getUninterpretedProperty

      public String getUninterpretedProperty(String key)
      A wrapper around the old getProperty behaviour, this method does not do any variable expansion.
      Parameters:
      key - The key of the property
      Returns:
      The property exactly as it appears in the properties list without any variable expansion
    • merge

      public void merge(Dictionary<String,String> p)
      Merges the properties from p into this properties object
      Parameters:
      p - The Dictionary you wish to add to this object
    • setBundleContext

      public void setBundleContext(org.osgi.framework.BundleContext ctx)
      Sets the BundleContext for this object. Set this to null if you wish to skip checking the context for a property.
      Parameters:
      ctx - The BundleContext for this instance.
    • getBundleContext

      public org.osgi.framework.BundleContext getBundleContext()
      Return the current BundleContext that's in use by this object.
      Returns:
      The current BundleContext