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 015/** 016 * Abstract superclass of all Simple Var Language variables that write their values directly to a writer. 017 * 018 * <p> 019 * Note the difference between this class and {@link SimpleVar} that returns simple string values. 020 * <br>Unlike the {@link SimpleVar} class, the output from this class cannot contain nested variables. 021 * <br>However, this class can be more efficient for variables that produce large amounts of output so that the creation 022 * of large in-memory strings is avoided. 023 * 024 * <p> 025 * Subclasses must implement the following method: 026 * <ul class='javatree'> 027 * <li class='jm'>{@link #resolveTo(VarResolverSession, java.io.Writer, String)} 028 * </ul> 029 * 030 * <h5 class='section'>See Also:</h5><ul> 031 * <li class='link'><a class="doclink" href="../../../../index.html#jm.SimpleVariableLanguage">Simple Variable Language</a> 032 * </ul> 033 */ 034public abstract class StreamedVar extends Var { 035 036 /** 037 * Constructor. 038 * 039 * @param name The variable name (e.g. <js>"C"</js> for variables of the form <js>"$C{...}"</js>) 040 */ 041 public StreamedVar(String name) { 042 super(name, true); 043 } 044 045 @Override /* Var */ 046 public String resolve(VarResolverSession session, String arg) throws Exception { 047 throw new UnsupportedOperationException("Cannot call resolve() on StreamedVar class"); 048 } 049}