@SuppressWarnings("rawtypes") // Java 5/6 incompatibility public void defineItem(String itemName, OpenType itemType) { defineItem(itemName, null, itemType); }
private String[] createTableHeaders(List<String> indexNames) { String[] headers = new String[indexNames.size()]; for (int i = 0; i < indexNames.size(); i++) { String name = indexNames.get(i); headers[i] = formatHeader(name); } return headers; }
public TabularData fromArray(String tableTypeName, String rowTypeName, Object[] objects) throws OpenDataException { TabularData table; CompositeTypeFactory rowTypeFactory = new CompositeTypeFactory(rowTypeName, rowTypeName); rowTypeFactory.defineItem(rowTypeName, SimpleType.STRING); CompositeType rowType = rowTypeFactory.createCompositeType(); TabularType tableType = new TabularType(tableTypeName, tableTypeName, rowType, new String[] { rowTypeName }); CompositeDataFactory rowDataFactory = new CompositeDataFactory(rowType); table = new TabularDataSupport(tableType); for (Object object : objects) { rowDataFactory.clear(); rowDataFactory.setValue(rowTypeName, object.toString()); table.put(rowDataFactory.createCompositeData()); } return table; }
public CompositeDataBeanAdapter(Class<?> beanClass, String defaultPropertyValue) throws IntrospectionException, OpenDataException { this.beanClass = beanClass; this.defaultPropertyValue = defaultPropertyValue; BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor(); CompositeTypeFactory typeFactory = new CompositeTypeFactory(beanDescriptor.getName(), beanDescriptor.getDisplayName()); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor pd : propertyDescriptors) { if (isExposed(pd)) { typeFactory.defineItem(pd.getDisplayName(), SimpleType.STRING); } } compositeType = typeFactory.createCompositeType(); }
public CompositeData getData(Object bean) throws IntrospectionException, InvocationTargetException, OpenDataException, IllegalAccessException { CompositeDataFactory dataFactory; dataFactory = new CompositeDataFactory(compositeType); BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor pd : propertyDescriptors) { if (isExposed(pd)) { Object value = pd.getReadMethod().invoke(bean, (Object[])null); if (value == null && defaultPropertyValue != null) { value = defaultPropertyValue; } dataFactory.setValue(pd.getDisplayName(), value == null ? "" : value.toString()); } } return dataFactory.createCompositeData(); } }
public TabularData getEndpoints() throws IOException { try { return tabularDataAdapter.fromBeanList("Endpoints", "Endpoint", "sessionID", new ArrayList<>(initiator.getInitiators())); } catch (OpenDataException e) { throw JmxSupport.toIOException(e); } }
public TabularData fromArray(String tableTypeName, String rowTypeName, Object[] objects) throws OpenDataException { TabularData table; CompositeTypeFactory rowTypeFactory = new CompositeTypeFactory(rowTypeName, rowTypeName); rowTypeFactory.defineItem(rowTypeName, SimpleType.STRING); CompositeType rowType = rowTypeFactory.createCompositeType(); TabularType tableType = new TabularType(tableTypeName, tableTypeName, rowType, new String[] { rowTypeName }); CompositeDataFactory rowDataFactory = new CompositeDataFactory(rowType); table = new TabularDataSupport(tableType); for (Object object : objects) { rowDataFactory.clear(); rowDataFactory.setValue(rowTypeName, object.toString()); table.put(rowDataFactory.createCompositeData()); } return table; }
public CompositeDataBeanAdapter(Class<?> beanClass, String defaultPropertyValue) throws IntrospectionException, OpenDataException { this.beanClass = beanClass; this.defaultPropertyValue = defaultPropertyValue; BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor(); CompositeTypeFactory typeFactory = new CompositeTypeFactory(beanDescriptor.getName(), beanDescriptor.getDisplayName()); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor pd : propertyDescriptors) { if (isExposed(pd)) { typeFactory.defineItem(pd.getDisplayName(), SimpleType.STRING); } } compositeType = typeFactory.createCompositeType(); }
public CompositeData getData(Object bean) throws IntrospectionException, InvocationTargetException, OpenDataException, IllegalAccessException { CompositeDataFactory dataFactory; dataFactory = new CompositeDataFactory(compositeType); BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor pd : propertyDescriptors) { if (isExposed(pd)) { Object value = pd.getReadMethod().invoke(bean, (Object[])null); if (value == null && defaultPropertyValue != null) { value = defaultPropertyValue; } dataFactory.setValue(pd.getDisplayName(), value == null ? "" : value.toString()); } } return dataFactory.createCompositeData(); } }
@SuppressWarnings("rawtypes") // Java 5/6 incompatibility public void defineItem(String itemName, OpenType itemType) { defineItem(itemName, null, itemType); }
private String[] createTableHeaders(List<String> indexNames) { String[] headers = new String[indexNames.size()]; for (int i = 0; i < indexNames.size(); i++) { String name = indexNames.get(i); headers[i] = formatHeader(name); } return headers; }
public TabularData getEndpoints() throws IOException { try { return tabularDataAdapter.fromBeanList("Endpoints", "Endpoint", "sessionID", new ArrayList<>(initiator.getInitiators())); } catch (OpenDataException e) { throw JmxSupport.toIOException(e); } }
public TabularData fromArray(String tableTypeName, String rowTypeName, Object[] objects) throws OpenDataException { TabularData table; CompositeTypeFactory rowTypeFactory = new CompositeTypeFactory(rowTypeName, rowTypeName); rowTypeFactory.defineItem(rowTypeName, SimpleType.STRING); CompositeType rowType = rowTypeFactory.createCompositeType(); TabularType tableType = new TabularType(tableTypeName, tableTypeName, rowType, new String[] { rowTypeName }); CompositeDataFactory rowDataFactory = new CompositeDataFactory(rowType); table = new TabularDataSupport(tableType); for (Object object : objects) { rowDataFactory.clear(); rowDataFactory.setValue(rowTypeName, object.toString()); table.put(rowDataFactory.createCompositeData()); } return table; }
public CompositeDataBeanAdapter(Class<?> beanClass, String defaultPropertyValue) throws IntrospectionException, OpenDataException { this.beanClass = beanClass; this.defaultPropertyValue = defaultPropertyValue; BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); BeanDescriptor beanDescriptor = beanInfo.getBeanDescriptor(); CompositeTypeFactory typeFactory = new CompositeTypeFactory(beanDescriptor.getName(), beanDescriptor.getDisplayName()); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor pd : propertyDescriptors) { if (isExposed(pd)) { typeFactory.defineItem(pd.getDisplayName(), SimpleType.STRING); } } compositeType = typeFactory.createCompositeType(); }
public CompositeData getData(Object bean) throws IntrospectionException, InvocationTargetException, OpenDataException, IllegalAccessException { CompositeDataFactory dataFactory; dataFactory = new CompositeDataFactory(compositeType); BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (PropertyDescriptor pd : propertyDescriptors) { if (isExposed(pd)) { Object value = pd.getReadMethod().invoke(bean, (Object[])null); if (value == null && defaultPropertyValue != null) { value = defaultPropertyValue; } dataFactory.setValue(pd.getDisplayName(), value == null ? "" : value.toString()); } } return dataFactory.createCompositeData(); } }
@SuppressWarnings("rawtypes") // Java 5/6 incompatibility public void defineItem(String itemName, OpenType itemType) { defineItem(itemName, null, itemType); }
private String[] createTableHeaders(List<String> indexNames) { String[] headers = new String[indexNames.size()]; for (int i = 0; i < indexNames.size(); i++) { String name = indexNames.get(i); headers[i] = formatHeader(name); } return headers; }
public TabularData getEndpoints() throws IOException { try { return tabularDataAdapter.fromBeanList("Endpoints", "Endpoint", "sessionID", new ArrayList<>(initiator.getInitiators())); } catch (OpenDataException e) { throw JmxSupport.toIOException(e); } }
@SuppressWarnings("rawtypes") public TabularData fromMap(String keyLabel, String valueLabel, Map data) throws OpenDataException { TabularData table; CompositeTypeFactory rowTypeFactory = new CompositeTypeFactory("row", "row"); rowTypeFactory.defineItem(keyLabel, SimpleType.STRING); rowTypeFactory.defineItem(valueLabel, SimpleType.STRING); CompositeType rowType = rowTypeFactory.createCompositeType(); TabularType tableType = new TabularType("TabularData", "TabularData", rowType, new String[] { keyLabel, valueLabel }); CompositeDataFactory rowDataFactory = new CompositeDataFactory(rowType); table = new TabularDataSupport(tableType); for (Object o : data.entrySet()) { Map.Entry entry = (Map.Entry) o; rowDataFactory.clear(); rowDataFactory.setValue(keyLabel, entry.getKey().toString()); rowDataFactory.setValue(valueLabel, entry.getValue().toString()); table.put(rowDataFactory.createCompositeData()); } return table; }
@SuppressWarnings("rawtypes") public TabularData fromMap(String keyLabel, String valueLabel, Map data) throws OpenDataException { TabularData table; CompositeTypeFactory rowTypeFactory = new CompositeTypeFactory("row", "row"); rowTypeFactory.defineItem(keyLabel, SimpleType.STRING); rowTypeFactory.defineItem(valueLabel, SimpleType.STRING); CompositeType rowType = rowTypeFactory.createCompositeType(); TabularType tableType = new TabularType("TabularData", "TabularData", rowType, new String[] { keyLabel, valueLabel }); CompositeDataFactory rowDataFactory = new CompositeDataFactory(rowType); table = new TabularDataSupport(tableType); for (Object o : data.entrySet()) { Map.Entry entry = (Map.Entry) o; rowDataFactory.clear(); rowDataFactory.setValue(keyLabel, entry.getKey().toString()); rowDataFactory.setValue(valueLabel, entry.getValue().toString()); table.put(rowDataFactory.createCompositeData()); } return table; }