Package cern.nxcals.api.utils
Class EncodingUtils
- java.lang.Object
-
- cern.nxcals.api.utils.EncodingUtils
-
public final class EncodingUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
decodeFields(java.lang.String fieldPath)
Decode parts in fieldPath which are encodedstatic java.lang.String
desanitizeIfNeeded(java.lang.String fieldName)
Decode field name if is encodedstatic java.lang.String
encodeFields(java.lang.String fieldPath)
If path contains fields with special characters, then it will be encoded.static java.lang.String
sanitizeIfNeeded(java.lang.String fieldName)
Encode field name if contains not allowed characters
-
-
-
Method Detail
-
encodeFields
public static java.lang.String encodeFields(java.lang.String fieldPath)
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
public static java.lang.String decodeFields(java.lang.String fieldPath)
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
public static java.lang.String desanitizeIfNeeded(java.lang.String fieldName)
Decode field name if is encoded- Parameters:
fieldName
- possible encoded field name- Returns:
- field name in decoded form
-
sanitizeIfNeeded
public static java.lang.String sanitizeIfNeeded(java.lang.String fieldName)
Encode field name if contains not allowed characters- Parameters:
fieldName
- field name to encode- Returns:
- encoded (if contained illegal characters) field name
-
-