jdk/src/java.management/share/classes/sun/management/LazyCompositeData.java
changeset 30355 e37c7eba132f
parent 25859 3317bb8137f4
child 33260 af1ca24593aa
equal deleted inserted replaced
30354:ca83b4cae363 30355:e37c7eba132f
     1 /*
     1 /*
     2  * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   113      * for unmarshalling besides JMX 1.2 classes.
   113      * for unmarshalling besides JMX 1.2 classes.
   114      */
   114      */
   115     protected abstract CompositeData getCompositeData();
   115     protected abstract CompositeData getCompositeData();
   116 
   116 
   117     // Helper methods
   117     // Helper methods
   118     static String getString(CompositeData cd, String itemName) {
   118     public static String getString(CompositeData cd, String itemName) {
   119         if (cd == null)
   119         if (cd == null)
   120             throw new IllegalArgumentException("Null CompositeData");
   120             throw new IllegalArgumentException("Null CompositeData");
   121 
   121 
   122         return (String) cd.get(itemName);
   122         return (String) cd.get(itemName);
   123     }
   123     }
   124 
   124 
   125     static boolean getBoolean(CompositeData cd, String itemName) {
   125     public static boolean getBoolean(CompositeData cd, String itemName) {
   126         if (cd == null)
   126         if (cd == null)
   127             throw new IllegalArgumentException("Null CompositeData");
   127             throw new IllegalArgumentException("Null CompositeData");
   128 
   128 
   129         return ((Boolean) cd.get(itemName)).booleanValue();
   129         return ((Boolean) cd.get(itemName)).booleanValue();
   130     }
   130     }
   131 
   131 
   132     static long getLong(CompositeData cd, String itemName) {
   132     public static long getLong(CompositeData cd, String itemName) {
   133         if (cd == null)
   133         if (cd == null)
   134             throw new IllegalArgumentException("Null CompositeData");
   134             throw new IllegalArgumentException("Null CompositeData");
   135 
   135 
   136         return ((Long) cd.get(itemName)).longValue();
   136         return ((Long) cd.get(itemName)).longValue();
   137     }
   137     }
   138 
   138 
   139     static int getInt(CompositeData cd, String itemName) {
   139     public static int getInt(CompositeData cd, String itemName) {
   140         if (cd == null)
   140         if (cd == null)
   141             throw new IllegalArgumentException("Null CompositeData");
   141             throw new IllegalArgumentException("Null CompositeData");
   142 
   142 
   143         return ((Integer) cd.get(itemName)).intValue();
   143         return ((Integer) cd.get(itemName)).intValue();
   144     }
   144     }