001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018 package org.apache.commons.jexl3.introspection; 019 020 import java.util.Iterator; 021 import org.apache.commons.jexl3.JexlInfo; 022 023 /** 024 * 'Federated' introspection/reflection interface to allow the introspection 025 * behavior in JEXL to be customized. 026 * 027 * @since 1.0 028 */ 029 public interface Uberspect { 030 /** Sets the class loader to use when getting a constructor with 031 * a class name parameter. 032 * @param loader the class loader 033 */ 034 void setClassLoader(ClassLoader loader); 035 036 /** 037 * Returns a class constructor. 038 * @param ctorHandle a class or class name 039 * @param args constructor arguments 040 * @param info contextual information 041 * @return a {@link JexlMethod} 042 * @since 3.0 043 */ 044 JexlMethod getConstructor(Object ctorHandle, Object[] args, JexlInfo.Handle info); 045 /** 046 * Returns a JexlMethod. 047 * @param obj the object 048 * @param method the method name 049 * @param args method arguments 050 * @param info contextual information 051 * @return a {@link JexlMethod} 052 */ 053 JexlMethod getMethod(Object obj, String method, Object[] args, JexlInfo.Handle info); 054 055 /** 056 * Property getter. 057 * <p>Returns JexlPropertyGet appropos for ${bar.woogie}. 058 * @param obj the object to get the property from 059 * @param identifier property name 060 * @param info contextual information 061 * @return a {@link JexlPropertyGet} 062 */ 063 JexlPropertyGet getPropertyGet(Object obj, Object identifier, JexlInfo.Handle info); 064 065 /** 066 * Property setter. 067 * <p>returns JelPropertySet appropos for ${foo.bar = "geir"}</p>. 068 * @param obj the object to get the property from. 069 * @param identifier property name 070 * @param arg value to set 071 * @param info contextual information 072 * @return a {@link JexlPropertySet}. 073 */ 074 JexlPropertySet getPropertySet(Object obj, Object identifier, Object arg, JexlInfo.Handle info); 075 076 /** 077 * Gets an iterator from an object. 078 * @param obj to get the iterator for 079 * @param info contextual information 080 * @return an iterator over obj 081 */ 082 Iterator<?> getIterator(Object obj, JexlInfo.Handle info); 083 084 }