1 /*
2  * Copyright 2002-2008 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package org.springframework.scripting;
18 
19 import java.io.IOException;
20 
21 /**
22  * Interface that defines the source of a script.
23  * Tracks whether the underlying script has been modified.
24  *
25  * @author Rob Harrop
26  * @author Juergen Hoeller
27  * @since 2.0
28  */
29 public interface ScriptSource {
30 
31 	/**
32 	 * Retrieve the current script source text as String.
33 	 * @return the script text
34 	 * @throws IOException if script retrieval failed
35 	 */
getScriptAsString()36 	String getScriptAsString() throws IOException;
37 
38 	/**
39 	 * Indicate whether the underlying script data has been modified since
40 	 * the last time {@link #getScriptAsString()} was called.
41 	 * Returns <code>true</code> if the script has not been read yet.
42 	 * @return whether the script data has been modified
43 	 */
isModified()44 	boolean isModified();
45 
46 	/**
47 	 * Determine a class name for the underlying script.
48 	 * @return the suggested class name, or <code>null</code> if none available
49 	 */
suggestedClassName()50 	String suggestedClassName();
51 
52 }
53