Class AbstractEnvironment

java.lang.Object
io.guise.framework.platform.AbstractEnvironment
All Implemented Interfaces:
Environment
Direct Known Subclasses:
DefaultEnvironment

public class AbstractEnvironment extends Object implements Environment
An abstract implementation of the platform user local environment.
Author:
Garret Wilson
  • Constructor Details

    • AbstractEnvironment

      public AbstractEnvironment()
  • Method Details

    • hasProperty

      public boolean hasProperty(String name)
      Description copied from interface: Environment
      Determines if an environment property exists.
      Specified by:
      hasProperty in interface Environment
      Parameters:
      name - The name of the property to check.
      Returns:
      true if the environment has the given property.
    • getProperty

      public <T> T getProperty(String name)
      Description copied from interface: Environment
      Retrieves an environment property by its name. A ClassCastException will eventually be thrown if the given value is not the generic type requested.
      Specified by:
      getProperty in interface Environment
      Type Parameters:
      T - The type of property value expected.
      Parameters:
      name - The name of the property to retrieve.
      Returns:
      The property value, or null if there is no such property.
    • getProperty

      public <T> T getProperty(String name, T defaultValue)
      Description copied from interface: Environment
      Retrieves an environment property by its name, returning a default value if no value is available. A ClassCastException will eventually be thrown if the given value is not the generic type requested.
      Specified by:
      getProperty in interface Environment
      Type Parameters:
      T - The type of property value expected.
      Parameters:
      name - The name of the property to retrieve.
      defaultValue - The value to return if no such property is available, or null if there is no default value.
      Returns:
      The property value, or the provided default value if there is no such property.
    • getRequiredProperty

      public <T> T getRequiredProperty(String name)
      Description copied from interface: Environment
      Retrieves a required environment property by its name, throwing an exception if the value is missing. A ClassCastException will eventually be thrown if the given value is not the generic type requested.
      Specified by:
      getRequiredProperty in interface Environment
      Type Parameters:
      T - The type of property value expected.
      Parameters:
      name - The name of the property to retrieve.
      Returns:
      The property value.
    • setProperty

      public void setProperty(String name, Object value)
      Description copied from interface: Environment
      Sets an environment property.
      Specified by:
      setProperty in interface Environment
      Parameters:
      name - The name of the property.
      value - The value to associate with the name.
    • setProperties

      public void setProperties(Map<String,Object> map)
      Description copied from interface: Environment
      Sets multiple environment properties.
      Specified by:
      setProperties in interface Environment
      Parameters:
      map - The map of property names and values to set.
    • removeProperty

      public void removeProperty(String name)
      Description copied from interface: Environment
      Removes the property specified by the given name.
      Specified by:
      removeProperty in interface Environment
      Parameters:
      name - The name of the property to remove.
    • getProperties

      public Map<String,Object> getProperties()
      Description copied from interface: Environment
      Returns the available environment properties as a read-only map of property names and values.
      Specified by:
      getProperties in interface Environment
      Returns:
      The available environment properties.