Class JavaSrcGenContext

  • All Implemented Interfaces:
    JContext

    public class JavaSrcGenContext
    extends JContextImpl
    Generates Java source code.
    • Constructor Detail

      • JavaSrcGenContext

        public JavaSrcGenContext()
    • Method Detail

      • classLiteral

        public JExpr classLiteral​(java.lang.Class<?> value)
      • classLiteral

        public JExpr classLiteral​(JClass value)
      • instanceOf

        public JExpr instanceOf​(JExpr arg,
                                java.lang.Class<?> toClass)
      • typeof

        public JExpr typeof​(java.lang.Class<?> type)
      • staticCall

        public JExpr staticCall​(java.lang.Class<?> cls,
                                java.lang.String method,
                                java.lang.Class<?> typeArgument,
                                JExpr... args)
      • enumLiteral

        public JExpr enumLiteral​(java.lang.Object value)
      • annotation

        public JAnnotation annotation​(java.lang.Class<?> clazz,
                                      java.lang.Object... args)
        Parameters:
        clazz - - the class of Annotation
        args - - Elements of the Annotation. Even elements are the keys. Odd elements are the values. One element if only value() parameter exists.
        Returns:
        JAnnotation's instance

        Example:

        Annotation
          public @interface TODO {
        String author ();
        String date ();
        int currentRevision ();
        String value ();
        }
        will be created as JContext.annotation (TODO.class, "author", "Author Name", "date", "2010-01-01", "currentRevision", 1, "value", "SOME VALUE")

        Annotation
          public @interface MappedTo {
        String value ();
        }
        will be created as JContext.annotation ("TE$$T")
      • translateType

        public java.lang.String translateType​(java.lang.String type)
      • printType

        protected void printType​(java.lang.String type,
                                 SourceCodePrinter out)
                          throws java.io.IOException
        Specified by:
        printType in class JContextImpl
        Throws:
        java.io.IOException
      • printType

        protected void printType​(java.lang.String type,
                                 java.lang.String[] typeArgs,
                                 SourceCodePrinter out)
                          throws java.io.IOException
        Specified by:
        printType in class JContextImpl
        Throws:
        java.io.IOException