Class ClassProto

  • All Implemented Interfaces:
    TypeProto

    public class ClassProto
    extends java.lang.Object
    implements TypeProto
    A class "prototype". This contains things like the interfaces, the superclass, the vtable and the instance fields and their offsets.
    • Field Detail

      • classPath

        @Nonnull
        protected final ClassPath classPath
      • type

        @Nonnull
        protected final java.lang.String type
      • vtableFullyResolved

        protected boolean vtableFullyResolved
      • interfacesFullyResolved

        protected boolean interfacesFullyResolved
      • unresolvedInterfaces

        protected java.util.Set<java.lang.String> unresolvedInterfaces
    • Constructor Detail

      • ClassProto

        public ClassProto​(@Nonnull
                          ClassPath classPath,
                          @Nonnull
                          java.lang.String type)
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getType

        @Nonnull
        public java.lang.String getType()
        Specified by:
        getType in interface TypeProto
      • getClassDef

        @Nonnull
        public ClassDef getClassDef()
      • isInterface

        public boolean isInterface()
        Returns true if this class is an interface. If this class is not defined, then this will throw an UnresolvedClassException
        Specified by:
        isInterface in interface TypeProto
        Returns:
        True if this class is an interface
      • getInterfaces

        @Nonnull
        protected java.util.LinkedHashMap<java.lang.String,​ClassDef> getInterfaces()
        Returns the set of interfaces that this class implements as a Map. The ClassDef value will be present only for the interfaces that this class directly implements (including any interfaces transitively implemented), but not for any interfaces that are only implemented by a superclass of this class For any interfaces that are only implemented by a superclass (or the class itself, if the class is an interface), the value will be null. If any interface couldn't be resolved, then the interfacesFullyResolved field will be set to false upon return.
        Returns:
        the set of interfaces that this class implements as a Map.
      • getUnresolvedInterfaces

        @Nonnull
        protected java.util.Set<java.lang.String> getUnresolvedInterfaces()
      • getDirectInterfaces

        @Nonnull
        protected java.lang.Iterable<ClassDef> getDirectInterfaces()
        Gets the interfaces directly implemented by this class, or the interfaces they transitively implement. This does not include any interfaces that are only implemented by a superclass
        Returns:
        An iterables of ClassDefs representing the directly or transitively implemented interfaces
        Throws:
        UnresolvedClassException - if interfaces could not be fully resolved
      • implementsInterface

        public boolean implementsInterface​(@Nonnull
                                           java.lang.String iface)
        Checks if this class implements the given interface. If the interfaces of this class cannot be fully resolved then this method will either return true or throw an UnresolvedClassException
        Specified by:
        implementsInterface in interface TypeProto
        Parameters:
        iface - The interface to check for
        Returns:
        true if this class implements the given interface, otherwise false
        Throws:
        UnresolvedClassException - if the interfaces for this class could not be fully resolved, and the interface is not one of the interfaces that were successfully resolved
      • getSuperclass

        @Nullable
        public java.lang.String getSuperclass()
        Specified by:
        getSuperclass in interface TypeProto
      • getVtable

        @Nonnull
        public java.util.List<Method> getVtable()