1 16 package org.directwebremoting.guice; 17 18 import com.google.inject.Key; 19 import com.google.inject.Injector; 20 21 import java.util.Map ; 22 23 import org.directwebremoting.extend.Creator; 24 25 30 class InternalCreator implements Creator 31 { 32 InternalCreator(Injector injector, Key key, String scriptName) 33 { 34 this.injector = injector; 35 this.key = key; 36 this.scriptName = scriptName; 37 } 38 39 public void setProperties(Map params) throws IllegalArgumentException 40 { 41 } 43 44 public Class getType() 45 { 46 return (Class ) key.getTypeLiteral().getType(); 47 } 48 49 public Object getInstance() throws InstantiationException 50 { 51 return injector.getInstance(key); 52 } 53 54 public String getScope() 55 { 56 return Creator.PAGE; } 58 59 public boolean isCacheable() 60 { 61 return true; 62 } 63 64 public String getJavascript() 65 { 66 return scriptName; 67 } 68 69 private final Injector injector; 70 private final Key key; 71 private final String scriptName; 72 } 73 | Popular Tags |