Class EncodingUtils

java.lang.Object
cern.nxcals.api.utils.EncodingUtils

public final class EncodingUtils extends Object
  • Method Details

    • encodeFields

      public static String encodeFields(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 String decodeFields(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 String desanitizeIfNeeded(String fieldName)
      Decode field name if is encoded
      Parameters:
      fieldName - possible encoded field name
      Returns:
      field name in decoded form
    • sanitizeIfNeeded

      public static String sanitizeIfNeeded(String fieldName)
      Encode field name if contains not allowed characters
      Parameters:
      fieldName - field name to encode
      Returns:
      encoded (if contained illegal characters) field name