1 43 44 package org.jfree.xml.factory.objects; 45 46 51 public class ByteObjectDescription extends AbstractObjectDescription { 52 53 56 public ByteObjectDescription() { 57 super(Byte .class); 58 setParameterDefinition("value", String .class); 59 } 60 61 66 public Object createObject() { 67 final String o = (String ) getParameter("value"); 68 return Byte.valueOf(o); 69 } 70 71 78 public void setParameterFromObject(final Object o) throws ObjectFactoryException { 79 if (!(o instanceof Byte )) { 80 throw new ObjectFactoryException("The given object is no java.lang.Byte."); 81 } 82 setParameter("value", String.valueOf(o)); 83 } 84 85 92 public boolean equals(final Object o) { 93 if (this == o) { 94 return true; 95 } 96 if (!(o instanceof AbstractObjectDescription)) { 97 return false; 98 } 99 100 final AbstractObjectDescription abstractObjectDescription = (AbstractObjectDescription) o; 101 102 if (Byte.TYPE.equals(abstractObjectDescription.getObjectClass())) { 103 return true; 104 } 105 if (Byte .class.equals(abstractObjectDescription.getObjectClass())) { 106 return true; 107 } 108 return false; 109 } 110 111 116 public int hashCode() { 117 return getObjectClass().hashCode(); 118 } 119 120 } 121 | Popular Tags |