Package jadex.common

Class ClassInfo

java.lang.Object
jadex.common.ClassInfo

public class ClassInfo extends Object
The class info struct serves for saving class information. A class info may hold a class itself or the class name for resolving the class. This struct should be used at all places where classes are meant to be send to remote nodes. In this case the class info will only transfer the class name forcing the receiver to lookup the class itself. The class loader for resolving a class info can be found by using the corresponding resource identifier (rid) of the component or service that uses the class.
  • Field Details

    • EMPYT_CLASSINFO_ARRAY

      public static final ClassInfo[] EMPYT_CLASSINFO_ARRAY
      Empty class info array.
    • typename

      protected String typename
      The service interface type as string.
    • type

      protected Class<?> type
      The service interface type.
    • geninfo

      protected String geninfo
      The generic type info (e.g. when obtained via method parameter).
    • classloader

      protected ClassLoader classloader
      The classloader with which this info was loaded. Note 1: This must not be the same as method.getClass().getClassLoader() because the latter returns the loader responsible for the class which could be higher in the parent hierarchy. Note 2: The check current_cl==last_cl is not perfect because when invoked with a parent classloader it will reload the class (although not necessary)
  • Constructor Details

    • ClassInfo

      public ClassInfo()
      Create a new class info.
    • ClassInfo

      public ClassInfo(Class<?> type)
      Create a new class info.
      Parameters:
      type - The class info.
    • ClassInfo

      public ClassInfo(Type type)
      Create a new class info.
      Parameters:
      type - The class info.
    • ClassInfo

      public ClassInfo(String typename)
      Create a new class info.
      Parameters:
      typename - The class name.
  • Method Details

    • getTypeName

      public String getTypeName()
      Get the type name.
      Returns:
      the type name.
    • setTypeName

      public void setTypeName(String typename)
      Set the name.
      Parameters:
      typename - The name to set.
    • getType

      public Class<?> getType(ClassLoader cl)
      Get the type.
      Returns:
      The type.
    • getType

      public Class<?> getType(ClassLoader cl, String[] imports)
      Get the type.
      Returns:
      The type.
    • getType0

      public Class<?> getType0()
      Get the type, if available
      Returns:
      The type or null if not yet resolved.
    • setTheType

      public void setTheType(Class<?> type)
      Set the type.
      Parameters:
      type - The type to set.
    • getGenericTypeName

      public String getGenericTypeName()
      Get the generic type name.
      Returns:
      The type name.
    • getGeninfo

      public String getGeninfo()
      Get the geninfo.
      Returns:
      The geninfo
    • setGeninfo

      public void setGeninfo(String geninfo)
      The geninfo to set.
      Parameters:
      geninfo - The geninfo to set
    • hashCode

      public int hashCode()
      Get the hashcode.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Test if object is equal to this.
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Get the string representation.
      Overrides:
      toString in class Object
    • getPrefixNotation

      public String getPrefixNotation()
      Get class info in prefix notation, i.e. String - java.lang
    • getClassNameOnly

      public String getClassNameOnly()
      Get class info in class name notation, i.e. String