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