Interface NodeWithMembers<N extends Node>

    • Method Detail

      • getMembers

        NodeList<BodyDeclaration<?>> getMembers()
        Returns:
        all members inside the braces of this node, like fields, methods, nested types, etc.
      • tryAddImportToParentCompilationUnit

        void tryAddImportToParentCompilationUnit​(Class<?> clazz)
      • addPrivateField

        default FieldDeclaration addPrivateField​(Class<?> typeClass,
                                                 String name)
        Add a private field to this.
        Parameters:
        typeClass - the type of the field
        name - the name of the field
        Returns:
        the FieldDeclaration created
      • addPrivateField

        default FieldDeclaration addPrivateField​(String type,
                                                 String name)
        Add a private field to this and automatically add the import of the type if needed.
        Parameters:
        type - the type of the field
        name - the name of the field
        Returns:
        the FieldDeclaration created
      • addPrivateField

        default FieldDeclaration addPrivateField​(Type type,
                                                 String name)
        Add a private field to this.
        Parameters:
        type - the type of the field
        name - the name of the field
        Returns:
        the FieldDeclaration created
      • addPublicField

        default FieldDeclaration addPublicField​(Class<?> typeClass,
                                                String name)
        Add a public field to this.
        Parameters:
        typeClass - the type of the field
        name - the name of the field
        Returns:
        the FieldDeclaration created
      • addPublicField

        default FieldDeclaration addPublicField​(String type,
                                                String name)
        Add a public field to this and automatically add the import of the type if needed.
        Parameters:
        type - the type of the field
        name - the name of the field
        Returns:
        the FieldDeclaration created
      • addPublicField

        default FieldDeclaration addPublicField​(Type type,
                                                String name)
        Add a public field to this.
        Parameters:
        type - the type of the field
        name - the name of the field
        Returns:
        the FieldDeclaration created
      • addProtectedField

        default FieldDeclaration addProtectedField​(Class<?> typeClass,
                                                   String name)
        Add a protected field to this.
        Parameters:
        typeClass - the type of the field
        name - the name of the field
        Returns:
        the FieldDeclaration created
      • addProtectedField

        default FieldDeclaration addProtectedField​(String type,
                                                   String name)
        Add a protected field to this and automatically add the import of the type if needed.
        Parameters:
        type - the type of the field
        name - the name of the field
        Returns:
        the FieldDeclaration created
      • addProtectedField

        default FieldDeclaration addProtectedField​(Type type,
                                                   String name)
        Add a protected field to this.
        Parameters:
        type - the type of the field
        name - the name of the field
        Returns:
        the FieldDeclaration created
      • getMethodsByName

        default List<MethodDeclaration> getMethodsByName​(String name)
        Try to find a MethodDeclaration by its name
        Parameters:
        name - the name of the method
        Returns:
        the methods found (multiple in case of overloading)
      • getMethods

        default List<MethodDeclaration> getMethods()
        Find all methods in the members of this node.
        Returns:
        the methods found. This list is immutable.
      • getMethodsByParameterTypes

        default List<MethodDeclaration> getMethodsByParameterTypes​(String... paramTypes)
        Try to find a MethodDeclaration by its parameters types
        Parameters:
        paramTypes - the types of parameters like "Map<Integer,String>","int" to match
        void foo(Map<Integer,String> myMap,int number)
        Returns:
        the methods found (multiple in case of overloading)
      • getMethodsBySignature

        default List<MethodDeclaration> getMethodsBySignature​(String name,
                                                              String... paramTypes)
        Try to find MethodDeclarations by their name and parameters types
        Parameters:
        paramTypes - the types of parameters like "Map<Integer,String>","int" to match
        void foo(Map<Integer,String> myMap,int number)
        Returns:
        the methods found (multiple in case of overloading)
      • getMethodsByParameterTypes

        default List<MethodDeclaration> getMethodsByParameterTypes​(Class<?>... paramTypes)
        Try to find a MethodDeclaration by its parameters types
        Parameters:
        paramTypes - the types of parameters like "Map<Integer,String>","int" to match
        void foo(Map<Integer,String> myMap,int number)
        Returns:
        the methods found (multiple in case of overloading)
      • getFields

        default List<FieldDeclaration> getFields()
        Find all fields in the members of this node.
        Returns:
        the fields found. This list is immutable.