001// *************************************************************************************************************************** 002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * 003// * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * 004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * 005// * with the License. You may obtain a copy of the License at * 006// * * 007// * http://www.apache.org/licenses/LICENSE-2.0 * 008// * * 009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * 010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * 011// * specific language governing permissions and limitations under the License. * 012// *************************************************************************************************************************** 013package org.apache.juneau.svl; 014 015import java.io.*; 016 017/** 018 * Abstract superclass of all Simple Var Language variables that resolve to simple returned string values. 019 * 020 * <p> 021 * Note the difference between this class and {@link StreamedVar} that streams values to writers. 022 * <br>Unlike the {@link StreamedVar} class, the returned value from this class can contain nested variables that will be 023 * recursively resolved by {@link VarResolver}. 024 * 025 * <p> 026 * Subclasses must implement the following method: 027 * <ul class='javatree'> 028 * <li class='jm'>{@link #resolve(VarResolverSession, String)} 029 * </ul> 030 * 031 * <h5 class='section'>See Also:</h5><ul> 032 * <li class='link'><a class="doclink" href="../../../../index.html#jm.SimpleVariableLanguage">Simple Variable Language</a> 033 * </ul> 03409 */ 035public abstract class SimpleVar extends Var { 036 037 /** 038 * Constructor. 039 * 040 * @param name The variable name (e.g. <js>"C"</js> for variables of the form <js>"$C{...}"</js>) 041 */ 042 protected SimpleVar(String name) { 043 super(name, false); 044 } 045 046 @Override /* Var */ 047 public void resolveTo(VarResolverSession session, Writer w, String arg) throws Exception { 048 throw new UnsupportedOperationException("Cannot call streamTo() on SimpleVar class"); 049 } 050}