1 28 29 package com.idaremedia.antx.condition; 30 31 import com.idaremedia.antx.parameters.Handling; 32 import com.idaremedia.antx.parameters.IgnoreWhitespaceEnabled; 33 import com.idaremedia.antx.parameters.IsA; 34 import com.idaremedia.antx.parameters.MalformedCheckEnabled; 35 36 52 53 public class IsSet extends SimpleFlexCondition 54 implements IgnoreWhitespaceEnabled, MalformedCheckEnabled 55 { 56 60 public IsSet() 61 { 62 super(); 63 } 64 65 66 70 public IsSet(String property) 71 { 72 setProperty(property); 73 } 74 75 76 83 public IsSet(String value, boolean isP) 84 { 85 if (isP) { 86 setProperty(value); 87 } else { 88 setVariable(value); 89 } 90 } 91 92 93 94 100 public void setWhitespace(Handling response) 101 { 102 getValueHelper().setWhitespace(response); 103 } 104 105 106 110 public final boolean ignoreWhitespace() 111 { 112 return getValueHelper().isIgnoreWhitespace(); 113 } 114 115 116 123 public void setMalformed(Handling response) 124 { 125 if (Handling.isYes(response,Handling.REJECT)) { 127 m_checkUnresolved= false; 128 } 129 else { 131 m_checkUnresolved= true; 132 } 133 } 134 135 136 141 public Handling getMalformedHandling() 142 { 143 return m_checkUnresolved ? Handling.REJECT : Handling.ACCEPT; 144 } 145 146 147 148 154 protected IsA getDefaultIsAForURI() 155 { 156 return IsA.PROPERTY; 157 } 158 159 160 161 165 public boolean eval() 166 { 167 verifyCanEvaluate_("eval"); 168 169 if (isProperty()) { 170 if (m_checkUnresolved) { 171 if (!LocalPropertyExaminer.verifyProperty 172 (getProject(), getValueHelper())) { 173 return false; 174 } 175 } 176 } 177 else if (isReference()) { 178 Object o = getProject().getReference(getResolvedFlexValue()); 179 if (!(o instanceof String )) { return o!=null; 181 } 182 } 183 184 return getValueHelper().getValue()!=null; 185 } 186 187 188 private boolean m_checkUnresolved;} 190 191 192 | Popular Tags |