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.juneau.svl; 018 019import java.io.*; 020 021/** 022 * Abstract superclass of all Simple Var Language variables that resolve to simple returned string values. 023 * 024 * <p> 025 * Note the difference between this class and {@link StreamedVar} that streams values to writers. 026 * <br>Unlike the {@link StreamedVar} class, the returned value from this class can contain nested variables that will be 027 * recursively resolved by {@link VarResolver}. 028 * 029 * <p> 030 * Subclasses must implement the following method: 031 * <ul class='javatree'> 032 * <li class='jm'>{@link #resolve(VarResolverSession, String)} 033 * </ul> 034 * 035 * <h5 class='section'>See Also:</h5><ul> 036 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/SimpleVariableLanguageBasics">Simple Variable Language Basics</a> 037 * </ul> 03809 */ 039public abstract class SimpleVar extends Var { 040 041 /** 042 * Constructor. 043 * 044 * @param name The variable name (e.g. <js>"C"</js> for variables of the form <js>"$C{...}"</js>) 045 */ 046 protected SimpleVar(String name) { 047 super(name, false); 048 } 049 050 @Override /* Var */ 051 public void resolveTo(VarResolverSession session, Writer w, String arg) throws Exception { 052 throw new UnsupportedOperationException("Cannot call streamTo() on SimpleVar class"); 053 } 054}