| 1 24 package org.archive.crawler.settings; 25 26 import javax.management.InvalidAttributeValueException ; 27 import javax.management.MBeanAttributeInfo ; 28 29 33 public class ModuleAttributeInfo extends MBeanAttributeInfo { 34 35 private static final long serialVersionUID = -4447321338690051514L; 36 37 private String type; 38 private boolean isOverrideable; 39 private boolean isTransient; 40 private final Object defaultValue; 41 private final Object legalValueLists[]; 42 private boolean complexType = false; 43 private boolean isExpertSetting; 44 45 52 public ModuleAttributeInfo(Type type) 53 throws InvalidAttributeValueException { 54 55 super(type.getName(), type.getClass().getName(), type.getDescription(), 56 true, true, false); 57 setType(type.getDefaultValue()); 58 this.isOverrideable = type.isOverrideable(); 59 this.isTransient = type.isTransient(); 60 this.legalValueLists = type.getLegalValues(); 61 this.isExpertSetting = type.isExpertSetting(); 62 this.defaultValue = type.getValue(); 64 if (type.getDefaultValue() instanceof ComplexType) { 65 complexType = true; 66 } 67 } 68 69 public ModuleAttributeInfo(ModuleAttributeInfo attr) { 70 super(attr.getName(), attr.getType(), attr.getDescription(), 71 true, true, false); 72 setType(attr.getDefaultValue()); 73 this.isOverrideable = attr.isOverrideable(); 74 this.isTransient = attr.isTransient(); 75 this.legalValueLists = attr.getLegalValues(); 76 this.isExpertSetting = attr.isExpertSetting(); 77 this.defaultValue = attr.getDefaultValue(); 78 this.complexType = attr.complexType; 79 } 80 81 public Object [] getLegalValues() { 82 return legalValueLists; 83 } 84 85 89 public boolean isComplexType() { 90 return complexType; 91 } 92 93 97 public boolean isOverrideable() { 98 return isOverrideable; 99 } 100 101 106 public boolean isTransient() { 107 return isTransient; 108 } 109 110 114 public boolean isExpertSetting() { 115 return isExpertSetting; 116 } 117 118 121 public Object getDefaultValue() { 122 return defaultValue; 123 } 124 125 128 public String getType() { 129 return type; 130 } 131 132 protected void setType(Object type) { 133 this.type = type.getClass().getName(); 134 } 135 } 136 | Popular Tags |