1 16 package com.google.gwt.dev.cfg; 17 18 import com.google.gwt.core.ext.BadPropertyValueException; 19 import com.google.gwt.core.ext.PropertyOracle; 20 import com.google.gwt.core.ext.TreeLogger; 21 22 26 public class StaticPropertyOracle implements PropertyOracle { 27 28 private Property[] currentProps; 29 30 private String [] currentValues; 31 32 public StaticPropertyOracle() { 33 } 34 35 public String getPropertyValue(TreeLogger logger, String propertyName) 36 throws BadPropertyValueException { 37 for (int i = 0; i < currentProps.length; i++) { 43 Property prop = currentProps[i]; 44 if (prop.getName().equals(propertyName)) { 45 String value = currentValues[i]; 46 if (prop.isKnownValue(value)) { 47 return value; 48 } else { 49 throw new BadPropertyValueException(propertyName, value); 50 } 51 } 52 } 53 54 throw new BadPropertyValueException(propertyName); 57 } 58 59 public void setPropertyValues(Property[] props, String [] values) { 60 currentProps = props; 61 currentValues = values; 62 } 63 } 64 | Popular Tags |