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 */
017package org.apache.commons.jexl2;
018
019/**
020 * 
021 * This interface declares how to resolve a namespace from its name; it is used by the interpreter during evalutation.
022 * <p>
023 * In JEXL, a namespace is an object that serves the purpose of encapsulating functions; for instance,
024 * the "math" namespace would be the proper object to expose functions like "log(...)", "sinus(...)", etc.
025 * </p>
026 * In expressions like "ns:function(...)", the resolver is called with resolveNamespace("ns").
027 * <p>
028 * JEXL itself reserves 'jexl' and 'ujexl' as namespaces for internal purpose; resolving those may lead to unexpected
029 * results.
030 * </p>
031 * @since 2.1
032 */
033public interface NamespaceResolver {
034    /**
035     * Resolves a namespace by its name.
036     * @param name the name
037     * @return the namespace object
038     */
039    Object resolveNamespace(String name);
040}