org.apache.felix.utils.properties

## Class TypedProperties

- java.lang.Object
- - java.util.AbstractMap<String,Object>
  - - org.apache.felix.utils.properties.TypedProperties

All Implemented Interfaces:
  Map<String,Object>

    public class TypedProperties
    extends AbstractMap<String,Object>

Map to load / store / update untyped or typed properties. The map is untyped if all properties are strings. When this is the case, the properties are stored without any encoding, else all properties are encoded using the `ConfigurationHandler`.

Author:
  gnodet

### Nested Class Summary

Nested Classes
`static interface` `TypedProperties.SubstitutionCallback`

### Nested classes/interfaces inherited from class java.util.AbstractMap

`AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>`

### Nested classes/interfaces inherited from interface java.util.Map

`Map.Entry<K,V>`

### Field Summary

Fields
`static String` `ENV_PREFIX`

### Constructor Summary

Constructors
Constructor and Description
`TypedProperties()`
`TypedProperties(boolean substitute)`
`TypedProperties(TypedProperties.SubstitutionCallback callback)`
`TypedProperties(TypedProperties.SubstitutionCallback callback, boolean substitute)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `clear()`
`Set<Map.Entry<String,Object>>` `entrySet()`
`Object` `get(Object key)`
`List<String>` `getComments(String key)`
`List<String>` `getFooter()` Return the comment footer.
`List<String>` `getHeader()` Return the comment header.
`List<String>` `getRaw(String key)`
`void` `load(File location)`
`void` `load(InputStream is)`
`void` `load(Reader reader)`
`void` `load(URL location)`
`static Map<String,Map<String,String>>` `prepare(Map<String,TypedProperties> properties)`
`Object` `put(String key, List<String> commentLines, List<String> valueLines)`
`Object` `put(String key, List<String> commentLines, Object value)`
`Object` `put(String key, Object value)`
`Object` `put(String key, String comment, Object value)`
`Object` `remove(Object key)`
`void` `save(File location)`
`void` `save(OutputStream os)`
`void` `save(Writer writer)`
`void` `setFooter(List<String> footer)` Set the comment footer.
`void` `setHeader(List<String> header)` Set the comment header.
`void` `store(OutputStream os, String comment)` Store a properties into a output stream, preserving comments, special character, etc.
`static void` `substitute(Map<String,TypedProperties> properties, Map<String,Map<String,String>> dynamic, TypedProperties.SubstitutionCallback callback, boolean finalSubstitution)`
`void` `substitute(TypedProperties.SubstitutionCallback cb)`
`boolean` `update(Map<String,Object> props)`
`boolean` `update(TypedProperties properties)`

### Methods inherited from class java.util.AbstractMap

`clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, values`

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

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.Map

`compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll`

### Field Detail

#### ENV_PREFIX

    public static final String ENV_PREFIX

See Also:
  Constant Field Values

### Constructor Detail

#### TypedProperties

    public TypedProperties()

#### TypedProperties

    public TypedProperties(boolean substitute)

#### TypedProperties

    public TypedProperties(TypedProperties.SubstitutionCallback callback)

#### TypedProperties

    public TypedProperties(TypedProperties.SubstitutionCallback callback,
                           boolean substitute)

### Method Detail

#### load

    public void load(File location)
              throws IOException

Throws:
  `IOException`

#### load

    public void load(URL location)
              throws IOException

Throws:
  `IOException`

#### load

    public void load(InputStream is)
              throws IOException

Throws:
  `IOException`

#### load

    public void load(Reader reader)
              throws IOException

Throws:
  `IOException`

#### save

    public void save(File location)
              throws IOException

Throws:
  `IOException`

#### save

    public void save(OutputStream os)
              throws IOException

Throws:
  `IOException`

#### save

    public void save(Writer writer)
              throws IOException

Throws:
  `IOException`

#### store

    public void store(OutputStream os,
                      String comment)
               throws IOException

Store a properties into a output stream, preserving comments, special character, etc. This method is mainly to be compatible with the java.util.Properties class.

Parameters:
  `os` - an output stream.
  `comment` - this parameter is ignored as this Properties
Throws:
  `IOException` - If storing fails

#### entrySet

    public Set<Map.Entry<String,Object>> entrySet()

Specified by:
  `entrySet` in interface `Map<String,Object>`
Specified by:
  `entrySet` in class `AbstractMap<String,Object>`

#### put

    public Object put(String key,
                      Object value)

Specified by:
  `put` in interface `Map<String,Object>`
Overrides:
  `put` in class `AbstractMap<String,Object>`

#### get

    public Object get(Object key)

Specified by:
  `get` in interface `Map<String,Object>`
Overrides:
  `get` in class `AbstractMap<String,Object>`

#### put

    public Object put(String key,
                      List<String> commentLines,
                      Object value)

#### put

    public Object put(String key,
                      String comment,
                      Object value)

#### put

    public Object put(String key,
                      List<String> commentLines,
                      List<String> valueLines)

#### update

    public boolean update(Map<String,Object> props)

#### update

    public boolean update(TypedProperties properties)

#### getRaw

    public List<String> getRaw(String key)

#### getComments

    public List<String> getComments(String key)

#### remove

    public Object remove(Object key)

Specified by:
  `remove` in interface `Map<String,Object>`
Overrides:
  `remove` in class `AbstractMap<String,Object>`

#### clear

    public void clear()

Specified by:
  `clear` in interface `Map<String,Object>`
Overrides:
  `clear` in class `AbstractMap<String,Object>`

#### getHeader

    public List<String> getHeader()

Return the comment header.

Returns:
  the comment header

#### setHeader

    public void setHeader(List<String> header)

Set the comment header.

Parameters:
  `header` - the header to use

#### getFooter

    public List<String> getFooter()

Return the comment footer.

Returns:
  the comment footer

#### setFooter

    public void setFooter(List<String> footer)

Set the comment footer.

Parameters:
  `footer` - the footer to use

#### substitute

    public void substitute(TypedProperties.SubstitutionCallback cb)

#### prepare

    public static Map<String,Map<String,String>> prepare(Map<String,TypedProperties> properties)

#### substitute

    public static void substitute(Map<String,TypedProperties> properties,
                                  Map<String,Map<String,String>> dynamic,
                                  TypedProperties.SubstitutionCallback callback,
                                  boolean finalSubstitution)