Class AbstractJClassDef

    • Field Detail

      • mods

        private final int mods
      • name

        private final java.lang.String name
      • content

        private final java.util.ArrayList<ClassContent> content
      • _extends

        private JType _extends
      • _implements

        private java.util.ArrayList<JType> _implements
      • erased

        private JType erased
      • generic

        private JType generic
    • Constructor Detail

      • AbstractJClassDef

        AbstractJClassDef​(int mods,
                          java.lang.String name)
      • AbstractJClassDef

        AbstractJClassDef​(int mods,
                          AbstractJClassDef enclosingClass,
                          java.lang.String name)
      • AbstractJClassDef

        AbstractJClassDef​(int mods,
                          ImplJSourceFile classFile,
                          java.lang.String name)
    • Method Detail

      • getMods

        int getMods()
      • getName

        java.lang.String getName()
      • _extends

        public JClassDef _extends​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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
      • 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
      • init

        public final 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 final 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​(java.lang.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 final JVarDeclaration field​(int mods,
                                           JType type,
                                           java.lang.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 final JVarDeclaration field​(int mods,
                                           JType type,
                                           java.lang.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 final JVarDeclaration field​(int mods,
                                           java.lang.Class<?> type,
                                           java.lang.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 final JVarDeclaration field​(int mods,
                                           java.lang.Class<?> type,
                                           java.lang.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 final JVarDeclaration field​(int mods,
                                           java.lang.String type,
                                           java.lang.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 final JVarDeclaration field​(int mods,
                                           java.lang.String type,
                                           java.lang.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 final JMethodDef method​(int mods,
                                       JType returnType,
                                       java.lang.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 final JMethodDef method​(int mods,
                                       java.lang.Class<?> returnType,
                                       java.lang.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 final JMethodDef method​(int mods,
                                       java.lang.String returnType,
                                       java.lang.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
      • methodCanHaveBody

        boolean methodCanHaveBody​(int mods)
      • hasInterfaceStyleExtends

        boolean hasInterfaceStyleExtends()
      • supportsCompactInitOnly

        boolean supportsCompactInitOnly()
      • constructor

        public final 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
      • _class

        public final JClassDef _class​(int mods,
                                      java.lang.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 final JClassDef _enum​(int mods,
                                     java.lang.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 final JClassDef _interface​(int mods,
                                          java.lang.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 final JClassDef annotationInterface​(int mods,
                                                   java.lang.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
      • getExtends

        JType getExtends()
      • getImplements

        java.lang.Iterable<JType> getImplements()
      • write

        public void write​(SourceFileWriter writer)
                   throws java.io.IOException
        Specified by:
        write in interface Writable
        Throws:
        java.io.IOException
      • writeContentBlock

        void writeContentBlock​(SourceFileWriter sourceFileWriter)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeClassHeader

        void writeClassHeader​(SourceFileWriter sourceFileWriter)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • writeContent

        void writeContent​(SourceFileWriter sourceFileWriter)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • getModifiers

        public int getModifiers()
      • hasAllModifiers

        public boolean hasAllModifiers​(int mods)
      • hasAnyModifier

        public boolean hasAnyModifier​(int mods)