Class JavaMember

java.lang.Object
uno.anahata.asi.nb.tools.java.JavaType
uno.anahata.asi.nb.tools.java.JavaMember

public class JavaMember extends JavaType
A lightweight, serializable "keychain" DTO that uniquely identifies a Java class member (field, method, constructor, etc.). By extending JavaType, members that represent types (classes, interfaces, enums) can be used directly as roots for further exploration.
Author:
anahata
  • Field Details

    • name

      private String name
      The simple name of the member (e.g., "myField", "myMethod").
    • kind

      private ElementKind kind
      The kind of the member (e.g., FIELD, METHOD, CONSTRUCTOR).
    • modifiers

      private Set<String> modifiers
      The set of modifiers for this member (e.g., "public", "static", "default").
  • Constructor Details

    • JavaMember

      public JavaMember(org.netbeans.api.java.source.ElementHandle<? extends Element> handle, String fqn, String name, ElementKind kind, URL url, Set<String> modifiers)
      Constructs a new JavaMember.
      Parameters:
      handle - the element handle.
      fqn - the fully qualified name of the member.
      name - the member name.
      kind - the member kind.
      url - the class file URL.
      modifiers - the set of modifiers.
  • Method Details

    • getSource

      public JavaMemberSource getSource() throws Exception
      Gets the source information for this type.

      This implementation specializes the source retrieval for class members, returning a JavaMemberSource which extracts only the member's specific source code fragment from the containing file.

      Overrides:
      getSource in class JavaType
      Returns:
      a JavaTypeSource object.
      Throws:
      Exception - if the source cannot be found.
    • getJavadoc

      public JavaMemberDocs getJavadoc() throws Exception
      Gets the Javadoc for this type.

      This implementation specializes the Javadoc retrieval for class members, returning a JavaMemberDocs which leverages the element handle to fish the member's specific documentation from sources or index.

      Overrides:
      getJavadoc in class JavaType
      Returns:
      a JavaTypeDocs object.
      Throws:
      Exception - if the Javadoc cannot be retrieved.