1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package org.apache.commons.jexl3.parser; 19 20 import org.apache.commons.jexl3.internal.Debugger; 21 22 /** 23 * Base node for array/set/map literals. 24 * <p>Captures constness and extensibility (...)</p> 25 */ 26 public class ExtensibleNode extends JexlNode { 27 /** Whether this array/set/map is constant or not. */ 28 protected boolean constant; 29 /** Whether this array/set/map is extended or not. */ 30 private boolean extended; 31 32 public ExtensibleNode(final int id) { 33 super(id); 34 } 35 36 @Override 37 protected boolean isConstant(final boolean literal) { 38 return constant; 39 } 40 41 public boolean isExtended() { 42 return extended; 43 } 44 45 @Override 46 public void jjtClose() { 47 constant = super.isConstant(true); 48 } 49 50 public void setExtended(final boolean e) { 51 this.extended = e; 52 } 53 54 @Override 55 public String toString() { 56 final Debugger dbg = new Debugger(); 57 return dbg.data(this); 58 } 59 60 }