org.apache.tamaya.json

## Class JSONPropertySource

- java.lang.Object
- - org.apache.tamaya.json.JSONPropertySource

- All Implemented Interfaces:
    org.apache.tamaya.spi.PropertySource

      public class JSONPropertySource
      extends Object
      implements org.apache.tamaya.spi.PropertySource

  Property source based on a JSON file.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `JOHNZON_SUPPORTS_COMMENTS_PROP` Constant for enabling comments in Johnzon.

    - ### Fields inherited from interface org.apache.tamaya.spi.PropertySource

      `EMPTY, TAMAYA_ORDINAL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JSONPropertySource(URL resource)` Constructor, hereby using 0 as the default ordinal.
    `JSONPropertySource(URL resource, int defaultOrdinal)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.tamaya.spi.PropertyValue` | `get(String key)`
    `String` | `getName()`
    `int` | `getOrdinal()`
    `Map<String,String>` | `getProperties()`
    `boolean` | `isScannable()`
    `protected Map<String,String>` | `readConfig(URL urlResource)` Reads the configuration.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### JOHNZON_SUPPORTS_COMMENTS_PROP

          public static final String JOHNZON_SUPPORTS_COMMENTS_PROP

      Constant for enabling comments in Johnzon.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JSONPropertySource

          public JSONPropertySource(URL resource)

      Constructor, hereby using 0 as the default ordinal.
      Parameters:
        `resource` - the resource modelled as URL, not null.

    - #### JSONPropertySource

          public JSONPropertySource(URL resource,
                            int defaultOrdinal)

      Constructor.
      Parameters:
        `resource` - the resource modelled as URL, not null.
        `defaultOrdinal` - the defaultOrdinal to be used.

  - ### Method Detail

    - #### getOrdinal

          public int getOrdinal()

      Specified by:
        `getOrdinal` in interface `org.apache.tamaya.spi.PropertySource`

    - #### getName

          public String getName()

      Specified by:
        `getName` in interface `org.apache.tamaya.spi.PropertySource`

    - #### get

          public org.apache.tamaya.spi.PropertyValue get(String key)

      Specified by:
        `get` in interface `org.apache.tamaya.spi.PropertySource`

    - #### getProperties

          public Map<String,String> getProperties()

      Specified by:
        `getProperties` in interface `org.apache.tamaya.spi.PropertySource`

    - #### readConfig

          protected Map<String,String> readConfig(URL urlResource)

      Reads the configuration.
      Parameters:
        `urlResource` - soure of the configuration.
      Returns:
        the configuration read from the given resource URL.
      Throws:
        `org.apache.tamaya.ConfigException` - if resource URL cannot be read.

    - #### isScannable

          public boolean isScannable()

      Specified by:
        `isScannable` in interface `org.apache.tamaya.spi.PropertySource`

Copyright © 2015–2016 Apache Software Foundation. All rights reserved.