Package jadex.bridge
Class ClassInfo
- java.lang.Object
-
- jadex.bridge.ClassInfo
-
public class ClassInfo extends java.lang.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 Summary
Fields Modifier and Type Field Description protected java.lang.ClassLoader
classloader
The classloader with which this info was loaded.static ClassInfo[]
EMPYT_CLASSINFO_ARRAY
Empty class info array.protected java.lang.String
geninfo
The generic type info (e.g. when obtained via method parameter).protected java.lang.Class<?>
type
The service interface type.protected java.lang.String
typename
The service interface type as string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Test if object is equal to this.java.lang.String
getClassNameOnly()
Get class info in class name notation, i.e.java.lang.String
getGenericTypeName()
Get the generic type name.java.lang.String
getGeninfo()
Get the geninfo.java.lang.String
getPrefixNotation()
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.String
getTypeName()
Get the type name.int
hashCode()
Get the hashcode.void
setGeninfo(java.lang.String geninfo)
The geninfo to set.void
setTheType(java.lang.Class<?> type)
Set the type.void
setTypeName(java.lang.String typename)
Set the name.java.lang.String
toString()
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:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Test if object is equal to this.- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
Get the string representation.- Overrides:
toString
in 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
-
-