1 16 17 package org.springframework.scripting.support; 18 19 import org.springframework.scripting.ScriptSource; 20 import org.springframework.util.Assert; 21 22 32 public class StaticScriptSource implements ScriptSource { 33 34 private String script; 35 36 private boolean modified; 37 38 39 44 public StaticScriptSource(String script) { 45 setScript(script); 46 } 47 48 49 54 public synchronized void setScript(String script) { 55 Assert.hasText(script, "Script must not be empty"); 56 this.modified = !script.equals(this.script); 57 this.script = script; 58 } 59 60 61 public synchronized String getScriptAsString() { 62 this.modified = false; 63 return this.script; 64 } 65 66 public synchronized boolean isModified() { 67 return this.modified; 68 } 69 70 71 public synchronized String toString() { 72 return this.script; 73 } 74 75 } 76 | Popular Tags |