Class Klass<C>

  • Type Parameters:
    C - Variable that represents the type of Class like object in this language.

    public final class Klass<C>
    extends Object
    Abstraction of class-like object, agnostic to languages.

    To support other JVM languages that use their own specific types to represent a class (such as JRuby and Jython), we now use this object instead of Class. This allows us to reuse much of the logic of class traversal/resource lookup across different languages. But after the removal of JRuby support, in practice this is used only for Class.

    This is a convenient tuple so that we can pass around a single argument instead of two.

    Author:
    Kohsuke Kawaguchi
    • Method Detail

      • getResource

        public URL getResource​(String resourceName)
      • getSuperClass

        public Klass<?> getSuperClass()
      • toJavaClass

        public Class toJavaClass()
      • getDeclaredMethods

        public List<MethodRef> getDeclaredMethods()
        Since:
        1.220
      • getDeclaredFields

        @NonNull
        public List<FieldRef> getDeclaredFields()
        Gets list of fields declared by the class.
        Returns:
        List of fields. May return empty list in the case of obsolete navigator, which does not offer the method.
        Since:
        1.246
      • getFields

        public List<FieldRef> getFields()
        Gets all the public fields defined in this type, including super types.
        See Also:
        Class.getFields()
      • getFunctions

        @NonNull
        public List<Function> getFunctions()
        Reports all the methods that can be used for routing requests on this class.
        Returns:
        List of functions. May return empty list in the case of obsolete navigator, which does not offer the method.
        Since:
        1.246
      • isArray

        public boolean isArray()
      • isMap

        public boolean isMap()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object