com.sun.tools.apt.mirror.declaration
Class Constants.Formatter

java.lang.Object
  extended by com.sun.tools.apt.mirror.declaration.Constants.Formatter
Enclosing class:
Constants

static class Constants.Formatter
extends java.lang.Object

Utility class used to generate the text of constant expressions. Also generates the text of constant "pseudo-expressions" for annotations and array-valued annotation elements.


Field Summary
private  java.lang.StringBuilder buf
           
 
Constructor Summary
private Constants.Formatter(java.lang.StringBuilder buf)
           
 
Method Summary
(package private)  void append(AnnotationMirrorImpl anno)
          Appends the text of an annotation pseudo-expression.
(package private)  void append(java.lang.Boolean val)
           
(package private)  void append(java.lang.Byte val)
           
(package private)  void append(java.lang.Character val)
          Appends a Character, escaped (as needed) and quoted.
(package private)  void append(java.util.Collection<?> vals)
          Appends the elements of a collection, enclosed within braces and separated by ", ".
(package private)  void append(java.lang.Double val)
           
(package private)  void append(EnumConstantDeclarationImpl e)
          Appends the fully qualified name of an enum constant.
(package private)  void append(java.lang.Float val)
           
(package private)  void append(java.lang.Integer val)
           
(package private)  void append(java.lang.Long val)
           
(package private)  void append(java.lang.Object val)
          Appends a constant whose type is not statically known by dispatching to the appropriate overloaded append method.
(package private)  void append(java.lang.Short val)
           
(package private)  void append(java.lang.String val)
          Appends a string, escaped (as needed) and quoted.
(package private)  void append(TypeMirrorImpl t)
          Appends the class literal corresponding to a type.
private  void appendUnquoted(char c)
          Appends a char (unquoted), using escapes for those that are not printable ASCII.
private  void appendUnquoted(java.lang.String s)
          For each char of a string, append using appendUnquoted(char).
private static boolean isPrintableAscii(char c)
          Is c a printable ASCII character?
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

buf

private java.lang.StringBuilder buf
Constructor Detail

Constants.Formatter

private Constants.Formatter(java.lang.StringBuilder buf)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

append

void append(java.lang.Object val)
Appends a constant whose type is not statically known by dispatching to the appropriate overloaded append method.


append

void append(java.lang.String val)
Appends a string, escaped (as needed) and quoted.


append

void append(java.lang.Character val)
Appends a Character, escaped (as needed) and quoted.


append

void append(java.lang.Boolean val)

append

void append(java.lang.Byte val)

append

void append(java.lang.Short val)

append

void append(java.lang.Integer val)

append

void append(java.lang.Long val)

append

void append(java.lang.Float val)

append

void append(java.lang.Double val)

append

void append(TypeMirrorImpl t)
Appends the class literal corresponding to a type. Should only be invoked for types that have an associated literal. e.g: "java.lang.String.class" "boolean.class" "int[].class"


append

void append(EnumConstantDeclarationImpl e)
Appends the fully qualified name of an enum constant. e.g: "java.math.RoundingMode.UP"


append

void append(AnnotationMirrorImpl anno)
Appends the text of an annotation pseudo-expression. e.g: "@pkg.Format(linesep='\n')"


append

void append(java.util.Collection<?> vals)
Appends the elements of a collection, enclosed within braces and separated by ", ". Useful for array-valued annotation elements.


appendUnquoted

private void appendUnquoted(java.lang.String s)
For each char of a string, append using appendUnquoted(char).


appendUnquoted

private void appendUnquoted(char c)
Appends a char (unquoted), using escapes for those that are not printable ASCII. We don't know what is actually printable in the locale in which this result will be used, so ASCII is our best guess as to the least common denominator.


isPrintableAscii

private static boolean isPrintableAscii(char c)
Is c a printable ASCII character?