Class NameModifierImpl

  • All Implemented Interfaces:
    NameModifier

    public class NameModifierImpl
    extends java.lang.Object
    implements NameModifier
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String prefix  
      private java.lang.String suffix  
    • Constructor Summary

      Constructors 
      Constructor Description
      NameModifierImpl()  
      NameModifierImpl​(java.lang.String pattern)
      Construct a NameModifier from a pattern of the form xxx%xxx.
      NameModifierImpl​(java.lang.String prefix, java.lang.String suffix)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean invalidChar​(char ch, boolean isFirst)
      Return true if ch is invalid as a character in an identifier.
      java.lang.String makeName​(java.lang.String base)
      Create a modified name from the base name.
      • Methods inherited from class java.lang.Object

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

      • prefix

        private java.lang.String prefix
      • suffix

        private java.lang.String suffix
    • Constructor Detail

      • NameModifierImpl

        public NameModifierImpl()
      • NameModifierImpl

        public NameModifierImpl​(java.lang.String prefix,
                                java.lang.String suffix)
      • NameModifierImpl

        public NameModifierImpl​(java.lang.String pattern)
        Construct a NameModifier from a pattern of the form xxx%xxx. The pattern must consist of characters chosen from the set [A-Za-z0-9%$_]. In addition, the pattern must contain exactly one % character. Finally, if % is not the first char in the pattern, the pattern must not start with a number.

        The semantics of makeName are very simply: just replace the % character with the base in the pattern and return the result.

    • Method Detail

      • invalidChar

        private boolean invalidChar​(char ch,
                                    boolean isFirst)
        Return true if ch is invalid as a character in an identifier. If ch is a number, it is invalid only if isFirst is true.
      • makeName

        public java.lang.String makeName​(java.lang.String base)
        Description copied from interface: NameModifier
        Create a modified name from the base name.
        Specified by:
        makeName in interface NameModifier