예제 #1
0
    def compile_method(self, method):
        signature = util.StringBuilder()

        for annotation in method.annotations:
            formatter.output_annotation(annotation, signature)

        formatter.output_modifiers(method.modifiers, signature)
        signature.append(' ')

        if method.type_parameters:
            formatter.output_type_params(method.type_parameters, signature)
            signature.append(' ')

        formatter.output_type(method.return_type, signature)
        signature.append(' ')

        signature.append(method.name)

        signature.append('(')
        formatter.output_list(formatter.output_formal_param, method.parameters,
                              signature, ', ')
        signature.append(')')

        if method.throws:
            signature.append(' throws ')
            formatter.output_list(formatter.output_exception, method.throws,
                                  signature, ', ')

        doc = self.__output_doc(method)

        directive = util.Directive('java:method', signature.build())
        directive.add_content(doc)

        return directive
예제 #2
0
    def compile_method(self, method):
        signature = util.StringBuilder()

        for annotation in method.annotations:
            formatter.output_annotation(annotation, signature)

        formatter.output_modifiers(method.modifiers, signature)
        signature.append(' ')

        if method.type_parameters:
            formatter.output_type_params(method.type_parameters, signature)
            signature.append(' ')

        formatter.output_type(method.return_type, signature)
        signature.append(' ')

        signature.append(method.name)

        signature.append('(')
        formatter.output_list(formatter.output_formal_param, method.parameters, signature, ', ')
        signature.append(')')

        if method.throws:
            signature.append(' throws ')
            formatter.output_list(formatter.output_exception, method.throws, signature, ', ')

        doc = self.__output_doc(method)

        directive = util.Directive('java:method', signature.build())
        directive.add_content(doc)

        return directive
예제 #3
0
    def compile_constructor(self, constructor):
        signature = util.StringBuilder()

        for annotation in constructor.annotations:
            formatter.output_annotation(annotation, signature)

        formatter.output_modifiers(constructor.modifiers, signature)
        signature.append(' ')

        if constructor.type_parameters:
            formatter.output_type_params(constructor.type_parameters,
                                         signature)
            signature.append(' ')

        signature.append(constructor.name)

        signature.append('(')
        formatter.output_list(formatter.output_formal_param,
                              constructor.parameters, signature, ', ')
        signature.append(')')

        if constructor.throws:
            signature.append(' throws ')
            formatter.output_list(formatter.output_exception,
                                  constructor.throws, signature, ', ')

        doc = self.__output_doc(constructor)

        directive = util.Directive('java:constructor', signature.build())
        directive.add_content(doc)

        return directive
예제 #4
0
    def compile_constructor(self, constructor):
        signature = util.StringBuilder()

        for annotation in constructor.annotations:
            formatter.output_annotation(annotation, signature)

        formatter.output_modifiers(constructor.modifiers, signature)
        signature.append(' ')

        if constructor.type_parameters:
            formatter.output_type_params(constructor.type_parameters, signature)
            signature.append(' ')

        signature.append(constructor.name)

        signature.append('(')
        formatter.output_list(formatter.output_formal_param, constructor.parameters, signature, ', ')
        signature.append(')')

        if constructor.throws:
            signature.append(' throws ')
            formatter.output_list(formatter.output_exception, constructor.throws, signature, ', ')

        doc = self.__output_doc(constructor)

        directive = util.Directive('java:constructor', signature.build())
        directive.add_content(doc)

        return directive
예제 #5
0
    def compile_enum_constant(self, enum, constant):
        signature = util.StringBuilder()

        for annotation in constant.annotations:
            formatter.output_annotation(annotation, signature)

        # All enum constants are public, static, and final
        signature.append('public static final ')
        signature.append(enum)
        signature.append(' ')
        signature.append(constant.name)

        doc = self.__output_doc(constant)

        directive = util.Directive('java:field', signature.build())
        directive.add_content(doc)

        return directive
예제 #6
0
    def compile_enum_constant(self, enum, constant):
        signature = util.StringBuilder()

        for annotation in constant.annotations:
            formatter.output_annotation(annotation, signature)

        # All enum constants are public, static, and final
        signature.append('public static final ')
        signature.append(enum)
        signature.append(' ')
        signature.append(constant.name)

        doc = self.__output_doc(constant)

        directive = util.Directive('java:field', signature.build())
        directive.add_content(doc)

        return directive
예제 #7
0
    def compile_field(self, field):
        signature = util.StringBuilder()

        for annotation in field.annotations:
            formatter.output_annotation(annotation, signature)

        formatter.output_modifiers(field.modifiers, signature)
        signature.append(' ')

        formatter.output_type(field.type, signature)
        signature.append(' ')
        signature.append(field.declarators[0].name)

        doc = self.__output_doc(field)

        directive = util.Directive('java:field', signature.build())
        directive.add_content(doc)

        return directive
예제 #8
0
    def compile_field(self, field):
        signature = util.StringBuilder()

        for annotation in field.annotations:
            formatter.output_annotation(annotation, signature)

        formatter.output_modifiers(field.modifiers, signature)
        signature.append(' ')

        formatter.output_type(field.type, signature)
        signature.append(' ')
        signature.append(field.declarators[0].name)

        doc = self.__output_doc(field)

        directive = util.Directive('java:field', signature.build())
        directive.add_content(doc)

        return directive