001/* 002 * Copyright 2002-2012 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.scripting; 018 019import java.io.IOException; 020 021import org.springframework.lang.Nullable; 022 023/** 024 * Interface that defines the source of a script. 025 * Tracks whether the underlying script has been modified. 026 * 027 * @author Rob Harrop 028 * @author Juergen Hoeller 029 * @since 2.0 030 */ 031public interface ScriptSource { 032 033 /** 034 * Retrieve the current script source text as String. 035 * @return the script text 036 * @throws IOException if script retrieval failed 037 */ 038 String getScriptAsString() throws IOException; 039 040 /** 041 * Indicate whether the underlying script data has been modified since 042 * the last time {@link #getScriptAsString()} was called. 043 * Returns {@code true} if the script has not been read yet. 044 * @return whether the script data has been modified 045 */ 046 boolean isModified(); 047 048 /** 049 * Determine a class name for the underlying script. 050 * @return the suggested class name, or {@code null} if none available 051 */ 052 @Nullable 053 String suggestedClassName(); 054 055}