1 22 23 package org.snmp4j.agent.mo.jmx.types; 24 25 import javax.management.openmbean.CompositeDataSupport ; 26 import javax.management.*; 27 28 public class TypedCompositeDataAttribute extends TypedAttribute { 29 30 private String compositeDataAttrName; 31 private TypedAttribute proxyAttribute; 32 33 public TypedCompositeDataAttribute(String beanName, 34 String attrName, 35 String type) throws ClassNotFoundException { 36 super(beanName, type); 37 this.compositeDataAttrName = attrName; 38 } 39 40 public TypedCompositeDataAttribute(String beanName, 41 String attrName, 42 Class type) { 43 super(beanName, type); 44 this.compositeDataAttrName = attrName; 45 } 46 47 public TypedCompositeDataAttribute(TypedAttribute proxyAttribute) { 48 super(proxyAttribute.getName(), proxyAttribute.getType()); 49 this.compositeDataAttrName = proxyAttribute.getName(); 50 this.proxyAttribute = proxyAttribute; 51 } 52 53 public Object transformFromNative(Object nativeValue, ObjectName objectName) { 54 if (nativeValue == null) { 55 return null; 56 } 57 Object n = ((CompositeDataSupport )nativeValue).get(compositeDataAttrName); 58 if (proxyAttribute != null) { 59 n = proxyAttribute.transformFromNative(n, null); 60 } 61 return n; 62 } 63 64 public Object transformToNative(Object transformedValue, 65 Object oldNativeValue, ObjectName objectName) { 66 throw new UnsupportedOperationException (); 67 } 68 } 69 | Popular Tags |