Class ImplJAnonymousClassDef

All Implemented Interfaces:
AllowedStatementExpression, JAnnotatable, JAnonymousClassDef, JCall, JClassDef, JClassDefSection, JCommentable, JDocCommentable, JExpr, JGenericDef, JSimpleArgs, Writable
Direct Known Subclasses:
InnerJAnonymousClassDef

class ImplJAnonymousClassDef extends AbstractJCall implements JAnonymousClassDef
  • Field Details

  • Constructor Details

    • ImplJAnonymousClassDef

      ImplJAnonymousClassDef(JType type)
  • Method Details

    • type

      public JType type()
    • write

      public void write(SourceFileWriter writer) throws IOException
      Specified by:
      write in interface Writable
      Overrides:
      write in class AbstractJCall
      Throws:
      IOException
    • section

      public JClassDefSection section()
      Description copied from interface: JClassDefSection
      Create a section at this point, into which additional items may be added.
      Specified by:
      section in interface JClassDefSection
      Returns:
      the new section to add
    • _extends

      public JClassDef _extends(String name)
      Description copied from interface: JClassDef
      Add an extends type to this type.
      Specified by:
      _extends in interface JClassDef
      Parameters:
      name - the type name
      Returns:
      this type definition
    • _extends

      public JClassDef _extends(JType type)
      Description copied from interface: JClassDef
      Add an extends type to this type.
      Specified by:
      _extends in interface JClassDef
      Parameters:
      type - the type
      Returns:
      this type definition
    • _extends

      public JClassDef _extends(Class<?> clazz)
      Description copied from interface: JClassDef
      Add an extends type to this type.
      Specified by:
      _extends in interface JClassDef
      Parameters:
      clazz - the type
      Returns:
      this type definition
    • _implements

      public JClassDef _implements(String... names)
      Description copied from interface: JClassDef
      Add one or more implements type(s) to this type.
      Specified by:
      _implements in interface JClassDef
      Parameters:
      names - the type name
      Returns:
      this type definition
    • _implements

      public JClassDef _implements(JType... types)
      Description copied from interface: JClassDef
      Add one or more implements type(s) to this type.
      Specified by:
      _implements in interface JClassDef
      Parameters:
      types - the type
      Returns:
      this type definition
    • _implements

      public JClassDef _implements(Class<?>... classes)
      Description copied from interface: JClassDef
      Add one or more implements type(s) to this type.
      Specified by:
      _implements in interface JClassDef
      Parameters:
      classes - the type
      Returns:
      this type definition
    • erasedType

      public JType erasedType()
      Description copied from interface: JClassDef
      Get the erased type corresponding to this type definition.
      Specified by:
      erasedType in interface JClassDef
      Returns:
      the erased type
    • blankLine

      public JClassDef blankLine()
      Description copied from interface: JClassDef
      Add a blank line at this point of the type.
      Specified by:
      blankLine in interface JClassDef
      Specified by:
      blankLine in interface JClassDefSection
      Returns:
      this type definition
    • genericType

      public JType genericType()
      Description copied from interface: JClassDef
      Get a generic type for this type definition, where the type arguments are the same as the type parameters of this type (as defined at the time this method is called).
      Specified by:
      genericType in interface JClassDef
      Returns:
      the generic type
    • typeParam

      public JTypeParamDef typeParam(String name)
      Description copied from interface: JGenericDef
      Define a type parameter.
      Specified by:
      typeParam in interface JGenericDef
      Parameters:
      name - the type parameter name
      Returns:
      the type parameter definition
    • init

      public JBlock init()
      Description copied from interface: JClassDefSection
      Add a "raw" initialization block to this type definition.
      Specified by:
      init in interface JClassDefSection
      Returns:
      the initialization block
    • staticInit

      public JBlock staticInit()
      Description copied from interface: JClassDefSection
      Add a static initialization block to this type definition.
      Specified by:
      staticInit in interface JClassDefSection
      Returns:
      the static initialization block
    • _enum

      public JEnumConstant _enum(String name)
      Description copied from interface: JClassDef
      Add an enum constant. If the class being defined is not an enum, an exception is thrown.
      Specified by:
      _enum in interface JClassDef
      Parameters:
      name - the constant name
      Returns:
      the call for enum construction
    • field

      public JVarDeclaration field(int mods, JType type, String name)
      Description copied from interface: JClassDefSection
      Add a field to this type.
      Specified by:
      field in interface JClassDefSection
      Parameters:
      mods - the modifiers
      type - the field type
      name - the field name
      Returns:
      the field declaration
    • field

      public JVarDeclaration field(int mods, JType type, String name, JExpr init)
      Description copied from interface: JClassDefSection
      Add a field to this type.
      Specified by:
      field in interface JClassDefSection
      Parameters:
      mods - the modifiers
      type - the field type
      name - the field name
      init - the field assigned value
      Returns:
      the field declaration
    • field

      public JVarDeclaration field(int mods, Class<?> type, String name)
      Description copied from interface: JClassDefSection
      Add a field to this type.
      Specified by:
      field in interface JClassDefSection
      Parameters:
      mods - the modifiers
      type - the field type
      name - the field name
      Returns:
      the field declaration
    • field

      public JVarDeclaration field(int mods, Class<?> type, String name, JExpr init)
      Description copied from interface: JClassDefSection
      Add a field to this type.
      Specified by:
      field in interface JClassDefSection
      Parameters:
      mods - the modifiers
      type - the field type
      name - the field name
      init - the field assigned value
      Returns:
      the field declaration
    • field

      public JVarDeclaration field(int mods, String type, String name)
      Description copied from interface: JClassDefSection
      Add a field to this type.
      Specified by:
      field in interface JClassDefSection
      Parameters:
      mods - the modifiers
      type - the field type
      name - the field name
      Returns:
      the field declaration
    • field

      public JVarDeclaration field(int mods, String type, String name, JExpr init)
      Description copied from interface: JClassDefSection
      Add a field to this type.
      Specified by:
      field in interface JClassDefSection
      Parameters:
      mods - the modifiers
      type - the field type
      name - the field name
      init - the field assigned value
      Returns:
      the field declaration
    • method

      public JMethodDef method(int mods, JType returnType, String name)
      Description copied from interface: JClassDefSection
      Add a method to this type.
      Specified by:
      method in interface JClassDefSection
      Parameters:
      mods - the modifiers
      returnType - the method return type
      name - the method name
      Returns:
      the method definition
    • method

      public JMethodDef method(int mods, Class<?> returnType, String name)
      Description copied from interface: JClassDefSection
      Add a method to this type.
      Specified by:
      method in interface JClassDefSection
      Parameters:
      mods - the modifiers
      returnType - the method return type
      name - the method name
      Returns:
      the method definition
    • method

      public JMethodDef method(int mods, String returnType, String name)
      Description copied from interface: JClassDefSection
      Add a method to this type.
      Specified by:
      method in interface JClassDefSection
      Parameters:
      mods - the modifiers
      returnType - the method return type
      name - the method name
      Returns:
      the method definition
    • constructor

      public JMethodDef constructor(int mods)
      Description copied from interface: JClassDefSection
      Add a constructor to this type.
      Specified by:
      constructor in interface JClassDefSection
      Parameters:
      mods - the modifiers
      Returns:
      the constructor definition
    • typeParams

      public JTypeParamDef[] typeParams()
      Description copied from interface: JGenericDef
      Get all the type parameters defined at the time of invocation.
      Specified by:
      typeParams in interface JGenericDef
      Returns:
      the type parameters
    • annotate

      public JAnnotation annotate(String type)
      Description copied from interface: JAnnotatable
      Add an annotation.
      Specified by:
      annotate in interface JAnnotatable
      Parameters:
      type - the type of the annotation to add
      Returns:
      the new annotation
    • annotate

      public JAnnotation annotate(JType type)
      Description copied from interface: JAnnotatable
      Add an annotation.
      Specified by:
      annotate in interface JAnnotatable
      Parameters:
      type - the type of the annotation to add
      Returns:
      the new annotation
    • annotate

      public JAnnotation annotate(Class<? extends Annotation> type)
      Description copied from interface: JAnnotatable
      Add an annotation.
      Specified by:
      annotate in interface JAnnotatable
      Parameters:
      type - the type of the annotation to add
      Returns:
      the new annotation
    • docComment

      public JDocComment docComment()
      Description copied from interface: JDocCommentable
      Get or create the doc comment for this element.
      Specified by:
      docComment in interface JDocCommentable
      Returns:
      the doc comment body
    • deprecated

      public JComment deprecated()
      Description copied from interface: JDocCommentable
      Mark this program element as deprecated.
      Specified by:
      deprecated in interface JDocCommentable
      Returns:
      the deprecation tag body
    • lineComment

      public JComment lineComment()
      Description copied from interface: JCommentable
      Add a line comment.
      Specified by:
      lineComment in interface JCommentable
      Overrides:
      lineComment in class AbstractJCall
      Returns:
      the line comment body
    • blockComment

      public JComment blockComment()
      Description copied from interface: JCommentable
      Add a block comment.
      Specified by:
      blockComment in interface JCommentable
      Overrides:
      blockComment in class AbstractJCall
      Returns:
      the block comment body
    • _class

      public JClassDef _class(int mods, String name)
      Description copied from interface: JClassDefSection
      Add a nested class to this type.
      Specified by:
      _class in interface JClassDefSection
      Parameters:
      mods - the class modifiers
      name - the class name
      Returns:
      the nested class
    • _enum

      public JClassDef _enum(int mods, String name)
      Description copied from interface: JClassDefSection
      Add a nested enum to this type.
      Specified by:
      _enum in interface JClassDefSection
      Parameters:
      mods - the enum modifiers
      name - the enum name
      Returns:
      the nested enum
    • _interface

      public JClassDef _interface(int mods, String name)
      Description copied from interface: JClassDefSection
      Add a nested interface to this type.
      Specified by:
      _interface in interface JClassDefSection
      Parameters:
      mods - the interface modifiers
      name - the interface name
      Returns:
      the nested interface
    • annotationInterface

      public JClassDef annotationInterface(int mods, String name)
      Description copied from interface: JClassDefSection
      Add a nested annotation interface to this type.
      Specified by:
      annotationInterface in interface JClassDefSection
      Parameters:
      mods - the annotation interface modifiers
      name - the annotation interface name
      Returns:
      the nested annotation interface