001 package org.shiftone.jrat.util.jmx.dynamic; 002 003 004 import org.shiftone.jrat.util.log.Logger; 005 006 007 /** 008 * @author jeff@shiftone.org (Jeff Drost) 009 */ 010 public class SimpleAttributeValue implements AttributeValue { 011 012 private static final Logger LOG = Logger.getLogger(SimpleAttributeValue.class); 013 private Object value; 014 private String description; 015 private Class type; 016 017 public SimpleAttributeValue(Object value) { 018 this.value = value; 019 } 020 021 022 public SimpleAttributeValue(Object value, String description) { 023 this.value = value; 024 this.description = description; 025 } 026 027 028 public SimpleAttributeValue(Object value, String description, Class type) { 029 030 this.value = value; 031 this.description = description; 032 this.type = type; 033 } 034 035 036 public void setValue(Object value) { 037 this.value = value; 038 } 039 040 041 public Object getValue() { 042 return value; 043 } 044 045 046 public String getType() { 047 048 if (type != null) { 049 return type.getName(); 050 } else if (value != null) { 051 return value.getClass().getName(); 052 } else { 053 return Object.class.getName(); 054 } 055 } 056 057 058 public String getDescription() { 059 return description; 060 } 061 062 063 public void setDescription(String description) { 064 this.description = description; 065 } 066 067 068 public boolean isReadable() { 069 return true; 070 } 071 072 073 public boolean isWritable() { 074 return true; 075 } 076 }