Class ResNameUtils

java.lang.Object
jadx.core.xmlgen.ResNameUtils

class ResNameUtils extends Object
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static String
    Converts the resource name to a field name of the R class.
    private static boolean
    Determines whether the code point may be part of a resource name as other than the first character (aapt2).
    private static boolean
    Determines whether the code point may be part of a resource name as the first character (aapt2).
    private static boolean
    isValidResourceNamePart(int codePoint, boolean allowNonPrintable)
    Determines whether the code point may be part of a resource name as other than the first character (aapt2 + R class gen).
    private static boolean
    isValidResourceNameStart(int codePoint, boolean allowNonPrintable)
    Determines whether the code point may be part of a resource name as the first character (aapt2 + R class gen).
    private static boolean
    isXidContinue(int codePoint)
     
    private static boolean
    isXidStart(int codePoint)
     
    (package private) static String
    sanitizeAsResourceName(String name, String postfix, boolean allowNonPrintable)
    Sanitizes the name so that it can be used as a resource name.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ResNameUtils

      private ResNameUtils()
  • Method Details

    • sanitizeAsResourceName

      static String sanitizeAsResourceName(String name, String postfix, boolean allowNonPrintable)
      Sanitizes the name so that it can be used as a resource name. By resource name is meant that:
      • It can be used by aapt2 as a resource entry name.
      • It can be converted to a valid R class field name.

      If the name is already a valid resource name, the method returns it unchanged. If not, the method creates a valid resource name based on name, appends the postfix, and returns the result.

    • convertToRFieldName

      static String convertToRFieldName(String resourceName)
      Converts the resource name to a field name of the R class.
    • isValidResourceNameStart

      private static boolean isValidResourceNameStart(int codePoint, boolean allowNonPrintable)
      Determines whether the code point may be part of a resource name as the first character (aapt2 + R class gen).
    • isValidResourceNamePart

      private static boolean isValidResourceNamePart(int codePoint, boolean allowNonPrintable)
      Determines whether the code point may be part of a resource name as other than the first character (aapt2 + R class gen).
    • isValidAapt2ResourceNameStart

      private static boolean isValidAapt2ResourceNameStart(int codePoint)
      Determines whether the code point may be part of a resource name as the first character (aapt2).

      Source: aapt2/text/Unicode.cpp#L112

    • isValidAapt2ResourceNamePart

      private static boolean isValidAapt2ResourceNamePart(int codePoint)
      Determines whether the code point may be part of a resource name as other than the first character (aapt2).

      Source: aapt2/text/Unicode.cpp#L118

    • isXidStart

      private static boolean isXidStart(int codePoint)
    • isXidContinue

      private static boolean isXidContinue(int codePoint)