Package org.jgroups.jmx
Class ReflectUtils
java.lang.Object
org.jgroups.jmx.ReflectUtils
Methods to get/set attributes and invoke operations of a given instance.
- Since:
- 5.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void_handleAttrWrite(Object target, String attr_name, String attr_value) protected static voiddumpSelectedAttributes(Object target, List<String> attrs) Reads all attributes and values of the given target (annotated withManagedAttributeand filters them if a non-null list of attributes is givenstatic voidstatic voidHandles an attribute read or writestatic voidhandleAttrWrite(Object target, String attr_name, String attr_value) static Objectstatic voidInvokes an operation and puts the return value into mapstatic StringlistOperations(Class<?> clazz) Prints all operations of clazz annotated withManagedOperationprotected static String
-
Constructor Details
-
ReflectUtils
public ReflectUtils()
-
-
Method Details
-
handleAttributeAccess
Handles an attribute read or write -
dumpSelectedAttributes
public static Map<String,Map<String, dumpSelectedAttributesObject>> (Object target, List<String> attrs) Reads all attributes and values of the given target (annotated withManagedAttributeand filters them if a non-null list of attributes is given- Parameters:
target- The object to read the attributes fromattrs- A list of attributes to match against. Example:bind
with matchbind_addr
,bind_port
etc. Ifnull
, all attributes will be read.- Returns:
- A map of attributes and values, keyed by the object's class
-
dumpStats
-
listOperations
Prints all operations of clazz annotated withManagedOperation -
invokeOperation
public static void invokeOperation(Map<String, String> map, String operation, Object target) throws ExceptionInvokes an operation and puts the return value into map- Parameters:
map-operation- Protocol.OperationName[args], e.g. STABLE.foo[arg1 arg2 arg3]target- The target object on which to invoke the operation- Throws:
Exception
-
invoke
- Throws:
Exception
-
convert
-
handleAttrWrite
public static void handleAttrWrite(Object target, String attr_name, String attr_value) throws Exception - Throws:
Exception
-
_handleAttrWrite
-
methodToString
-