Package org.apache.hadoop.hbase.util
Class JSONBean
java.lang.Object
org.apache.hadoop.hbase.util.JSONBean
Utility for doing JSON and MBeans.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceUse dumping out mbeans as JSON. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidDump out all registered mbeans as json on System.out.open(PrintWriter writer) Notice that, closing the returnJSONBean.Writerwill not close thewriterpassed in, you still need to close thewriterby yourself.private static intwrite(org.apache.hbase.thirdparty.com.google.gson.stream.JsonWriter writer, MBeanServer mBeanServer, ObjectName qry, String attribute, boolean description, ObjectName excluded) Returns Return non-zero if failed to find bean.private static voidwriteAttribute(org.apache.hbase.thirdparty.com.google.gson.stream.JsonWriter writer, String attName, String descriptionStr, Object value) private static voidwriteAttribute(org.apache.hbase.thirdparty.com.google.gson.stream.JsonWriter writer, MBeanServer mBeanServer, ObjectName oname, boolean description, Pattern[] pattern, MBeanAttributeInfo attr) private static voidwriteObject(org.apache.hbase.thirdparty.com.google.gson.stream.JsonWriter writer, Object value)
-
Field Details
-
COMMA
- See Also:
-
ASTERICK
- See Also:
-
LOG
-
GSON
-
-
Constructor Details
-
JSONBean
public JSONBean()
-
-
Method Details
-
open
Notice that, closing the returnJSONBean.Writerwill not close thewriterpassed in, you still need to close thewriterby yourself. This is because that, we can only finish the json after you callCloseable.close(). So if we just close thewriter, you can write nothing after finished the json.- Throws:
IOException
-
write
private static int write(org.apache.hbase.thirdparty.com.google.gson.stream.JsonWriter writer, MBeanServer mBeanServer, ObjectName qry, String attribute, boolean description, ObjectName excluded) throws IOException Returns Return non-zero if failed to find bean. 0- Throws:
IOException
-
writeAttribute
private static void writeAttribute(org.apache.hbase.thirdparty.com.google.gson.stream.JsonWriter writer, MBeanServer mBeanServer, ObjectName oname, boolean description, Pattern[] pattern, MBeanAttributeInfo attr) throws IOException - Throws:
IOException
-
writeAttribute
private static void writeAttribute(org.apache.hbase.thirdparty.com.google.gson.stream.JsonWriter writer, String attName, String descriptionStr, Object value) throws IOException - Throws:
IOException
-
writeObject
private static void writeObject(org.apache.hbase.thirdparty.com.google.gson.stream.JsonWriter writer, Object value) throws IOException - Throws:
IOException
-
dumpAllBeans
Dump out all registered mbeans as json on System.out.
-