Interface CodeClass

  • All Known Implementing Classes:
    GeneratedCodeClass, IntrospectedCodeClass

    public interface CodeClass
    Interface for Java classes within the bytecode generation framework. Any class (or interface) can be viewed as a CodeClass, whether it is pre-existing or being generated.
    Author:
    Thomas Down, Matthew Pocock
    • Method Detail

      • getName

        java.lang.String getName()
      • getJName

        java.lang.String getJName()
      • getDescriptor

        java.lang.String getDescriptor()
      • getInterfaces

        java.util.List getInterfaces()
      • getMethods

        java.util.Set getMethods()
        Get all methods declared by this class and its super classes, removing all super class methods that are over ridden.

        This should return methods, regardless of their accessability.

        Returns:
        a Set containing all methods
      • getMethodsByName

        java.util.Set getMethodsByName​(java.lang.String name)
        Get the name of all methods that could be invoked through this class with a given name.
        Parameters:
        name - the name of the method
        Returns:
        a Set of CodeMethod instances with that name
      • getMethod

        CodeMethod getMethod​(java.lang.String name,
                             CodeClass[] args)
                      throws java.lang.NoSuchMethodException
        Get a method by name and argument list.
        Parameters:
        name - the name of the method
        args - the arguments it takes
        Returns:
        a matching method
        Throws:
        java.lang.NoSuchMethodException - if there is no maching method
      • getConstructor

        CodeMethod getConstructor​(CodeClass[] args)
                           throws java.lang.NoSuchMethodException
        Get a constructor by argument list.
        Parameters:
        args - the arguments it takes
        Returns:
        a matching constructor
        Throws:
        java.lang.NoSuchMethodException - if there is no matching constructor
      • getFieldByName

        CodeField getFieldByName​(java.lang.String name)
                          throws java.lang.NoSuchFieldException
        Get a field by its name.
        Parameters:
        name - the field name
        Returns:
        a CodeField representing the field
        Throws:
        java.lang.NoSuchFieldException - if there is no field by that name accessible through this class
      • getFields

        java.util.Set getFields()
        Get all fields accessible through this class.
        Returns:
        a Set of all accessible fields
      • getModifiers

        int getModifiers()
        Get the modifiers associated with the class.
        Returns:
        the modifier integer
      • isPrimitive

        boolean isPrimitive()
        Discover if the class represents a primitive type.
        Returns:
        true if the class represents a primative type
      • isArray

        boolean isArray()
        Discover if the class is an array type.
        Returns:
        true if the class is an array type