@Test public void nullHandling() { MapMBean mbean = new MapMBean(null); AttributeList al = mbean.getAttributes(new String[]{"key0"}); assertEquals(0, al.size()); }
@Override public AttributeList getAttributes(String[] attributes) { AttributeList attrLst = new AttributeList(map.size()); for (String key : attributes) { if (map.containsKey(key)) { attrLst.add(new Attribute(key, map.get(key))); } } return attrLst; }
MapMBean implements DynamicMBean { @Override public AttributeList getAttributes(String[] attributes) { AttributeList attrLst = new AttributeList(map.size()); for (String key : attributes) { if (map.containsKey(key)) { attrLst.add(new Attribute(key, map.get(key))); } } return attrLst; } }
MapMBean implements DynamicMBean { @Override public AttributeList getAttributes(String[] attributes) { AttributeList attrLst = new AttributeList(map.size()); for (String key : attributes) { if (map.containsKey(key)) { attrLst.add(new Attribute(key, map.get(key))); } } return attrLst; } MapMBean(Map<String, ?> map); }
MapMBean implements DynamicMBean { @Override public AttributeList getAttributes(String[] attributes) { AttributeList attrLst = new AttributeList(map.size()); for (String key : attributes) { if (map.containsKey(key)) { attrLst.add(new Attribute(key, map.get(key))); } } return attrLst; } MapMBean(Map<String, ?> map); void setMap(Map<String, ?> map); @Override Object getAttribute(String attribute); @Override AttributeList getAttributes(String[] attributes); @Override MBeanInfo getMBeanInfo(); @Override Object invoke(String actionName, Object[] params, String[] signature); @Override void setAttribute(Attribute attribute); @Override AttributeList setAttributes(AttributeList attributes); }
MapMBean implements DynamicMBean { @Override public AttributeList getAttributes(String[] attributes) { AttributeList attrLst = new AttributeList(map.size()); for (String key : attributes) { if (map.containsKey(key)) { attrLst.add(new Attribute(key, map.get(key))); } } return attrLst; } MapMBean(Map<String, ?> map); void setMap(Map<String, ?> map); @Override Object getAttribute(String attribute); @Override AttributeList getAttributes(String[] attributes); @Override MBeanInfo getMBeanInfo(); @Override Object invoke(String actionName, Object[] params, String[] signature); @Override void setAttribute(Attribute attribute); @Override AttributeList setAttributes(AttributeList attributes);  }