Interface ClassEntry

All Superinterfaces:
AccessedEntry, DescribableEntry
All Known Implementing Classes:
BasicClassEntry, ReflectiveClassEntry, StaticFilteredClassEntry

public non-sealed interface ClassEntry extends AccessedEntry, DescribableEntry
Metadata model of a class type.
  • Method Details

    • getSuperEntry

      @Nullable ClassEntry getSuperEntry()
      Returns:
      Metadata model of the super-type, if available.
    • getImplementedEntries

      @Nonnull List<ClassEntry> getImplementedEntries()
      Returns:
      Metadata models of all implemented interface types.
    • getInnerClassEntries

      @Nonnull List<ClassEntry> getInnerClassEntries()
      Returns:
      Metadata models of all inner class declarations.
    • getName

      @Nonnull String getName()
      Returns:
      Name of class in internal format.
    • getPackageName

      @Nullable default String getPackageName()
      Returns:
      Name of the package in internal format that this class resides in. null for classes in the default package.
    • getDescriptor

      @Nonnull default String getDescriptor()
      Specified by:
      getDescriptor in interface DescribableEntry
      Returns:
      Type descriptor of this entry.
    • isInterface

      default boolean isInterface()
    • getDeclaredFields

      @Nonnull List<FieldEntry> getDeclaredFields()
      Returns:
      Metadata models of all declared fields.
    • getDeclaredMethods

      @Nonnull List<MethodEntry> getDeclaredMethods()
      Returns:
      Metadata models of all declared methods.
    • declaredMemberStream

      @Nonnull default Stream<MemberEntry> declaredMemberStream()
      Returns:
      Stream of all metadata models for declared fields and methods.
    • getField

      @Nullable default FieldEntry getField(@Nonnull String name, @Nonnull String desc)
      Parameters:
      name - Field name.
      desc - Field descriptor.
      Returns:
      Metadata model of the field, or null if no such field exists in this class or any parent class.
    • getField

      @Nullable default FieldEntry getField(@Nonnull String name, @Nonnull String desc, @Nullable Predicate<FieldEntry> filter)
      Parameters:
      name - Field name.
      desc - Field descriptor.
      filter - Optional filter to limit matches.
      Returns:
      Metadata model of the field, or null if no such field exists in this class or any parent class.
    • getDeclaredField

      @Nullable default FieldEntry getDeclaredField(@Nonnull String name, @Nonnull String desc)
      Parameters:
      name - Field name.
      desc - Field descriptor.
      Returns:
      Metadata model of the declared field, or null if no such field exists in this class.
    • getDeclaredField

      @Nullable default FieldEntry getDeclaredField(@Nonnull String name, @Nonnull String desc, @Nullable Predicate<FieldEntry> filter)
      Parameters:
      name - Field name.
      desc - Field descriptor.
      filter - Optional filter to limit matches.
      Returns:
      Metadata model of the declared field, or null if no such field exists in this class.
    • getDeclaredFieldsByName

      @Nonnull default List<FieldEntry> getDeclaredFieldsByName(@Nonnull String name)
      Parameters:
      name - Field name.
      Returns:
      All declared fields with the given name.
    • getMethod

      @Nullable default MethodEntry getMethod(@Nonnull String name, @Nonnull String desc)
      Parameters:
      name - Method name.
      desc - Method descriptor.
      Returns:
      Metadata model of the declared method, or null if no such method exists in this class or any parent class.
    • getMethod

      @Nullable default MethodEntry getMethod(@Nonnull String name, @Nonnull String desc, @Nullable Predicate<MethodEntry> filter)
      Parameters:
      name - Method name.
      desc - Method descriptor.
      filter - Optional filter to limit matches.
      Returns:
      Metadata model of the method, or null if no such method exists in this class or any parent class.
    • getDeclaredMethod

      @Nullable default MethodEntry getDeclaredMethod(@Nonnull String name, @Nonnull String desc)
      Parameters:
      name - Method name.
      desc - Method descriptor.
      Returns:
      Metadata model of the declared method, or null if no such method exists in this class.
    • getDeclaredMethod

      @Nullable default MethodEntry getDeclaredMethod(@Nonnull String name, @Nonnull String desc, @Nullable Predicate<MethodEntry> filter)
      Parameters:
      name - Method name.
      desc - Method descriptor.
      filter - Optional filter to limit matches.
      Returns:
      Metadata model of the declared method, or null if no such method exists in this class.
    • getDeclaredMethodsByName

      @Nonnull default List<MethodEntry> getDeclaredMethodsByName(@Nonnull String name)
      Parameters:
      name - Method name.
      Returns:
      All declared methods with the given name.
    • visitHierarchy

      default void visitHierarchy(@Nonnull Consumer<ClassEntry> consumer)
      Visits the current class, and all parent classes (extended or implemented).
      Parameters:
      consumer - Consumer to visit each class.
    • extendsOrImplementsName

      default boolean extendsOrImplementsName(@Nonnull String name)
      Parameters:
      name - Class name.
      Returns:
      true if this class extends or implements the requested class.
    • isAssignableFrom

      default boolean isAssignableFrom(@Nonnull DescribableEntry other)
      Description copied from interface: DescribableEntry
      Check if another entry is assignable to the type represented by this entry.
      Specified by:
      isAssignableFrom in interface DescribableEntry
      Parameters:
      other - Some other entry.
      Returns:
      true when the other entry is assignable to the type represented by this entry.
    • isAssignableFrom

      default boolean isAssignableFrom(@Nonnull ClassEntry child)
    • getCommonParent

      @Nonnull default ClassEntry getCommonParent(@Nonnull ClassEntry other)
      Parameters:
      other - Some other class entry.
      Returns:
      Common parent type shared between the two.