PropertyHandler.Builder (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap
Class PropertyHandler.Builder

    java.lang.Object
      com.bbn.openmap.PropertyHandler.Builder

Enclosing class:
  PropertyHandler

    public static class PropertyHandler.Builder

extends java.lang.Object

This Builder class lets you have more control over how a PropertyHandler is constructed. If a properties file location or a properties file is not provided, the PropertyHandler will look for an "openmap.properties" file in the classpath, config directory or user home directory. If you don't want the PropertyHandler to search for a properties file, set an empty Properties object in the Builder.

Author:
  ddietrick

Field Summary
`protected java.util.Properties` | `properties`
`protected java.lang.String` | `propertyPrefix`
`protected boolean` | `update`

Constructor Summary
`PropertyHandler.Builder()`

Method Summary
`PropertyHandler` | `build()` Build the property handler.
`protected java.util.Properties` | `createProperties(java.net.URL location)` Reads the file at the given location and creates a Properties file from the contents.
`PropertyHandler.Builder` | `setProgressUpdates(boolean update)`
`PropertyHandler.Builder` | `setProperties(java.util.Properties props)` Have the builder use the provided properties.
`PropertyHandler.Builder` | `setPropertiesFile(java.lang.String location)` Have the builder look for a resource, file or URL at the location.
`PropertyHandler.Builder` | `setPropertiesFile(java.net.URL url)` Have the builder look for properties file at URL location.
`PropertyHandler.Builder` | `setPropertyPrefix(java.lang.String prefix)` Set the property prefix used for general settings in the properties in configuration of application.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### update

    protected boolean update

### properties

    protected java.util.Properties properties

### propertyPrefix

    protected java.lang.String propertyPrefix

Constructor Detail

### PropertyHandler.Builder

    public PropertyHandler.Builder()

Method Detail

### setPropertiesFile

    public PropertyHandler.Builder setPropertiesFile(java.lang.String location)
                                              throws java.net.MalformedURLException,
                                                     java.io.IOException

  Have the builder look for a resource, file or URL at the location.

  Parameters:
    `location` - of the properties file
  Returns:
    this Builder, so settings can be stacked.
  Throws:
    `java.net.MalformedURLException`
    `java.io.IOException`

### setPropertiesFile

    public PropertyHandler.Builder setPropertiesFile(java.net.URL url)
                                              throws java.io.IOException

  Have the builder look for properties file at URL location.

  Parameters:
    `url` -
  Returns:
    this Builder for stacking.
  Throws:
    `java.io.IOException`

### setProperties

    public PropertyHandler.Builder setProperties(java.util.Properties props)

  Have the builder use the provided properties.

  Parameters:
    `props` - Properties to use.
  Returns:
    this Builder for stacking

### setPropertyPrefix

    public PropertyHandler.Builder setPropertyPrefix(java.lang.String prefix)

  Set the property prefix used for general settings in the properties in configuration of application. If not set "openmap" will be used as the default.

  Parameters:
    `prefix` - Set the property prefix for the PropertyHandler
  Returns:
    this builder for stacking

### setProgressUpdates

    public PropertyHandler.Builder setProgressUpdates(boolean update)

  Parameters:
    `update` - flag for providing progress updates
  Returns:
    This builder for stacking

### createProperties

    protected java.util.Properties createProperties(java.net.URL location)
                                             throws java.io.IOException

  Reads the file at the given location and creates a Properties file from the contents.

  Parameters:
    `location` - URL of file
  Returns:
    Properties
  Throws:
    `java.io.IOException` - if something goes wrong reading the file.

### build

    public PropertyHandler build()

  Build the property handler.

  Returns:
    new property handler with builder settings.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details