1 16 package com.google.gwt.dev.cfg; 17 18 import com.google.gwt.core.ext.GeneratorContext; 19 import com.google.gwt.core.ext.TreeLogger; 20 21 25 public class ConditionWhenTypeIs extends Condition { 26 27 private final String exactTypeName; 28 29 public ConditionWhenTypeIs(String exactTypeName) { 30 this.exactTypeName = exactTypeName; 31 } 32 33 public String toString() { 34 return "<when-type-is class='" + exactTypeName + "'/>"; 35 } 36 37 protected boolean doEval(TreeLogger logger, GeneratorContext context, 38 String testType) { 39 return exactTypeName.equals(testType); 40 } 41 42 protected String getEvalAfterMessage(String testType, boolean result) { 43 if (result) { 44 return "Yes, the requested type was an exact match"; 45 } else { 46 return "Not an exact match"; 47 } 48 } 49 50 protected String getEvalBeforeMessage(String testType) { 51 return toString(); 52 } 53 } 54 | Popular Tags |