Package org.jibx.util

Interface IClass

All Known Implementing Classes:
ClassSourceWrapper, ClassWrapper, DummyClassLocator.DummyClassInfo

public interface IClass
Interface for class file information. Provides access to class field and method information.
Author:
Dennis M. Sosnoski
  • Method Details

    • getClassFile

      ClassFile getClassFile()
      Get class file information. TODO: eliminate this sucker
      Returns:
      class file information
    • getName

      String getName()
      Get fully qualified class name.
      Returns:
      fully qualified name for class
    • getSignature

      String getSignature()
      Get signature for class as type.
      Returns:
      signature for class used as type
    • getPackage

      String getPackage()
      Get package name.
      Returns:
      package name for class
    • getSuperClass

      IClass getSuperClass()
      Get superclass.
      Returns:
      superclass information
    • getInterfaces

      String[] getInterfaces()
      Get names of all interfaces implemented directly by class.
      Returns:
      names of all interfaces implemented directly by class (non-null, empty array if none)
    • getInstanceSigs

      String[] getInstanceSigs()
      Get signatures for all types of which instances of this type are instances.
      Returns:
      all signatures supported by instances
    • isImplements

      boolean isImplements(String sig)
      Check if class implements an interface.
      Parameters:
      sig - signature of interface to be checked
      Returns:
      true if interface is implemented by class, false if not
    • isAbstract

      boolean isAbstract()
      Check if class is abstract.
      Returns:
      true if class is abstract, false if not
    • isInterface

      boolean isInterface()
      Check if class is an interface.
      Returns:
      true if class is an interface, false if not
    • isModifiable

      boolean isModifiable()
      Check if class is modifiable.
      Returns:
      true if class is modifiable, false if not
    • isSuperclass

      boolean isSuperclass(String name)
      Check if another class is a superclass of this one.
      Parameters:
      name - potential superclass to be checked
      Returns:
      true if named class is a superclass of this one, false if not
    • getDirectField

      IClassItem getDirectField(String name)
      Get information for field. This only checks for fields that are actually members of the class (not superclasses). TODO: make this work with both static and member fields
      Parameters:
      name - field name
      Returns:
      field information, or null if field not found
    • getField

      IClassItem getField(String name)
      Get information for field. If the field is not found directly, superclasses are checked for inherited fields matching the supplied name. TODO: make this work with both static and member fields
      Parameters:
      name - field name
      Returns:
      field information, or null if field not found
    • getBestMethod

      IClassItem getBestMethod(String name, String type, String[] args)
      Get information for best matching method. This tries to find a method which matches the specified name, return type, and argument types. If an exact match is not found it looks for a method with a return type that is extended or implemented by the specified type and arguments that are extended or implemented by the specified types. If no match is found for this class superclasses are checked. TODO: make this work with both static and member methods
      Parameters:
      name - method name
      type - return value type name (null if indeterminant)
      args - argument value type names (null if indeterminant)
      Returns:
      method information, or null if method not found
    • getMethod

      IClassItem getMethod(String name, String sig)
      Get information for method without respect to potential trailing arguments or return value. If the method is not found directly, superclasses are checked for inherited methods matching the supplied name. This compares the supplied partial signature against the actual method signature, and considers it a match if the actual sigature starts with the supplied signature. TODO: make this work with both static and member methods
      Parameters:
      name - method name
      sig - partial method signature to be matched
      Returns:
      method information, or null if method not found
    • getMethod

      IClassItem getMethod(String name, String[] sigs)
      Get information for method matching one of several possible signatures. If a match is not found directly, superclasses are checked for inherited methods matching the supplied name and signatures. The signature variations are checked in the order supplied. TODO: make this work with both static and member methods
      Parameters:
      name - method name
      sigs - possible signatures for method (including return type)
      Returns:
      method information, or null if method not found
    • getInitializerMethod

      IClassItem getInitializerMethod(String sig)
      Get information for initializer. Only the class itself is checked for an initializer matching the argument list signature.
      Parameters:
      sig - encoded argument list signature
      Returns:
      method information, or null if method not found
    • getStaticMethod

      IClassItem getStaticMethod(String name, String sig)
      Get information for static method without respect to return value. Only the class itself is checked for a method matching the supplied name and argument list signature.
      Parameters:
      name - method name
      sig - encoded argument list signature
      Returns:
      method information, or null if method not found
    • isAccessible

      boolean isAccessible(IClassItem item)
      Check accessible method. Check if a field or method in another class is accessible from within this class.
      Parameters:
      item - field or method information
      Returns:
      true if accessible, false if not
    • isAssignable

      boolean isAssignable(IClass other)
      Check if a value of this type can be directly assigned to another type. This is basically the equivalent of the instanceof operator.
      Parameters:
      other - type to be assigned to
      Returns:
      true if assignable, false if not
    • loadClass

      Class loadClass()
      Load class in executable form.
      Returns:
      loaded class, or null if unable to load
    • getMethods

      IClassItem[] getMethods()
      Get all methods of class.
      Returns:
      methods
    • getFields

      IClassItem[] getFields()
      Get all fields of class.
      Returns:
      fields
    • getJavaDoc

      String getJavaDoc()
      Get the JavaDoc comment for this class.
      Returns:
      comment text, or null if none or no source available
    • getLocator

      IClassLocator getLocator()
      Get the locator which provided this class.
      Returns:
      locator