public class EnvScalarConstructor extends Constructor
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 Pattern |
ENV_FORMAT
name must be a word -> \w+ value can be any non-space -> \S+
|
static Tag |
ENV_TAG
Tag to indicate ENV
|
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,
Collection<TypeDescription> moreTDs,
LoaderOptions loadingConfig)
Create EnvScalarConstructor which can create JavaBeans with variable substitution
|
Modifier and Type | Method and Description |
---|---|
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
|
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 Pattern ENV_FORMAT
public EnvScalarConstructor()
public EnvScalarConstructor(TypeDescription theRoot, Collection<TypeDescription> moreTDs, LoaderOptions loadingConfig)
theRoot
- - the class (usually JavaBean) to be constructedmoreTDs
- - collection of classes used by the root classloadingConfig
- - configurationpublic String apply(String name, String separator, String value, 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 variableCopyright © 2008–2022. All rights reserved.