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
Modifier and TypeClassDescriptionstatic interface
Use dumping out mbeans as JSON. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Dump out all registered mbeans as json on System.out.open
(PrintWriter writer) Notice that, closing the returnJSONBean.Writer
will not close thewriter
passed in, you still need to close thewriter
by yourself.private static int
write
(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 void
writeAttribute
(org.apache.hbase.thirdparty.com.google.gson.stream.JsonWriter writer, String attName, String descriptionStr, Object value) private static void
writeAttribute
(org.apache.hbase.thirdparty.com.google.gson.stream.JsonWriter writer, MBeanServer mBeanServer, ObjectName oname, boolean description, Pattern[] pattern, MBeanAttributeInfo attr) private static void
writeObject
(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.Writer
will not close thewriter
passed in, you still need to close thewriter
by 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.
-