001/* 002 * Copyright 2002-2013 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.expression; 018 019 020// TODO Is the resolver/executor model too pervasive in this package? 021/** 022 * Executors are built by resolvers and can be cached by the infrastructure to repeat an 023 * operation quickly without going back to the resolvers. For example, the particular 024 * constructor to run on a class may be discovered by the reflection constructor resolver 025 * - it will then build a ConstructorExecutor that executes that constructor and the 026 * ConstructorExecutor can be reused without needing to go back to the resolver to 027 * discover the constructor again. 028 * 029 * <p>They can become stale, and in that case should throw an AccessException - this will 030 * cause the infrastructure to go back to the resolvers to ask for a new one. 031 * 032 * @author Andy Clement 033 * @since 3.0 034 */ 035public interface ConstructorExecutor { 036 037 /** 038 * Execute a constructor in the specified context using the specified arguments. 039 * @param context the evaluation context in which the command is being executed 040 * @param arguments the arguments to the constructor call, should match (in terms 041 * of number and type) whatever the command will need to run 042 * @return the new object 043 * @throws AccessException if there is a problem executing the command or the 044 * CommandExecutor is no longer valid 045 */ 046 TypedValue execute(EvaluationContext context, Object... arguments) throws AccessException; 047 048}