Package cern.nxcals.api.utils
Class EncodingUtils
java.lang.Object
cern.nxcals.api.utils.EncodingUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringdecodeFields(String fieldPath) Decode parts in fieldPath which are encodedstatic StringdesanitizeIfNeeded(String fieldName) Decode field name if is encodedstatic StringencodeFields(String fieldPath) If path contains fields with special characters, then it will be encoded.static StringsanitizeIfNeeded(String fieldName) Encode field name if contains not allowed characters
-
Method Details
-
encodeFields
If path contains fields with special characters, then it will be encoded. If field contain special character, then should be surrounded by '`' like it is in Spark. So that to access field "nestedAndEncod.ed" in such structure: A |-B |-nestedAndEncod.ed in query must be typed as "A.B.`nestedAndEncod.ed`"- Parameters:
fieldPath- raw path with fields with special characters surrounded by '`' like "A.B.`nestedAndEncod.ed`"- Returns:
- path with encoded parts, which was surrounded by '`'
-
decodeFields
Decode parts in fieldPath which are encoded- Parameters:
fieldPath- fieldPath (possibly nested) with encoded parts- Returns:
- fieldPath with decoded fields, decoded parts are surrounded by '`'
-
desanitizeIfNeeded
Decode field name if is encoded- Parameters:
fieldName- possible encoded field name- Returns:
- field name in decoded form
-
sanitizeIfNeeded
Encode field name if contains not allowed characters- Parameters:
fieldName- field name to encode- Returns:
- encoded (if contained illegal characters) field name
-