public class EnvScalarConstructor extends Constructor
Modifier and Type | Class and Description |
---|---|
private class |
EnvScalarConstructor.ConstructEnv |
Constructor.ConstructMapping, Constructor.ConstructScalar, Constructor.ConstructSequence, Constructor.ConstructYamlObject
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
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
ENV_FORMAT |
static Tag |
ENV_TAG |
undefinedConstructor
composer, loadingConfig, NOT_INSTANTIATED_OBJECT, rootTag, typeDefinitions, typeTags, yamlClassConstructors, yamlConstructors, yamlMultiConstructors
Constructor and Description |
---|
EnvScalarConstructor()
For simple cases when no JavaBeans are needed
|
EnvScalarConstructor(TypeDescription theRoot,
java.util.Collection<TypeDescription> moreTDs,
LoaderOptions loadingConfig)
Create EnvScalarConstructor which can create JavaBeans with variable substitution
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
apply(java.lang.String name,
java.lang.String separator,
java.lang.String value,
java.lang.String environment)
Implement the logic for missing and unset variables
|
java.lang.String |
getEnv(java.lang.String key)
Get value of the environment variable
|
getClassForName, getClassForNode
constructMapping2ndStep, constructSet2ndStep, createLongOrBigInteger, flattenMapping, flattenMapping, processDuplicateKeys, processDuplicateKeys
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
public static final Tag ENV_TAG
public static final java.util.regex.Pattern ENV_FORMAT
public EnvScalarConstructor()
public EnvScalarConstructor(TypeDescription theRoot, java.util.Collection<TypeDescription> moreTDs, LoaderOptions loadingConfig)
theRoot
- - the class (usually JavaBean) to be constructedmoreTDs
- - collection of classes used by the root classloadingConfig
- - configurationpublic java.lang.String apply(java.lang.String name, java.lang.String separator, java.lang.String value, java.lang.String environment)
name
- - variable name in the templateseparator
- - separator in the template, can be :-, -, :?, ?value
- - default value or the error in the templateenvironment
- - the value from environment for the provided variablepublic java.lang.String getEnv(java.lang.String key)
key
- - the name of the variable