Package io.permazen.cli.parse
Class ParseUtil
java.lang.Object
io.permazen.cli.parse.ParseUtil
Parsing utility routines.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Regular expression that matches valid Java identifiers. -
Method Summary
Modifier and TypeMethodDescriptioncomplete
(Collection<String> choices, String prefix) Generate completions based on a set of possibilities and the provided input prefix.Generate completions based on a set of possibilities and the provided input prefix.static Class<?>
getArrayClass
(Class<?> base, int dims) Get the array class with the given non-array base type and dimensions.static Field<?>
resolveField
(Session session, ObjId id, String fieldName) Locate the field with the given name in the specified object.static PermazenField
resolveJField
(Session session, ObjId id, String name) Locate thePermazenField
with the given name in the specified object.
-
Field Details
-
IDENT_PATTERN
Regular expression that matches valid Java identifiers.- See Also:
-
-
Method Details
-
complete
Generate completions based on a set of possibilities and the provided input prefix.- Parameters:
choices
- possible choicesprefix
- prefix input so far- Returns:
- possible completions
-
complete
Generate completions based on a set of possibilities and the provided input prefix.- Parameters:
choices
- possible choicesprefix
- prefix input so far- Returns:
- possible completions
-
resolveJField
Locate thePermazenField
with the given name in the specified object.- Parameters:
session
- current sessionid
- object IDname
- field name- Returns:
- the specified field
- Throws:
IllegalArgumentException
- if object does not existIllegalArgumentException
- if object's type does not exist in schemaIllegalArgumentException
- if field is not foundIllegalArgumentException
- if any parameter is nullIllegalArgumentException
- ifstate
is not inSessionMode.PERMAZEN
-
resolveField
Locate the field with the given name in the specified object.- Parameters:
session
- current sessionid
- object IDfieldName
- field name- Returns:
- the specified field
- Throws:
IllegalArgumentException
- if object does not existIllegalArgumentException
- if field is not foundIllegalArgumentException
- if any parameter is null
-
getArrayClass
Get the array class with the given non-array base type and dimensions.- Parameters:
base
- base typedims
- number of dimensions- Returns:
- the corresponding array type, or
base
ifdims
is zero - Throws:
IllegalArgumentException
- ifbase
is nullIllegalArgumentException
- ifbase
is an array typeIllegalArgumentException
- ifbase
isvoid
anddims > 0
IllegalArgumentException
- ifdims
is not in the range 0..255
-