1 22 package org.jboss.mx.mxbean; 23 24 import java.lang.reflect.ParameterizedType ; 25 import java.lang.reflect.Type ; 26 27 import javax.management.openmbean.OpenType ; 28 29 import org.jboss.util.UnreachableStatementException; 30 31 37 public class SkeletonOpenType 38 { 39 40 private OpenType openType; 41 42 43 private CompositeTypeMetaData composite; 44 45 50 public SkeletonOpenType(Type type) 51 { 52 openType = MXBeanUtils.checkType(type); 53 if (openType != null) 54 return; 55 Class clazz = null; 56 if (type instanceof ParameterizedType ) 57 { 58 ParameterizedType parameterizedType = (ParameterizedType ) type; 59 clazz = (Class ) parameterizedType.getRawType(); 60 } 61 else if (type instanceof Class ) 62 { 63 clazz = (Class ) type; 64 } 65 else 66 { 67 throw new UnsupportedOperationException ("Unable to create open type for " + type); 68 } 69 composite = CompositeTypeMetaDataFactory.getCompositeTypeMetaData(clazz); 70 } 71 72 77 public OpenType getOpenType() 78 { 79 if (openType != null) 80 return openType; 81 if (composite != null) 82 return composite.getCompositeType(); 83 throw new UnreachableStatementException(); 84 } 85 } 86 | Popular Tags |