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