Class IdentifierMangler


  • public final class IdentifierMangler
    extends java.lang.Object
    Checks identifiers for keywords etc and mangles them if so.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Set<java.lang.String> KEYWORDS  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private IdentifierMangler()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isReservedWord​(java.lang.String _name)
      Checks if given value is a reserved keyword in Java.
      static java.lang.String mangle​(java.lang.String _name)
      Checks if given name is a reserved word in Java.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • KEYWORDS

        private static final java.util.Set<java.lang.String> KEYWORDS
    • Constructor Detail

      • IdentifierMangler

        private IdentifierMangler()
    • Method Detail

      • isReservedWord

        public static boolean isReservedWord​(java.lang.String _name)
        Checks if given value is a reserved keyword in Java.
        Parameters:
        _name - name to check
        Returns:
        true if reserved
      • mangle

        public static java.lang.String mangle​(java.lang.String _name)
        Checks if given name is a reserved word in Java.

        If true, returns the given name with a "_" prepended. Otherwise returns the input string.

        Parameters:
        _name - name to check
        Returns:
        String