1 28 29 package com.idaremedia.antx.condition; 30 31 import org.apache.tools.ant.Project; 32 33 import com.idaremedia.antx.FlexString; 34 import com.idaremedia.antx.parameters.IsA; 35 36 47 48 public abstract class SimpleFlexCondition extends FlexCondition 49 implements URIable 50 { 51 54 protected SimpleFlexCondition() 55 { 56 super(); 57 m_impl.setLenient(false); 58 } 59 60 61 65 protected SimpleFlexCondition(String iam) 66 { 67 super(iam); 68 m_impl.setLenient(false); 69 } 70 71 72 73 77 public void setProject(Project project) 78 { 79 super.setProject(project); 80 m_impl.setProject(project); 81 } 82 83 84 85 89 protected final FlexString getValueHelper() 90 { 91 return m_impl; 92 } 93 94 95 96 104 public void xsetFromURI(String uriFragment) 105 { 106 String flexvalue = uriFragment; 107 IsA isa= getDefaultIsAForURI(); 108 109 int i = uriFragment.lastIndexOf("?"); 110 if (i>0) { 111 flexvalue = uriFragment.substring(0,i++); 112 if (i<uriFragment.length()) { 113 String isaName = uriFragment.substring(i); 114 isa = IsA.from(isaName,isa); 115 } 116 } 117 switch (isa.getIndex()) { 118 case IsA.PROPERTY_INDEX: { 119 setProperty(flexvalue); 120 break; 121 } 122 case IsA.VARIABLE_INDEX: { 123 setVariable(flexvalue); 124 break; 125 } 126 case IsA.REFERENCE_INDEX:{ 127 setReference(flexvalue); 128 break; 129 } 130 default: { 131 setLiteral(flexvalue); 132 } 133 } 134 } 135 136 137 143 protected IsA getDefaultIsAForURI() 144 { 145 return IsA.LITERAL; 146 } 147 148 149 private FlexString m_impl = new FlexString(); 150 } 151 152 153 | Popular Tags |