1 16 package com.google.gwt.dev.cfg; 17 18 import com.google.gwt.core.ext.UnableToCompleteException; 19 import com.google.gwt.dev.util.Util; 20 21 import java.util.HashMap ; 22 import java.util.Map ; 23 24 29 public class Compilation { 30 31 private Map rebindDecisions = new HashMap (); 32 33 private Map sourceHashByGeneratedTypeName = new HashMap (); 34 35 private String strongName; 36 37 public Compilation() { 38 } 39 40 public String [] getGeneratedTypeNames() { 41 return Util.toStringArray(sourceHashByGeneratedTypeName.keySet()); 42 } 43 44 public String [] getRebindInputs() { 45 return Util.toStringArray(rebindDecisions.keySet()); 46 } 47 48 52 public String getRebindOutput(String inputTypeName) { 53 String out = (String ) rebindDecisions.get(inputTypeName); 54 return out; 55 } 56 57 public String getStrongName() { 58 return strongName; 59 } 60 61 public String getTypeHash(String generatedTypeName) 62 throws UnableToCompleteException { 63 String hash = (String ) sourceHashByGeneratedTypeName.get(generatedTypeName); 64 if (hash != null) { 65 return hash; 66 } else { 67 throw new UnableToCompleteException(); 68 } 69 } 70 71 public boolean recordDecision(String inputTypeName, String outputTypeName) { 72 String recodedOutputName = (String ) rebindDecisions.get(inputTypeName); 74 if (recodedOutputName != null) { 75 if (!recodedOutputName.equals(outputTypeName)) { 77 String msg = "Decision '" + recodedOutputName 78 + "' already recorded for '" + inputTypeName + "'"; 79 throw new IllegalStateException (msg); 80 } 81 return false; 83 } 84 rebindDecisions.put(inputTypeName, outputTypeName); 85 return true; 87 } 88 89 public void recordGeneratedTypeHash(String generatedTypeName, 90 String sourceHash) { 91 sourceHashByGeneratedTypeName.put(generatedTypeName, sourceHash); 92 } 93 94 public void setStrongName(String strongName) { 95 this.strongName = strongName; 96 } 97 } 98 | Popular Tags |