Package oracle.pgx.config
Class ConfigParser<F extends ConfigField>
- java.lang.Object
-
- oracle.pgx.config.AbstractConfigParser<F>
-
- oracle.pgx.config.ConfigParser<F>
-
- Type Parameters:
F- the field enum this parsers uses
- All Implemented Interfaces:
ParseResult<F>
public class ConfigParser<F extends ConfigField> extends AbstractConfigParser<F> implements ParseResult<F>
A parser for parsing graph configurations in JSON format.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringJAVA_HOMEstatic java.lang.StringJAVA_HOME_DIR_WILDCARDThe Constant JAVA_HOME_DIR_WILDCARD.static java.lang.StringMAX_HEAP_SIZE_WILDCARDThe Constant MAX_HEAP_SIZE_WILDCARD.static java.lang.StringNEGATIVE_INFINITY_WILDCARDThe Constant NEGATIVE_INFINITY_WILDCARD.static java.lang.StringNO_OF_CPUS_WILDCARDThe Constant NO_OF_CPUS_WILDCARD.static java.lang.StringPOSITIVE_INFINITY_WILDCARD1The Constant POSITIVE_INFINITY_WILDCARD1.static java.lang.StringPOSITIVE_INFINITY_WILDCARD2The Constant POSITIVE_INFINITY_WILDCARD2.static java.lang.StringTMP_DIR_WILDCARDThe Constant TMP_DIR_WILDCARD.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<F>getDefaults()Gets the set of optional fields whose defaults where used during parsing.static java.util.OptionalLonggetTotalPhysicalMemorySize()java.util.Map<F,java.lang.Object>getValues()Gets the parsed values.ParseResult<F>parse()Starts parsing.static <F extends ConfigField>
ParseResult<F>parse(java.util.Map<java.lang.String,java.lang.Object> raw, F[] fields, boolean strict, java.lang.String parent)Parses raw key/value pairs into aParseResultobject.static <F extends ConfigField>
ParseResult<F>parse(java.util.Map<java.lang.String,java.lang.Object> raw, F[] fields, boolean strict, java.lang.String parent, boolean parseHiddenValues)Parses raw key/value pairs into aParseResultobject.static java.util.Map<java.lang.String,java.lang.Object>parseRaw(java.io.InputStream is)Parses an input stream into raw key/value pairs.static java.lang.ObjectreplaceWildcards(java.lang.Class<?> type, java.lang.Object given)Replaces a given wildcard value with the value the wildcard represents.
-
-
-
Field Detail
-
NO_OF_CPUS_WILDCARD
public static final java.lang.String NO_OF_CPUS_WILDCARD
The Constant NO_OF_CPUS_WILDCARD.- See Also:
- Constant Field Values
-
TMP_DIR_WILDCARD
public static final java.lang.String TMP_DIR_WILDCARD
The Constant TMP_DIR_WILDCARD.- See Also:
- Constant Field Values
-
JAVA_HOME_DIR_WILDCARD
public static final java.lang.String JAVA_HOME_DIR_WILDCARD
The Constant JAVA_HOME_DIR_WILDCARD.- See Also:
- Constant Field Values
-
POSITIVE_INFINITY_WILDCARD1
public static final java.lang.String POSITIVE_INFINITY_WILDCARD1
The Constant POSITIVE_INFINITY_WILDCARD1.- See Also:
- Constant Field Values
-
POSITIVE_INFINITY_WILDCARD2
public static final java.lang.String POSITIVE_INFINITY_WILDCARD2
The Constant POSITIVE_INFINITY_WILDCARD2.- See Also:
- Constant Field Values
-
NEGATIVE_INFINITY_WILDCARD
public static final java.lang.String NEGATIVE_INFINITY_WILDCARD
The Constant NEGATIVE_INFINITY_WILDCARD.- See Also:
- Constant Field Values
-
MAX_HEAP_SIZE_WILDCARD
public static final java.lang.String MAX_HEAP_SIZE_WILDCARD
The Constant MAX_HEAP_SIZE_WILDCARD.- See Also:
- Constant Field Values
-
JAVA_HOME
public static final java.lang.String JAVA_HOME
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTotalPhysicalMemorySize
public static java.util.OptionalLong getTotalPhysicalMemorySize()
-
replaceWildcards
public static java.lang.Object replaceWildcards(java.lang.Class<?> type, java.lang.Object given)Replaces a given wildcard value with the value the wildcard represents.- Parameters:
type- the type of given valuegiven- the given value, must not benull- Returns:
- the value of given wildcard. If given value is not a wildcard, given value is returned as is.
-
parseRaw
public static java.util.Map<java.lang.String,java.lang.Object> parseRaw(java.io.InputStream is) throws java.io.IOExceptionParses an input stream into raw key/value pairs.- Parameters:
is- the input stream- Returns:
- the raw key/value pairs
- Throws:
java.io.IOException- Signals that an I/O exception has occurred.
-
parse
public static <F extends ConfigField> ParseResult<F> parse(java.util.Map<java.lang.String,java.lang.Object> raw, F[] fields, boolean strict, java.lang.String parent)
Parses raw key/value pairs into aParseResultobject.- Type Parameters:
F- the field enum this parsers uses- Parameters:
raw- the raw key/value input pairsfields- the fields to use for parsingstrict- the strict if true, parses in strict modeparent- the parent to resolve relative paths against- Returns:
- the parsing result
- Throws:
java.lang.IllegalArgumentException- if any input errors are encountered during parsing. Non-critical errors won't resolve in an exception if not parsing in strict mode.
-
parse
public static <F extends ConfigField> ParseResult<F> parse(java.util.Map<java.lang.String,java.lang.Object> raw, F[] fields, boolean strict, java.lang.String parent, boolean parseHiddenValues)
Parses raw key/value pairs into aParseResultobject.- Type Parameters:
F- the field enum this parsers uses- Parameters:
raw- the raw key/value input pairsfields- the fields to use for parsingstrict- the strict if true, parses in strict modeparent- the parent to resolve relative paths againstparseHiddenValues- whether hidden fields should be parse or not- Returns:
- the parsing result
- Throws:
java.lang.IllegalArgumentException- if any input errors are encountered during parsing. Non-critical errors won't resolve in an exception if not parsing in strict mode.
-
parse
public ParseResult<F> parse()
Starts parsing.- Returns:
- parsing result
-
getValues
public java.util.Map<F,java.lang.Object> getValues()
Description copied from interface:ParseResultGets the parsed values.- Specified by:
getValuesin interfaceParseResult<F extends ConfigField>- Returns:
- the values (includes default values)
-
getDefaults
public java.util.Set<F> getDefaults()
Description copied from interface:ParseResultGets the set of optional fields whose defaults where used during parsing.- Specified by:
getDefaultsin interfaceParseResult<F extends ConfigField>- Returns:
- the defaults
-
-