1 16 package scriptella.core; 17 18 import scriptella.configuration.ContentEl; 19 import scriptella.configuration.Location; 20 import scriptella.configuration.ScriptingElement; 21 import scriptella.spi.DialectIdentifier; 22 import scriptella.spi.Resource; 23 24 30 public abstract class ContentExecutor<T extends ScriptingElement> implements ExecutableElement { 31 private Resource cachedContent; private T element; 33 34 39 protected ContentExecutor(T scriptingElement) { 40 this.element = scriptingElement; 41 } 42 43 48 public T getElement() { 49 return element; 50 } 51 52 60 public Resource getContent(DialectIdentifier dialectIdentifier) { 61 if (cachedContent == null) { 62 cachedContent = element.getDialectContent(dialectIdentifier); 63 } 64 if (cachedContent == null) { cachedContent = ContentEl.NULL_CONTENT; 66 } 67 return cachedContent; 68 69 } 70 71 72 75 public Location getLocation() { 76 return getElement().getLocation(); 77 } 78 } 79 | Popular Tags |