1 package org.apache.fulcrum.intake.model; 2 3 56 57 import org.apache.fulcrum.intake.xmlmodel.XmlField; 58 import org.apache.log4j.Category; 59 60 67 public class BooleanField 68 extends Field 69 { 70 71 Category category = Category.getInstance(getClass().getName()); 72 73 public BooleanField(XmlField field, Group group) 74 throws Exception 75 { 76 super(field, group); 77 } 78 79 84 protected void setDefaultValue(String prop) 85 { 86 if (prop == null) 87 { 88 return; 89 } 90 91 try 92 { 93 defaultValue = new Boolean (prop); 94 } 95 catch (RuntimeException e) 96 { 97 category.error("Could not convert " + prop 98 + " into a Boolean. (" 99 + name + ")"); 100 } 101 } 102 103 108 protected String getDefaultValidator() 109 { 110 return null; 111 } 112 113 116 protected void doSetValue() 117 { 118 setTestValue( pp.getBool(getKey()) ); 119 } 120 121 public boolean booleanValue() 122 { 123 boolean result = false; 124 try 125 { 126 result = ((Boolean )getValue()).booleanValue(); 127 } 128 catch (Exception e) 129 { 130 category.error(e); 131 } 132 return result; 133 } 134 } 135 136 137 138 139 140 141 142 143 | Popular Tags |