|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.bluemarsh.jswat.util.ClassUtils
Class ClassUtils provides a set of utility functions for dealing with classes.
Field Summary | |
protected static ClassUtils |
instance
Reference to the single instance of this class. |
protected static boolean |
trimClassNames
Indicates whether we shoud trim class names or not. |
Constructor Summary | |
protected |
ClassUtils()
Constructor that sets up the instance to listen for configuration changes. |
Method Summary | |
static java.lang.String |
callToString(com.sun.jdi.ObjectReference obj,
com.sun.jdi.ThreadReference thread)
Call the toString() method on the given object. |
void |
configurationChanged()
Invoked when the configuration has been accepted by the user. |
static com.sun.jdi.Method |
findMethod(com.sun.jdi.ReferenceType clazz,
java.lang.String methodId,
java.util.List methodArgs)
Attempt an unambiguous match of the method name and argument specification to a method. |
protected static com.sun.jdi.ReferenceType |
getReferenceFromName(java.lang.String cname,
com.sun.jdi.VirtualMachine vm)
Find the ReferenceType object for a given class. |
static ClassUtils |
instanceOf()
Returns the reference to the single instance of this class. |
static boolean |
isJavaIdentifier(java.lang.String s)
Determine if the given string is a valid Java identifier. |
static boolean |
isPrimitive(java.lang.String s)
Returns true if the passed string is a primitive type. |
static java.lang.String |
justTheName(java.lang.String cname)
Returns just the name of the class, without the package name. |
protected static java.lang.String |
normalizeArgTypeName(java.lang.String name,
com.sun.jdi.VirtualMachine vm)
Remove unneeded spaces and expand class names to fully qualified names, if necessary and possible. |
protected static boolean |
tryPrimitives(java.lang.String candidate,
java.lang.String given)
Compare the named types to determine if they are compatible by one being a class type representing the primitive form of the other. |
protected static boolean |
tryUpCasting(java.lang.String candidate,
java.lang.String given)
Compare the named types to determine if up-casting is possible. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static ClassUtils instance
protected static boolean trimClassNames
Constructor Detail |
protected ClassUtils()
Method Detail |
public static java.lang.String callToString(com.sun.jdi.ObjectReference obj, com.sun.jdi.ThreadReference thread)
toString()
method on the given object.obj
- object on which to call toString().thread
- thread on which to call toString() on obj.obj.toString()
, or
null if there was any problem.public void configurationChanged()
configurationChanged
in interface com.bluemarsh.config.ConfigureListener
public static com.sun.jdi.Method findMethod(com.sun.jdi.ReferenceType clazz, java.lang.String methodId, java.util.List methodArgs) throws AmbiguousClassSpecException, AmbiguousMethodException, java.lang.NoSuchMethodException
clazz
- class in which to find method.methodId
- name of method to find.methodArgs
- list of method argument types.AmbiguousClassSpecException
- Thrown if the given pattern matches more than one class.AmbiguousMethodException
- Thrown if the method is overloaded.java.lang.NoSuchMethodException
- Thrown if the method could not be found.protected static com.sun.jdi.ReferenceType getReferenceFromName(java.lang.String cname, com.sun.jdi.VirtualMachine vm) throws AmbiguousClassSpecException
cname
- Class identifier for which to get reference.vm
- Virtual machine from which to get reference.AmbiguousClassSpecException
- Thrown if the given pattern matches more than one class.public static ClassUtils instanceOf()
public static boolean isJavaIdentifier(java.lang.String s)
s
- string to validate.public static boolean isPrimitive(java.lang.String s)
s
- string suspected of naming a primitive type.public static java.lang.String justTheName(java.lang.String cname)
cname
- Name of class, possibly fully-qualified.protected static java.lang.String normalizeArgTypeName(java.lang.String name, com.sun.jdi.VirtualMachine vm) throws AmbiguousClassSpecException
name
- Name of class.vm
- Virtual machine to normalize against.AmbiguousClassSpecException
- Thrown if the given pattern matches more than one class.protected static boolean tryPrimitives(java.lang.String candidate, java.lang.String given)
candidate
- type we are trying to match.given
- type the user specified, which may be up-cast.protected static boolean tryUpCasting(java.lang.String candidate, java.lang.String given)
candidate
- type we are trying to match.given
- type the user specified, which may be up-cast.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |