Example #1
0
  /**
   * Retrieves the property with the given name. This method, in conjuction with #setProperty,
   * allows for a convenient way to store information that doesn't have it's own accessor methods.
   *
   * @param name the name of the property to return.
   * @returns the Object associated with the given name or null if no property was found.
   * @see #setProperty
   */
  public void setProperty(String name, Object obj) {
    if (name == null) {
      throw new IllegalArgumentException("name may not be null.");
    } else if (obj == null) {
      // -- remove property if necessary
      if (_properties == null) return;
      _properties.remove(name);
    }

    // -- create properties if necessary
    if (_properties == null) {
      _properties = new HashMap(3);
    }

    // -- add property
    _properties.put(name, obj);
  } // -- setProperty
Example #2
0
 /**
  * Retrieves the property with the given name. This method, in conjuction with #setProperty,
  * allows for a convenient way to store information that doesn't have it's own accessor methods.
  *
  * @param name the name of the property to return.
  * @returns the Object associated with the given name or null if no property was found.
  * @see #setProperty
  */
 public Object getProperty(String name) {
   if ((name == null) || (_properties == null)) return null;
   return _properties.get(name);
 } // -- getProperty