1 43 44 package org.jfree.xml.factory.objects; 45 46 51 public class BooleanObjectDescription extends AbstractObjectDescription { 52 53 56 public BooleanObjectDescription() { 57 super(Boolean .class); 58 setParameterDefinition("value", String .class); 59 } 60 61 66 public Object createObject() { 67 final String o = (String ) getParameter("value"); 68 return Boolean.valueOf(o); 69 } 70 71 79 public void setParameterFromObject(final Object o) throws ObjectFactoryException { 80 if (!(o instanceof Boolean )) { 81 throw new ObjectFactoryException("The given object is no java.lang.Boolean. "); 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 (Boolean.TYPE.equals(abstractObjectDescription.getObjectClass())) { 104 return true; 105 } 106 if (Boolean .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 |