Package jadex.bridge
Class ClassInfo
- java.lang.Object
-
- jadex.bridge.ClassInfo
-
public class ClassInfo extends java.lang.ObjectThe 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 Summary
Fields Modifier and Type Field Description protected java.lang.ClassLoaderclassloaderThe classloader with which this info was loaded.static ClassInfo[]EMPYT_CLASSINFO_ARRAYEmpty class info array.protected java.lang.StringgeninfoThe generic type info (e.g.protected java.lang.Class<?>typeThe service interface type.protected java.lang.StringtypenameThe service interface type as string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Test if object is equal to this.java.lang.StringgetClassNameOnly()Get class info in class name notation, i.e.java.lang.StringgetGenericTypeName()Get the generic type name.java.lang.StringgetGeninfo()Get the geninfo.java.lang.StringgetPrefixNotation()Get class info in prefix notation, i.e.java.lang.Class<?>getType(java.lang.ClassLoader cl)Get the type.java.lang.Class<?>getType(java.lang.ClassLoader cl, java.lang.String[] imports)Get the type.java.lang.Class<?>getType0()Get the type, if availablejava.lang.StringgetTypeName()Get the type name.inthashCode()Get the hashcode.voidsetGeninfo(java.lang.String geninfo)The geninfo to set.voidsetTheType(java.lang.Class<?> type)Set the type.voidsetTypeName(java.lang.String typename)Set the name.java.lang.StringtoString()Get the string representation.
-
-
-
Field Detail
-
EMPYT_CLASSINFO_ARRAY
public static final ClassInfo[] EMPYT_CLASSINFO_ARRAY
Empty class info array.
-
typename
protected java.lang.String typename
The service interface type as string.
-
type
protected java.lang.Class<?> type
The service interface type.
-
geninfo
protected java.lang.String geninfo
The generic type info (e.g. when obtained via method parameter).
-
classloader
protected java.lang.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 Detail
-
ClassInfo
public ClassInfo()
Create a new class info.
-
ClassInfo
public ClassInfo(java.lang.Class<?> type)
Create a new class info.- Parameters:
type- The class info.
-
ClassInfo
public ClassInfo(java.lang.reflect.Type type)
Create a new class info.- Parameters:
type- The class info.
-
ClassInfo
public ClassInfo(java.lang.String typename)
Create a new class info.- Parameters:
typename- The class name.
-
-
Method Detail
-
getTypeName
public java.lang.String getTypeName()
Get the type name.- Returns:
- the type name.
-
setTypeName
public void setTypeName(java.lang.String typename)
Set the name.- Parameters:
typename- The name to set.
-
getType
public java.lang.Class<?> getType(java.lang.ClassLoader cl)
Get the type.- Returns:
- The type.
-
getType
public java.lang.Class<?> getType(java.lang.ClassLoader cl, java.lang.String[] imports)Get the type.- Returns:
- The type.
-
getType0
public java.lang.Class<?> getType0()
Get the type, if available- Returns:
- The type or null if not yet resolved.
-
setTheType
public void setTheType(java.lang.Class<?> type)
Set the type.- Parameters:
type- The type to set.
-
getGenericTypeName
public java.lang.String getGenericTypeName()
Get the generic type name.- Returns:
- The type name.
-
getGeninfo
public java.lang.String getGeninfo()
Get the geninfo.- Returns:
- The geninfo
-
setGeninfo
public void setGeninfo(java.lang.String geninfo)
The geninfo to set.- Parameters:
geninfo- The geninfo to set
-
hashCode
public int hashCode()
Get the hashcode.- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Test if object is equal to this.- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
Get the string representation.- Overrides:
toStringin classjava.lang.Object
-
getPrefixNotation
public java.lang.String getPrefixNotation()
Get class info in prefix notation, i.e. String - java.lang
-
getClassNameOnly
public java.lang.String getClassNameOnly()
Get class info in class name notation, i.e. String
-
-