org.compass.core.config
Class CompassSettings

java.lang.Object
  extended by org.compass.core.config.CompassSettings
Direct Known Subclasses:
RuntimeCompassSettings

public class CompassSettings
extends Object

A set of settings that are used to configure the Compass instance.

Author:
kimchy

Constructor Summary
CompassSettings()
           
CompassSettings(ClassLoader classLoader)
           
CompassSettings(Map<String,Object> settings)
           
 
Method Summary
 void addSettings(CompassSettings settings)
           
 void addSettings(Map<String,Object> settings)
           
 void addSettings(Properties settings)
           
 CompassSettings clear()
           
 CompassSettings copy()
           
 ClassLoader getClassLoader()
          Returns the class loader.
 ClassLoader getDirectClassLoader()
          Returns the direct class loader configured for this settings.
 CompassSettings getGloablSettings()
           
 Properties getProperties()
           
 Object getRegistry(Object key)
          ADANCE: An internal compass global registry
 String getSetting(String setting)
           
 String getSetting(String setting, String defaultValue)
           
 boolean getSettingAsBoolean(String setting, boolean defaultValue)
           
 long getSettingAsBytes(String setting, long defaultValue)
           
 Class getSettingAsClass(String setting, Class clazz)
           
 Class getSettingAsClass(String setting, Class clazz, ClassLoader classLoader)
           
 double getSettingAsDouble(String setting, double defaultValue)
           
 float getSettingAsFloat(String setting, float defaultValue)
           
 Object getSettingAsInstance(String setting)
           
 Object getSettingAsInstance(String setting, String defaultClass)
           
 int getSettingAsInt(String setting, int defaultValue)
           
 long getSettingAsLong(String setting, long defaultValue)
           
 Object getSettingAsObject(String setting)
           
 long getSettingAsTimeInMillis(String setting, long defaultValue)
           
 Map<String,CompassSettings> getSettingGroups(String settingPrefix)
           
 Map<String,Object> getUnderlyingMap()
           
 Collection keySet()
           
 Object removeRegistry(Object key)
          ADVANCE: An internal compass global registry
 void removeSetting(String setting)
           
 CompassSettings setBooleanSetting(String setting, boolean value)
           
(package private)  void setClassLoader(ClassLoader classLoader)
           
 CompassSettings setClassSetting(String setting, Class clazz)
           
 CompassSettings setDoubleSetting(String setting, double value)
           
 CompassSettings setFloatSetting(String setting, float value)
           
 void setGlobalSettings(CompassSettings settings)
           
 CompassSettings setGroupSettings(String settingPrefix, String groupName, String[] settings, Object[] values)
          Sets a group of settings, sharing the same setting prefix.
 CompassSettings setIntSetting(String setting, int value)
           
 CompassSettings setLongSetting(String setting, long value)
           
 CompassSettings setObjectSetting(String setting, Object value)
           
 void setRegistry(Object key, Object value)
          ADVANCE: An internal compass global registry
 CompassSettings setSetting(String setting, String value)
           
 CompassSettings setTimeSetting(String setting, long value, TimeUnit timeUnit)
          Sets the given time setting based on the given time unit, converting it to milliseconds.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompassSettings

public CompassSettings()

CompassSettings

public CompassSettings(ClassLoader classLoader)

CompassSettings

public CompassSettings(Map<String,Object> settings)
Method Detail

setGlobalSettings

public void setGlobalSettings(CompassSettings settings)

getGloablSettings

public CompassSettings getGloablSettings()

addSettings

public void addSettings(Properties settings)

addSettings

public void addSettings(Map<String,Object> settings)

getUnderlyingMap

public Map<String,Object> getUnderlyingMap()

getProperties

public Properties getProperties()

addSettings

public void addSettings(CompassSettings settings)

copy

public CompassSettings copy()

clear

public CompassSettings clear()

setClassLoader

void setClassLoader(ClassLoader classLoader)

getClassLoader

public ClassLoader getClassLoader()
Returns the class loader. If none is defined, return the thread context class loader.


getDirectClassLoader

public ClassLoader getDirectClassLoader()
Returns the direct class loader configured for this settings. null if none is defined.


keySet

public Collection keySet()

removeSetting

public void removeSetting(String setting)

getSetting

public String getSetting(String setting)

getSettingAsObject

public Object getSettingAsObject(String setting)

getSetting

public String getSetting(String setting,
                         String defaultValue)

getSettingGroups

public Map<String,CompassSettings> getSettingGroups(String settingPrefix)

getSettingAsFloat

public float getSettingAsFloat(String setting,
                               float defaultValue)

getSettingAsDouble

public double getSettingAsDouble(String setting,
                                 double defaultValue)

getSettingAsInt

public int getSettingAsInt(String setting,
                           int defaultValue)

getSettingAsLong

public long getSettingAsLong(String setting,
                             long defaultValue)

getSettingAsBoolean

public boolean getSettingAsBoolean(String setting,
                                   boolean defaultValue)

getSettingAsTimeInMillis

public long getSettingAsTimeInMillis(String setting,
                                     long defaultValue)

getSettingAsBytes

public long getSettingAsBytes(String setting,
                              long defaultValue)

getSettingAsClass

public Class getSettingAsClass(String setting,
                               Class clazz)
                        throws ClassNotFoundException
Throws:
ClassNotFoundException

getSettingAsClass

public Class getSettingAsClass(String setting,
                               Class clazz,
                               ClassLoader classLoader)
                        throws ClassNotFoundException
Throws:
ClassNotFoundException

getSettingAsInstance

public Object getSettingAsInstance(String setting)

getSettingAsInstance

public Object getSettingAsInstance(String setting,
                                   String defaultClass)

setSetting

public CompassSettings setSetting(String setting,
                                  String value)

setObjectSetting

public CompassSettings setObjectSetting(String setting,
                                        Object value)

setBooleanSetting

public CompassSettings setBooleanSetting(String setting,
                                         boolean value)

setFloatSetting

public CompassSettings setFloatSetting(String setting,
                                       float value)

setDoubleSetting

public CompassSettings setDoubleSetting(String setting,
                                        double value)

setIntSetting

public CompassSettings setIntSetting(String setting,
                                     int value)

setLongSetting

public CompassSettings setLongSetting(String setting,
                                      long value)

setTimeSetting

public CompassSettings setTimeSetting(String setting,
                                      long value,
                                      TimeUnit timeUnit)
Sets the given time setting based on the given time unit, converting it to milliseconds.


setClassSetting

public CompassSettings setClassSetting(String setting,
                                       Class clazz)

setGroupSettings

public CompassSettings setGroupSettings(String settingPrefix,
                                        String groupName,
                                        String[] settings,
                                        Object[] values)
Sets a group of settings, sharing the same setting prefix. The provided settings are appended to the settingPrefix, and the matching values are set.

The constructed setting is: settingPrefix + "." + groupName + "." + settings[i].

Parameters:
settingPrefix - The prefix used for all settings
groupName - The name of the setting group
settings - The settings name appended to settingsPrefix + "." + groupName + "."
values - The values of the settings matched against the settings parameters
Returns:
This settings instance for method chaining

getRegistry

public Object getRegistry(Object key)
ADANCE: An internal compass global registry


setRegistry

public void setRegistry(Object key,
                        Object value)
ADVANCE: An internal compass global registry


removeRegistry

public Object removeRegistry(Object key)
ADVANCE: An internal compass global registry


toString

public String toString()
Overrides:
toString in class Object


Copyright (c) 2004-2008 The Compass Project.