org.yaml.snakeyaml.env

## Class EnvScalarConstructor

- java.lang.Object
- - org.yaml.snakeyaml.constructor.BaseConstructor
  - - org.yaml.snakeyaml.constructor.SafeConstructor
    - - org.yaml.snakeyaml.constructor.Constructor
      - - org.yaml.snakeyaml.env.EnvScalarConstructor

    public class EnvScalarConstructor
    extends Constructor

Construct scalar for format ${VARIABLE} replacing the template with the value from environment.

See Also:
  Variable substitution, Variable substitution

### Nested Class Summary

### Nested classes/interfaces inherited from class org.yaml.snakeyaml.constructor.Constructor

`Constructor.ConstructMapping, Constructor.ConstructScalar, Constructor.ConstructSequence, Constructor.ConstructYamlObject`

### Nested classes/interfaces inherited from class org.yaml.snakeyaml.constructor.SafeConstructor

`SafeConstructor.ConstructUndefined, SafeConstructor.ConstructYamlBinary, SafeConstructor.ConstructYamlBool, SafeConstructor.ConstructYamlFloat, SafeConstructor.ConstructYamlInt, SafeConstructor.ConstructYamlMap, SafeConstructor.ConstructYamlNull, SafeConstructor.ConstructYamlOmap, SafeConstructor.ConstructYamlPairs, SafeConstructor.ConstructYamlSeq, SafeConstructor.ConstructYamlSet, SafeConstructor.ConstructYamlStr, SafeConstructor.ConstructYamlTimestamp`

### Field Summary

Fields
`static Pattern` `ENV_FORMAT`
`static Tag` `ENV_TAG`

### Fields inherited from class org.yaml.snakeyaml.constructor.SafeConstructor

`undefinedConstructor`

### Fields inherited from class org.yaml.snakeyaml.constructor.BaseConstructor

`composer, loadingConfig, rootTag, typeDefinitions, typeTags, yamlClassConstructors, yamlConstructors, yamlMultiConstructors`

### Constructor Summary

Constructors
Constructor and Description
`EnvScalarConstructor()`

### Method Summary

Methods
`String` `apply(String name, String separator, String value, String environment)` Implement the logic for missing and unset variables
`String` `getEnv(String key)` Get value of the environment variable

### Methods inherited from class org.yaml.snakeyaml.constructor.Constructor

`getClassForName, getClassForNode`

### Methods inherited from class org.yaml.snakeyaml.constructor.SafeConstructor

`constructMapping2ndStep, constructSet2ndStep, createLongOrBigInteger, flattenMapping, processDuplicateKeys`

### Methods inherited from class org.yaml.snakeyaml.constructor.BaseConstructor

`addTypeDescription, checkData, constructArray, constructArrayStep2, constructDocument, constructMapping, constructObject, constructObjectNoCheck, constructScalar, constructSequence, constructSequenceStep2, constructSet, constructSet, createArray, createDefaultList, createDefaultMap, createDefaultSet, finalizeConstruction, getConstructor, getData, getPropertyUtils, getSingleData, isAllowDuplicateKeys, isEnumCaseSensitive, isExplicitPropertyUtils, isWrappedToRootException, newInstance, newInstance, newInstance, newList, newMap, newSet, postponeMapFilling, postponeSetFilling, setAllowDuplicateKeys, setComposer, setEnumCaseSensitive, setPropertyUtils, setWrappedToRootException`

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

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

### Field Detail

#### ENV_TAG

    public static final Tag ENV_TAG

#### ENV_FORMAT

    public static final Pattern ENV_FORMAT

### Constructor Detail

#### EnvScalarConstructor

    public EnvScalarConstructor()

### Method Detail

#### apply

    public String apply(String name,
               String separator,
               String value,
               String environment)

Implement the logic for missing and unset variables

Parameters:
  `name` - - variable name in the template
  `separator` - - separator in the template, can be :-, -, :?, ?
  `value` - - default value or the error in the template
  `environment` - - the value from environment for the provided variable
Returns:
  the value to apply in the template

#### getEnv

    public String getEnv(String key)

Get value of the environment variable

Parameters:
  `key` - - the name of the variable
Returns:
  value or null if not set