├── spec ├── title.fm ├── Changes.fm ├── ELSpec.book ├── copyrlic.fm ├── language.fm ├── preface.fm ├── ELSpecTOC.fm ├── collection.fm ├── pdf │ ├── EL3.0.FR.pdf │ ├── EL3.0.PR.pdf │ ├── EL3.0.EDR.pdf │ ├── EL3.0.PFD.pdf │ ├── EL3.0.PFD.RC1.pdf │ └── EL3.0.latest.pdf └── SATCK JSR 341 Expression Language 3.0 2.20.13.pdf ├── fonts ├── Helvetica.pfb ├── Helvetica.pfm ├── Times-Bold.pfb ├── Times-Bold.pfm ├── Times-Roman.pfb ├── Times-Roman.pfm ├── Helvetica-Bold.pfb ├── Helvetica-Bold.pfm ├── Palatino-Bold.pfb ├── Palatino-Bold.pfm ├── Palatino-Roman.pfb ├── Palatino-Roman.pfm ├── Times-Italic.pfb ├── Times-Italic.pfm ├── ZapfDingbats.pfb ├── ZapfDingbats.pfm ├── Helvetica-Narrow.pfb ├── Helvetica-Narrow.pfm ├── Palatino-Italic.pfb ├── Palatino-Italic.pfm ├── Times-BoldItalic.pfb ├── Times-BoldItalic.pfm ├── Helvetica-Oblique.pfb ├── Helvetica-Oblique.pfm ├── Palatino-BoldItalic.pfb ├── Palatino-BoldItalic.pfm ├── Helvetica-BoldOblique.pfb ├── Helvetica-BoldOblique.pfm ├── Helvetica-Narrow-Bold.pfb ├── Helvetica-Narrow-Bold.pfm ├── Helvetica-Narrow-Oblique.pfb ├── Helvetica-Narrow-Oblique.pfm ├── Helvetica-Narrow-BoldOblique.pfb ├── Helvetica-Narrow-BoldOblique.pfm └── Readme ├── src ├── test │ └── java │ │ └── org │ │ └── glassfish │ │ └── el │ │ └── test │ │ ├── Date.java │ │ ├── Order.java │ │ ├── Product.java │ │ ├── Customer.java │ │ ├── StaticRefTest.java │ │ ├── ConvertTest.java │ │ ├── DataBase.java │ │ ├── LambdaTest.java │ │ ├── EvalListenerTest.java │ │ ├── ElasticityTest.java.sav │ │ └── OperatorTest.java └── assembly │ └── assembly.xml ├── nb-configuration.xml ├── CONTRIBUTING.md ├── impl ├── src │ └── main │ │ └── java │ │ └── com │ │ └── sun │ │ └── el │ │ ├── stream │ │ ├── Operator.java │ │ └── Optional.java │ │ ├── parser │ │ ├── AstMapEntry.java │ │ ├── NodeVisitor.java │ │ ├── AstPropertySuffix.java │ │ ├── AstConcat.java │ │ ├── AstTrue.java │ │ ├── AstFalse.java │ │ ├── AstDotSuffix.java │ │ ├── AstAssign.java │ │ ├── BooleanNode.java │ │ ├── ELParserTreeConstants.java │ │ ├── ArithmeticNode.java │ │ ├── AstBracketSuffix.java │ │ ├── AstLambdaParameters.java │ │ ├── AstListData.java │ │ ├── AstNull.java │ │ ├── AstEqual.java │ │ ├── AstNotEqual.java │ │ ├── AstMod.java │ │ ├── AstDiv.java │ │ ├── AstSemiColon.java │ │ ├── AstMinus.java │ │ ├── AstMult.java │ │ ├── AstPlus.java │ │ ├── AstAnd.java │ │ ├── AstOr.java │ │ ├── AstNot.java │ │ ├── AstLessThan.java │ │ ├── AstGreaterThan.java │ │ ├── AstLessThanEqual.java │ │ ├── AstGreaterThanEqual.java │ │ ├── AstMethodArguments.java │ │ ├── AstDynamicExpression.java │ │ ├── AstDeferredExpression.java │ │ ├── AstCompositeExpression.java │ │ ├── AstInteger.java │ │ ├── AstFloatingPoint.java │ │ ├── AstMapData.java │ │ ├── AstEmpty.java │ │ ├── AstLiteralExpression.java │ │ ├── AstString.java │ │ ├── JJTELParserState.java │ │ ├── AstLambdaExpression.java │ │ ├── AstChoice.java │ │ └── Node.java │ │ ├── lang │ │ ├── VariableMapperFactory.java │ │ ├── FunctionMapperFactory.java │ │ └── VariableMapperImpl.java │ │ └── util │ │ └── MessageFactory.java └── build.xml └── api └── src └── main └── java └── javax └── el ├── ValueReference.java ├── ELClass.java ├── EvaluationListener.java ├── ELContextListener.java ├── PrivateMessages.properties ├── ELContextEvent.java └── VariableMapper.java /spec/title.fm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/title.fm -------------------------------------------------------------------------------- /spec/Changes.fm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/Changes.fm -------------------------------------------------------------------------------- /spec/ELSpec.book: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/ELSpec.book -------------------------------------------------------------------------------- /spec/copyrlic.fm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/copyrlic.fm -------------------------------------------------------------------------------- /spec/language.fm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/language.fm -------------------------------------------------------------------------------- /spec/preface.fm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/preface.fm -------------------------------------------------------------------------------- /fonts/Helvetica.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica.pfb -------------------------------------------------------------------------------- /fonts/Helvetica.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica.pfm -------------------------------------------------------------------------------- /spec/ELSpecTOC.fm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/ELSpecTOC.fm -------------------------------------------------------------------------------- /spec/collection.fm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/collection.fm -------------------------------------------------------------------------------- /fonts/Times-Bold.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Times-Bold.pfb -------------------------------------------------------------------------------- /fonts/Times-Bold.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Times-Bold.pfm -------------------------------------------------------------------------------- /fonts/Times-Roman.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Times-Roman.pfb -------------------------------------------------------------------------------- /fonts/Times-Roman.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Times-Roman.pfm -------------------------------------------------------------------------------- /spec/pdf/EL3.0.FR.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/pdf/EL3.0.FR.pdf -------------------------------------------------------------------------------- /spec/pdf/EL3.0.PR.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/pdf/EL3.0.PR.pdf -------------------------------------------------------------------------------- /fonts/Helvetica-Bold.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica-Bold.pfb -------------------------------------------------------------------------------- /fonts/Helvetica-Bold.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica-Bold.pfm -------------------------------------------------------------------------------- /fonts/Palatino-Bold.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Palatino-Bold.pfb -------------------------------------------------------------------------------- /fonts/Palatino-Bold.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Palatino-Bold.pfm -------------------------------------------------------------------------------- /fonts/Palatino-Roman.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Palatino-Roman.pfb -------------------------------------------------------------------------------- /fonts/Palatino-Roman.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Palatino-Roman.pfm -------------------------------------------------------------------------------- /fonts/Times-Italic.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Times-Italic.pfb -------------------------------------------------------------------------------- /fonts/Times-Italic.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Times-Italic.pfm -------------------------------------------------------------------------------- /fonts/ZapfDingbats.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/ZapfDingbats.pfb -------------------------------------------------------------------------------- /fonts/ZapfDingbats.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/ZapfDingbats.pfm -------------------------------------------------------------------------------- /spec/pdf/EL3.0.EDR.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/pdf/EL3.0.EDR.pdf -------------------------------------------------------------------------------- /spec/pdf/EL3.0.PFD.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/pdf/EL3.0.PFD.pdf -------------------------------------------------------------------------------- /fonts/Helvetica-Narrow.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica-Narrow.pfb -------------------------------------------------------------------------------- /fonts/Helvetica-Narrow.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica-Narrow.pfm -------------------------------------------------------------------------------- /fonts/Palatino-Italic.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Palatino-Italic.pfb -------------------------------------------------------------------------------- /fonts/Palatino-Italic.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Palatino-Italic.pfm -------------------------------------------------------------------------------- /fonts/Times-BoldItalic.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Times-BoldItalic.pfb -------------------------------------------------------------------------------- /fonts/Times-BoldItalic.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Times-BoldItalic.pfm -------------------------------------------------------------------------------- /spec/pdf/EL3.0.PFD.RC1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/pdf/EL3.0.PFD.RC1.pdf -------------------------------------------------------------------------------- /spec/pdf/EL3.0.latest.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/pdf/EL3.0.latest.pdf -------------------------------------------------------------------------------- /fonts/Helvetica-Oblique.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica-Oblique.pfb -------------------------------------------------------------------------------- /fonts/Helvetica-Oblique.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica-Oblique.pfm -------------------------------------------------------------------------------- /fonts/Palatino-BoldItalic.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Palatino-BoldItalic.pfb -------------------------------------------------------------------------------- /fonts/Palatino-BoldItalic.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Palatino-BoldItalic.pfm -------------------------------------------------------------------------------- /fonts/Helvetica-BoldOblique.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica-BoldOblique.pfb -------------------------------------------------------------------------------- /fonts/Helvetica-BoldOblique.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica-BoldOblique.pfm -------------------------------------------------------------------------------- /fonts/Helvetica-Narrow-Bold.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica-Narrow-Bold.pfb -------------------------------------------------------------------------------- /fonts/Helvetica-Narrow-Bold.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica-Narrow-Bold.pfm -------------------------------------------------------------------------------- /fonts/Helvetica-Narrow-Oblique.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica-Narrow-Oblique.pfb -------------------------------------------------------------------------------- /fonts/Helvetica-Narrow-Oblique.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica-Narrow-Oblique.pfm -------------------------------------------------------------------------------- /fonts/Helvetica-Narrow-BoldOblique.pfb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica-Narrow-BoldOblique.pfb -------------------------------------------------------------------------------- /fonts/Helvetica-Narrow-BoldOblique.pfm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/fonts/Helvetica-Narrow-BoldOblique.pfm -------------------------------------------------------------------------------- /spec/SATCK JSR 341 Expression Language 3.0 2.20.13.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javaee/el-spec/HEAD/spec/SATCK JSR 341 Expression Language 3.0 2.20.13.pdf -------------------------------------------------------------------------------- /fonts/Readme: -------------------------------------------------------------------------------- 1 | These are the Windows fonts used in the EL spec framkemaker files. They 2 | should be installed on the Windows before starting the Framemaker. 3 | -------------------------------------------------------------------------------- /src/test/java/org/glassfish/el/test/Date.java: -------------------------------------------------------------------------------- 1 | package org.glassfish.el.test; 2 | 3 | public class Date { 4 | int year, month, date; 5 | 6 | public Date(int year, int month, int date) { 7 | this.year = year; 8 | this.month = month; 9 | this.date = date; 10 | } 11 | 12 | public int getYear() { return year; } 13 | public int getMonth() { return month; } 14 | public int getDate() { return date; } 15 | 16 | public String toString() { 17 | return "" + month + "/" + date + "/" + year; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/org/glassfish/el/test/Order.java: -------------------------------------------------------------------------------- 1 | package org.glassfish.el.test; 2 | 3 | public class Order { 4 | 5 | int orderID; 6 | int customerID; 7 | Date orderDate; 8 | double total; 9 | 10 | public Order(int orderID, int customerID, Date orderDate, double total) { 11 | this.orderID = orderID; 12 | this.customerID = customerID; 13 | this.orderDate = orderDate; 14 | this.total = total; 15 | } 16 | 17 | public String toString() { 18 | return "Order: " + orderID + ", " + customerID + 19 | ", " + orderDate.toString() + ", " + total; 20 | } 21 | 22 | public int getOrderID() { return orderID; } 23 | public int getCustomerID() { return customerID; } 24 | public Date getOrderDate() { return orderDate; } 25 | public double getTotal() { return total; } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/org/glassfish/el/test/Product.java: -------------------------------------------------------------------------------- 1 | package org.glassfish.el.test; 2 | 3 | public class Product { 4 | 5 | public int productID; 6 | public String name; 7 | public String category; 8 | public double unitPrice; 9 | public int unitsInStock; 10 | 11 | Product (int productID, String name, String category, 12 | double unitPrice, int unitsInStock) { 13 | 14 | this.productID = productID; 15 | this.name = name; 16 | this.category = category; 17 | this.unitPrice = unitPrice; 18 | this.unitsInStock = unitsInStock; 19 | } 20 | 21 | public String toString() { 22 | return "Product: " + productID + ", " + name + ", " + 23 | category + ", " + unitPrice + ", " + unitsInStock; 24 | } 25 | 26 | public int getProductID() { return productID; } 27 | public String getName() { return name; } 28 | public String getCategory() { return category; } 29 | public double getUnitPrice() { return unitPrice; } 30 | public int getUnitsInStock() { return unitsInStock; } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /nb-configuration.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 16 | all 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/assembly/assembly.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | el-sources 6 | 7 | zip 8 | 9 | 10 | 11 | 12 | ${project.basedir} 13 | / 14 | 15 | spec/** 16 | fonts/** 17 | target/** 18 | api/target/** 19 | src/assembly/** 20 | 21 | 22 | 23 | / 24 | ${project.build.directory}/license 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/test/java/org/glassfish/el/test/Customer.java: -------------------------------------------------------------------------------- 1 | package org.glassfish.el.test; 2 | 3 | import java.util.List; 4 | import java.util.ArrayList; 5 | 6 | public class Customer { 7 | int customerID; 8 | String name; 9 | String address; 10 | String city; 11 | String country; 12 | String phone; 13 | List orders; 14 | 15 | public Customer(int customerID, String name, String address, String city, 16 | String country, String phone) { 17 | this.customerID = customerID; 18 | this.name = name; 19 | this.address = address; 20 | this.city = city; 21 | this.country = country; 22 | this.phone = phone; 23 | this.orders = new ArrayList(); 24 | } 25 | 26 | public String toString() { 27 | return "Customer: " + customerID + ", " + name + ", " + city + ", " + 28 | country; 29 | } 30 | 31 | public int getCustomerID() { return customerID;} 32 | public String getName() { return name;} 33 | public String getAddress() { return address; } 34 | public String getCity() { return city; } 35 | public String getCountry() { return country; } 36 | public String getPhone() { return phone; } 37 | public List getOrders() { return orders; } 38 | } 39 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | --- 4 | 5 | # Source Code Submissions 6 | We welcome your contributions and look forward to collaborating with you. We can only accept source code repository 7 | submissions from users who have signed and returned the Oracle 8 | Contributor Agreement. You will find details and the agreement to sign at this OTN web page: 9 | [Oracle Contributor Agreement](http://www.oracle.com/technetwork/community/oca-486395.html). 10 | 11 | # Other Contributions 12 | For all project Submissions other than source code repository contributions, the following also applies: Oracle does 13 | not claim ownership of Your Submissions. However, in order to fulfill 14 | the purposes of this project, You must give Oracle and all Users 15 | the right to post, access, discuss, use, publish, disseminate, and refine 16 | Your Submissions. 17 | 18 | In legalese: *You hereby grant to Oracle and all 19 | Users a royalty-free, perpetual, irrevocable, worldwide, non-exclusive, 20 | and fully sub-licensable right and license, under Your intellectual 21 | property rights, to reproduce, modify, adapt, publish, translate, create 22 | derivative works from, distribute, perform, display, and use Your 23 | Submissions (in whole or part) and to incorporate or implement them in 24 | other works in any form, media, or technology now known or later 25 | developed, all subject to the obligation to retain any copyright notices 26 | included in Your Submissions. All Users, Oracle, and their 27 | sublicensees are responsible for any modifications they make to the 28 | Submissions of others.* 29 | 30 | Copyright © 2017 Oracle and/or its affiliates. All rights reserved. 31 | -------------------------------------------------------------------------------- /src/test/java/org/glassfish/el/test/StaticRefTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package org.glassfish.el.test; 7 | 8 | import org.junit.After; 9 | import org.junit.AfterClass; 10 | import org.junit.Before; 11 | import org.junit.BeforeClass; 12 | import org.junit.Test; 13 | import static org.junit.Assert.*; 14 | 15 | import javax.el.*; 16 | 17 | /** 18 | * 19 | * @author kichung 20 | */ 21 | public class StaticRefTest { 22 | 23 | ELProcessor elp; 24 | 25 | public StaticRefTest() { 26 | } 27 | 28 | @BeforeClass 29 | public static void setUpClass() throws Exception { 30 | } 31 | 32 | @AfterClass 33 | public static void tearDownClass() throws Exception { 34 | } 35 | 36 | @Before 37 | public void setUp() { 38 | elp = new ELProcessor(); 39 | } 40 | 41 | @After 42 | public void tearDown() { 43 | } 44 | 45 | @Test 46 | public void testStaticRef() { 47 | // Pre imported java.lang classes 48 | // assertTrue((Boolean)elp.eval("T(java.lang.Boolean).TRUE")); 49 | // assertTrue((Boolean)elp.eval("T(Boolean).TRUE")); 50 | assertTrue((Boolean)elp.eval("Boolean.TRUE")); 51 | assertTrue((Boolean)elp.eval("Boolean.TRUE")); // test caching Boolean 52 | } 53 | 54 | /* 55 | @Test 56 | public void testClass() { 57 | assertEquals(String.class, elp.eval("String.class")); 58 | } 59 | */ 60 | 61 | @Test 62 | public void testConstructor() { 63 | // assertEquals(new Integer(1001), elp.eval("T(Integer)(1001)")); 64 | assertEquals(new Integer(1001), elp.eval("Integer(1001)")); 65 | } 66 | 67 | @Test 68 | public void testStaticMethod() { 69 | assertEquals(4, elp.eval("Integer.numberOfTrailingZeros(16)")); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/stream/Operator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | * 40 | * @author Kin-man Chung 41 | */ 42 | 43 | package com.sun.el.stream; 44 | 45 | import java.util.Iterator; 46 | 47 | interface Operator { 48 | 49 | Iterator iterator(Iterator upstream); 50 | } 51 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstMapEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | /** 44 | * @author Kin-man Chung 45 | */ 46 | public 47 | class AstMapEntry extends SimpleNode { 48 | public AstMapEntry(int id) { 49 | super(id); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/NodeVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | /** 46 | * @author Jacob Hookom [jacob@hookom.net] 47 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 48 | */ 49 | public interface NodeVisitor { 50 | public void visit(Node node) throws ELException; 51 | } 52 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstPropertySuffix.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | public final class AstPropertySuffix extends SimpleNode { 48 | public AstPropertySuffix(int id) { 49 | super(id); 50 | } 51 | 52 | public Object getValue(EvaluationContext ctx) 53 | throws ELException { 54 | return this.image; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstConcat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | import com.sun.el.lang.EvaluationContext; 45 | 46 | /** 47 | * @author Kin-man Chung 48 | */ 49 | public final 50 | class AstConcat extends SimpleNode { 51 | public AstConcat(int id) { 52 | super(id); 53 | } 54 | 55 | public Object getValue(EvaluationContext ctx) 56 | throws ELException { 57 | return children[0].getValue(ctx).toString() + 58 | children[1].getValue(ctx).toString(); 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstTrue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstTrue extends BooleanNode { 52 | public AstTrue(int id) { 53 | super(id); 54 | } 55 | 56 | public Object getValue(EvaluationContext ctx) 57 | throws ELException { 58 | return Boolean.TRUE; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstFalse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstFalse extends BooleanNode { 52 | public AstFalse(int id) { 53 | super(id); 54 | } 55 | 56 | public Object getValue(EvaluationContext ctx) 57 | throws ELException { 58 | return Boolean.FALSE; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstDotSuffix.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstDotSuffix extends SimpleNode { 52 | public AstDotSuffix(int id) { 53 | super(id); 54 | } 55 | 56 | public Object getValue(EvaluationContext ctx) 57 | throws ELException { 58 | return this.image; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstAssign.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | import javax.el.VariableMapper; 45 | import com.sun.el.ValueExpressionImpl; 46 | import com.sun.el.lang.EvaluationContext; 47 | 48 | public 49 | class AstAssign extends SimpleNode { 50 | public AstAssign(int id) { 51 | super(id); 52 | } 53 | 54 | public Object getValue(EvaluationContext ctx) 55 | throws ELException { 56 | 57 | Object value = children[1].getValue(ctx); 58 | children[0].setValue(ctx, value); 59 | return value; 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/BooleanNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public class BooleanNode extends SimpleNode { 52 | /** 53 | * @param i 54 | */ 55 | public BooleanNode(int i) { 56 | super(i); 57 | } 58 | public Class getType(EvaluationContext ctx) 59 | throws ELException { 60 | return Boolean.class; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/ELParserTreeConstants.java: -------------------------------------------------------------------------------- 1 | /* Generated By:JavaCC: Do not edit this line. ELParserTreeConstants.java Version 5.0 */ 2 | package com.sun.el.parser; 3 | 4 | public interface ELParserTreeConstants 5 | { 6 | public int JJTCOMPOSITEEXPRESSION = 0; 7 | public int JJTLITERALEXPRESSION = 1; 8 | public int JJTDEFERREDEXPRESSION = 2; 9 | public int JJTDYNAMICEXPRESSION = 3; 10 | public int JJTVOID = 4; 11 | public int JJTSEMICOLON = 5; 12 | public int JJTASSIGN = 6; 13 | public int JJTLAMBDAEXPRESSION = 7; 14 | public int JJTLAMBDAPARAMETERS = 8; 15 | public int JJTCHOICE = 9; 16 | public int JJTOR = 10; 17 | public int JJTAND = 11; 18 | public int JJTEQUAL = 12; 19 | public int JJTNOTEQUAL = 13; 20 | public int JJTLESSTHAN = 14; 21 | public int JJTGREATERTHAN = 15; 22 | public int JJTLESSTHANEQUAL = 16; 23 | public int JJTGREATERTHANEQUAL = 17; 24 | public int JJTCONCAT = 18; 25 | public int JJTPLUS = 19; 26 | public int JJTMINUS = 20; 27 | public int JJTMULT = 21; 28 | public int JJTDIV = 22; 29 | public int JJTMOD = 23; 30 | public int JJTNEGATIVE = 24; 31 | public int JJTNOT = 25; 32 | public int JJTEMPTY = 26; 33 | public int JJTVALUE = 27; 34 | public int JJTDOTSUFFIX = 28; 35 | public int JJTBRACKETSUFFIX = 29; 36 | public int JJTMETHODARGUMENTS = 30; 37 | public int JJTMAPDATA = 31; 38 | public int JJTMAPENTRY = 32; 39 | public int JJTLISTDATA = 33; 40 | public int JJTIDENTIFIER = 34; 41 | public int JJTFUNCTION = 35; 42 | public int JJTTRUE = 36; 43 | public int JJTFALSE = 37; 44 | public int JJTFLOATINGPOINT = 38; 45 | public int JJTINTEGER = 39; 46 | public int JJTSTRING = 40; 47 | public int JJTNULL = 41; 48 | 49 | 50 | public String[] jjtNodeName = { 51 | "CompositeExpression", 52 | "LiteralExpression", 53 | "DeferredExpression", 54 | "DynamicExpression", 55 | "void", 56 | "SemiColon", 57 | "Assign", 58 | "LambdaExpression", 59 | "LambdaParameters", 60 | "Choice", 61 | "Or", 62 | "And", 63 | "Equal", 64 | "NotEqual", 65 | "LessThan", 66 | "GreaterThan", 67 | "LessThanEqual", 68 | "GreaterThanEqual", 69 | "Concat", 70 | "Plus", 71 | "Minus", 72 | "Mult", 73 | "Div", 74 | "Mod", 75 | "Negative", 76 | "Not", 77 | "Empty", 78 | "Value", 79 | "DotSuffix", 80 | "BracketSuffix", 81 | "MethodArguments", 82 | "MapData", 83 | "MapEntry", 84 | "ListData", 85 | "Identifier", 86 | "Function", 87 | "True", 88 | "False", 89 | "FloatingPoint", 90 | "Integer", 91 | "String", 92 | "Null", 93 | }; 94 | } 95 | /* JavaCC - OriginalChecksum=295bae338407e43a1d349f1ce802614a (do not edit this line) */ 96 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/ArithmeticNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public class ArithmeticNode extends SimpleNode { 52 | 53 | /** 54 | * @param i 55 | */ 56 | public ArithmeticNode(int i) { 57 | super(i); 58 | } 59 | 60 | public Class getType(EvaluationContext ctx) 61 | throws ELException { 62 | return Number.class; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstBracketSuffix.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @author Kin-man Chung 50 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 51 | */ 52 | public final class AstBracketSuffix extends SimpleNode { 53 | public AstBracketSuffix(int id) { 54 | super(id); 55 | } 56 | 57 | public Object getValue(EvaluationContext ctx) 58 | throws ELException { 59 | return this.children[0].getValue(ctx); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstLambdaParameters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import java.util.List; 44 | import java.util.ArrayList; 45 | 46 | /** 47 | * @author Kin-man Chung 48 | */ 49 | 50 | public 51 | class AstLambdaParameters extends SimpleNode { 52 | public AstLambdaParameters(int id) { 53 | super(id); 54 | } 55 | 56 | List getParameters() { 57 | List parameters = new ArrayList(); 58 | if (children != null) { 59 | for (Node child: children) { 60 | parameters.add(child.getImage()); 61 | } 62 | } 63 | return parameters; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /api/src/main/java/javax/el/ValueReference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package javax.el; 42 | 43 | import java.io.Serializable; 44 | 45 | /** 46 | * This encapsulates a base model object and one of its properties. 47 | * 48 | * @since EL 2.2 49 | */ 50 | 51 | public class ValueReference implements Serializable { 52 | 53 | private Object base; 54 | private Object property; 55 | 56 | public ValueReference(Object base, Object property) { 57 | 58 | this.base = base; 59 | this.property = property; 60 | } 61 | 62 | public Object getBase() { 63 | return base; 64 | } 65 | 66 | public Object getProperty() { 67 | return property; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstListData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import java.util.ArrayList; 44 | import com.sun.el.lang.EvaluationContext; 45 | 46 | /** 47 | * @author Kin-man Chung 48 | */ 49 | public 50 | class AstListData extends SimpleNode { 51 | public AstListData(int id) { 52 | super(id); 53 | } 54 | 55 | public Object getValue(EvaluationContext ctx) { 56 | ArrayList list = new ArrayList(); 57 | int paramCount = this.jjtGetNumChildren(); 58 | for (int i = 0; i < paramCount; i++) { 59 | list.add(this.children[i].getValue(ctx)); 60 | } 61 | return list; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstNull.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstNull extends SimpleNode { 52 | public AstNull(int id) { 53 | super(id); 54 | } 55 | 56 | public Class getType(EvaluationContext ctx) 57 | throws ELException { 58 | return null; 59 | } 60 | 61 | public Object getValue(EvaluationContext ctx) 62 | throws ELException { 63 | return null; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstEqual.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstEqual extends BooleanNode { 52 | public AstEqual(int id) { 53 | super(id); 54 | } 55 | 56 | public Object getValue(EvaluationContext ctx) 57 | throws ELException { 58 | Object obj0 = this.children[0].getValue(ctx); 59 | Object obj1 = this.children[1].getValue(ctx); 60 | return Boolean.valueOf(equals(obj0, obj1)); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /impl/build.xml: -------------------------------------------------------------------------------- 1 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 55 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstNotEqual.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstNotEqual extends BooleanNode { 52 | public AstNotEqual(int id) { 53 | super(id); 54 | } 55 | 56 | public Object getValue(EvaluationContext ctx) 57 | throws ELException { 58 | Object obj0 = this.children[0].getValue(ctx); 59 | Object obj1 = this.children[1].getValue(ctx); 60 | return Boolean.valueOf(!equals(obj0, obj1)); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstMod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.ELArithmetic; 46 | import com.sun.el.lang.EvaluationContext; 47 | 48 | /** 49 | * @author Jacob Hookom [jacob@hookom.net] 50 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 51 | */ 52 | public final class AstMod extends ArithmeticNode { 53 | public AstMod(int id) { 54 | super(id); 55 | } 56 | 57 | public Object getValue(EvaluationContext ctx) 58 | throws ELException { 59 | Object obj0 = this.children[0].getValue(ctx); 60 | Object obj1 = this.children[1].getValue(ctx); 61 | return ELArithmetic.mod(obj0, obj1); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstDiv.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.ELArithmetic; 46 | import com.sun.el.lang.EvaluationContext; 47 | 48 | /** 49 | * @author Jacob Hookom [jacob@hookom.net] 50 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 51 | */ 52 | public final class AstDiv extends ArithmeticNode { 53 | public AstDiv(int id) { 54 | super(id); 55 | } 56 | 57 | public Object getValue(EvaluationContext ctx) 58 | throws ELException { 59 | Object obj0 = this.children[0].getValue(ctx); 60 | Object obj1 = this.children[1].getValue(ctx); 61 | return ELArithmetic.divide(obj0, obj1); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstSemiColon.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | import com.sun.el.lang.EvaluationContext; 45 | 46 | /** 47 | * @author Kin-man Chung 48 | */ 49 | public 50 | class AstSemiColon extends SimpleNode { 51 | public AstSemiColon(int id) { 52 | super(id); 53 | } 54 | 55 | public Object getValue(EvaluationContext ctx) 56 | throws ELException { 57 | this.children[0].getValue(ctx); 58 | return this.children[1].getValue(ctx); 59 | } 60 | 61 | public void setValue(EvaluationContext ctx, Object value) 62 | throws ELException { 63 | this.children[0].getValue(ctx); 64 | this.children[1].setValue(ctx, value); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstMinus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.ELArithmetic; 46 | import com.sun.el.lang.EvaluationContext; 47 | 48 | /** 49 | * @author Jacob Hookom [jacob@hookom.net] 50 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 51 | */ 52 | public final class AstMinus extends ArithmeticNode { 53 | public AstMinus(int id) { 54 | super(id); 55 | } 56 | 57 | public Object getValue(EvaluationContext ctx) 58 | throws ELException { 59 | Object obj0 = this.children[0].getValue(ctx); 60 | Object obj1 = this.children[1].getValue(ctx); 61 | return ELArithmetic.subtract(obj0, obj1); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstMult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.ELArithmetic; 46 | import com.sun.el.lang.EvaluationContext; 47 | 48 | /** 49 | * @author Jacob Hookom [jacob@hookom.net] 50 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 51 | */ 52 | public final class AstMult extends ArithmeticNode { 53 | public AstMult(int id) { 54 | super(id); 55 | } 56 | 57 | public Object getValue(EvaluationContext ctx) 58 | throws ELException { 59 | Object obj0 = this.children[0].getValue(ctx); 60 | Object obj1 = this.children[1].getValue(ctx); 61 | return ELArithmetic.multiply(obj0, obj1); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstPlus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.ELArithmetic; 46 | import com.sun.el.lang.EvaluationContext; 47 | 48 | /** 49 | * @author Jacob Hookom [jacob@hookom.net] 50 | * @author Kin-man Chung 51 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 52 | */ 53 | public final class AstPlus extends ArithmeticNode { 54 | public AstPlus(int id) { 55 | super(id); 56 | } 57 | 58 | public Object getValue(EvaluationContext ctx) 59 | throws ELException { 60 | Object obj0 = this.children[0].getValue(ctx); 61 | Object obj1 = this.children[1].getValue(ctx); 62 | return ELArithmetic.add(obj0, obj1); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /api/src/main/java/javax/el/ELClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | package javax.el; 41 | 42 | /** 43 | *

A runtime representation of a Class in the EL expressions. 44 | * It encapsulates the java.lang.Class instance.

45 | * 46 | *

This class is used only in {@link StaticFieldELResolver} and will 47 | * probably only be of interest to EL implementors, and not EL users. 48 | * 49 | * @since EL 3.0 50 | */ 51 | 52 | public class ELClass { 53 | 54 | private Class klass; 55 | 56 | /** 57 | * Constructor 58 | * @param klass The Class instance 59 | */ 60 | public ELClass(Class klass) { 61 | this.klass = klass; 62 | } 63 | 64 | /** 65 | * Returns the Class instance 66 | * @return The Class instance 67 | */ 68 | public Class getKlass() { 69 | return this.klass; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/test/java/org/glassfish/el/test/ConvertTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package org.glassfish.el.test; 7 | 8 | import org.junit.After; 9 | import org.junit.AfterClass; 10 | import org.junit.Before; 11 | import org.junit.BeforeClass; 12 | import org.junit.Test; 13 | import static org.junit.Assert.*; 14 | 15 | import javax.el.*; 16 | 17 | /** 18 | * 19 | * @author kichung 20 | */ 21 | public class ConvertTest { 22 | ELProcessor elp; 23 | 24 | public ConvertTest() { 25 | } 26 | 27 | @BeforeClass 28 | public static void setUpClass() throws Exception { 29 | } 30 | 31 | @AfterClass 32 | public static void tearDownClass() throws Exception { 33 | } 34 | 35 | @Before 36 | public void setUp() { 37 | elp = new ELProcessor(); 38 | } 39 | 40 | @After 41 | public void tearDown() { 42 | } 43 | 44 | static public class MyBean { 45 | String name; 46 | int pint; 47 | Integer integer; 48 | 49 | MyBean() { 50 | 51 | } 52 | MyBean(String name) { 53 | this.name = name; 54 | } 55 | public String getName() { 56 | return this.name; 57 | } 58 | public void setPint(int v) { 59 | this.pint = v; 60 | } 61 | public int getPint() { 62 | return this.pint; 63 | } 64 | 65 | public void setInteger(Integer i){ 66 | this.integer = i; 67 | } 68 | 69 | public Integer getInteger() { 70 | return this.integer; 71 | } 72 | } 73 | @Test 74 | public void testVoid() { 75 | MyBean bean = new MyBean(); 76 | elp.defineBean("bean", bean); 77 | // Assig null to int is 0; 78 | Object obj = elp.eval("bean.pint = null"); 79 | assertEquals(obj, null); 80 | assertEquals(bean.getPint(), 0); 81 | 82 | // Assig null to Integer is null 83 | elp.setValue("bean.integer", null); 84 | assertEquals(bean.getInteger(), null); 85 | } 86 | 87 | @Test 88 | public void testCustom() { 89 | elp.getELManager().addELResolver(new TypeConverter() { 90 | @Override 91 | public Object convertToType(ELContext context, Object obj, Class type) { 92 | if (obj instanceof String && type == MyBean.class) { 93 | context.setPropertyResolved(true); 94 | return new MyBean((String) obj); 95 | } 96 | return null; 97 | } 98 | }); 99 | 100 | Object val = elp.getValue("'John Doe'", MyBean.class); 101 | assertTrue(val instanceof MyBean); 102 | assertEquals(((MyBean)val).getName(), "John Doe"); 103 | } 104 | } -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstAnd.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstAnd extends BooleanNode { 52 | public AstAnd(int id) { 53 | super(id); 54 | } 55 | 56 | public Object getValue(EvaluationContext ctx) 57 | throws ELException { 58 | Object obj = children[0].getValue(ctx); 59 | Boolean b = coerceToBoolean(obj); 60 | if (!b.booleanValue()) { 61 | return b; 62 | } 63 | obj = children[1].getValue(ctx); 64 | b = coerceToBoolean(obj); 65 | return b; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstOr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstOr extends BooleanNode { 52 | public AstOr(int id) { 53 | super(id); 54 | } 55 | 56 | public Object getValue(EvaluationContext ctx) 57 | throws ELException { 58 | Object obj = this.children[0].getValue(ctx); 59 | Boolean b = coerceToBoolean(obj); 60 | if (b.booleanValue()) { 61 | return b; 62 | } 63 | obj = this.children[1].getValue(ctx); 64 | b = coerceToBoolean(obj); 65 | return b; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstNot.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstNot extends SimpleNode { 52 | public AstNot(int id) { 53 | super(id); 54 | } 55 | 56 | public Class getType(EvaluationContext ctx) 57 | throws ELException { 58 | return Boolean.class; 59 | } 60 | 61 | public Object getValue(EvaluationContext ctx) 62 | throws ELException { 63 | Object obj = this.children[0].getValue(ctx); 64 | Boolean b = coerceToBoolean(obj); 65 | return Boolean.valueOf(!b.booleanValue()); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstLessThan.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstLessThan extends BooleanNode { 52 | public AstLessThan(int id) { 53 | super(id); 54 | } 55 | 56 | public Object getValue(EvaluationContext ctx) 57 | throws ELException { 58 | Object obj0 = this.children[0].getValue(ctx); 59 | if (obj0 == null) { 60 | return Boolean.FALSE; 61 | } 62 | Object obj1 = this.children[1].getValue(ctx); 63 | if (obj1 == null) { 64 | return Boolean.FALSE; 65 | } 66 | return (compare(obj0, obj1) < 0) ? Boolean.TRUE : Boolean.FALSE; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstGreaterThan.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstGreaterThan extends BooleanNode { 52 | public AstGreaterThan(int id) { 53 | super(id); 54 | } 55 | 56 | public Object getValue(EvaluationContext ctx) 57 | throws ELException { 58 | Object obj0 = this.children[0].getValue(ctx); 59 | if (obj0 == null) { 60 | return Boolean.FALSE; 61 | } 62 | Object obj1 = this.children[1].getValue(ctx); 63 | if (obj1 == null) { 64 | return Boolean.FALSE; 65 | } 66 | return (compare(obj0, obj1) > 0) ? Boolean.TRUE : Boolean.FALSE; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstLessThanEqual.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstLessThanEqual extends BooleanNode { 52 | public AstLessThanEqual(int id) { 53 | super(id); 54 | } 55 | 56 | public Object getValue(EvaluationContext ctx) 57 | throws ELException { 58 | Object obj0 = this.children[0].getValue(ctx); 59 | Object obj1 = this.children[1].getValue(ctx); 60 | if (obj0 == obj1) { 61 | return Boolean.TRUE; 62 | } 63 | if (obj0 == null || obj1 == null) { 64 | return Boolean.FALSE; 65 | } 66 | return (compare(obj0, obj1) <= 0) ? Boolean.TRUE : Boolean.FALSE; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstGreaterThanEqual.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstGreaterThanEqual extends BooleanNode { 52 | public AstGreaterThanEqual(int id) { 53 | super(id); 54 | } 55 | 56 | public Object getValue(EvaluationContext ctx) 57 | throws ELException { 58 | Object obj0 = this.children[0].getValue(ctx); 59 | Object obj1 = this.children[1].getValue(ctx); 60 | if (obj0 == obj1) { 61 | return Boolean.TRUE; 62 | } 63 | if (obj0 == null || obj1 == null) { 64 | return Boolean.FALSE; 65 | } 66 | return (compare(obj0, obj1) >= 0) ? Boolean.TRUE : Boolean.FALSE; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/test/java/org/glassfish/el/test/DataBase.java: -------------------------------------------------------------------------------- 1 | package org.glassfish.el.test; 2 | 3 | import java.util.List; 4 | import java.util.ArrayList; 5 | 6 | public class DataBase { 7 | 8 | private int curCustomer = 100; 9 | private int curProduct = 200; 10 | private int curOrder = 10; 11 | private boolean inited; 12 | 13 | private List customers; 14 | private List products; 15 | private List orders; 16 | 17 | public List getCustomers() { return this.customers; } 18 | public List getProducts() { return this.products; } 19 | public List getOrders() { return this.orders; } 20 | 21 | public void init() { 22 | if (inited) { 23 | return; 24 | } 25 | 26 | inited = true; 27 | customers = new ArrayList(); 28 | orders = new ArrayList(); 29 | products = new ArrayList(); 30 | initCustomer(); 31 | initProduct(); 32 | initOrder(); 33 | } 34 | 35 | void initCustomer() { 36 | c("John Doe", "123 Willow Road", "Menlo Park", "USA", 37 | "650-734-2187"); 38 | c("Mary Lane", "75 State Street", "Atlanta", "USA", "302-145-8765"); 39 | c("Charlie Yeh", "5 Nathan Road", "Kowlon", "Hong Kong", "11-7565-2323"); 40 | } 41 | 42 | void initProduct() { 43 | p("Eagle", "book", 12.50, 100); // id: 200 44 | p("Coming Home", "dvd", 8.00, 50); // id: 201 45 | p("Greatest Hits", "cd", 6.5, 200); // id: 202 46 | p("History of Golf", "book", 11.0, 30); // id: 203 47 | p("Toy Story", "dvd", 10.00, 1000); // id: 204 48 | p("iSee", "book", 12.50, 150); // 205 49 | } 50 | 51 | void initOrder() { 52 | o(100, new Date(2010, 2, 18), 20.80); 53 | o(100, new Date(2011, 5, 3), 34.50); 54 | o(100, new Date(2011, 8, 2), 210.75); 55 | o(101, new Date(2011, 1, 15), 50.23); 56 | o(101, new Date(2012, 1, 3), 126.77); 57 | o(102, new Date(2011, 4, 15), 101.20); 58 | } 59 | 60 | void c(String name, String address, String city, 61 | String country, String phone) { 62 | customers.add(new Customer(curCustomer++, name, address, 63 | city, country, phone)); 64 | } 65 | 66 | void o(int customerID, Date orderDate, double total) { 67 | Order order = new Order(curOrder++, customerID, orderDate, total); 68 | this.orders.add(order); 69 | findCustomer(customerID).getOrders().add(order); 70 | } 71 | 72 | void p(String name, String category, double unitPrice, int unitsInStock) { 73 | products.add(new Product(curProduct++, name, category, unitPrice, 74 | unitsInStock)); 75 | } 76 | 77 | private Customer findCustomer(int id) { 78 | for(Customer customer: customers) { 79 | if (customer.customerID == id) { 80 | return customer; 81 | } 82 | } 83 | return null; 84 | } 85 | } 86 | 87 | -------------------------------------------------------------------------------- /src/test/java/org/glassfish/el/test/LambdaTest.java: -------------------------------------------------------------------------------- 1 | package org.glassfish.el.test; 2 | 3 | import org.junit.Test; 4 | import org.junit.Before; 5 | import org.junit.BeforeClass; 6 | import static org.junit.Assert.assertEquals; 7 | import static org.junit.Assert.assertTrue; 8 | 9 | import javax.el.ELProcessor; 10 | 11 | public class LambdaTest { 12 | 13 | @BeforeClass 14 | public static void setUpClass() throws Exception { 15 | } 16 | 17 | @Before 18 | public void setUp() { 19 | } 20 | 21 | void testExpr(ELProcessor elp, String testname, String expr, Long expected) { 22 | System.out.println("=== Test Lambda Expression:" + testname + " ==="); 23 | System.out.println(" ** " + expr); 24 | Object result = elp.eval(expr); 25 | System.out.println(" returns " + result); 26 | assertEquals(expected, result); 27 | } 28 | 29 | @Test 30 | public void testImmediate() { 31 | ELProcessor elp = new ELProcessor(); 32 | testExpr(elp, "immediate", "(x->x+1)(10)", 11L); 33 | testExpr(elp, "immediate0", "(()->1001)()", 1001L); 34 | testExpr(elp, "immediate1", "((x,y)->x+y)(null, null)", 0L); 35 | testExpr(elp, "immediate 2", "(((x,y)->x+y)(3,4))", 7L); 36 | testExpr(elp, "immediate 3", "(x->(y=x)+1)(10) + y", 21L); 37 | } 38 | 39 | @Test 40 | public void testAssignInvoke() { 41 | ELProcessor elp = new ELProcessor(); 42 | testExpr(elp, "assign", "func = x->x+1; func(10)", 11L); 43 | testExpr(elp, "assign 2", "func = (x,y)->x+y; func(3,4)", 7L); 44 | } 45 | 46 | @Test 47 | public void testConditional() { 48 | ELProcessor elp = new ELProcessor(); 49 | elp.eval("cond = true"); 50 | testExpr(elp, "conditional", "(x->cond? x+1: x+2)(10)", 11L); 51 | elp.eval("cond = false"); 52 | testExpr(elp, "conditional 2", 53 | "func = cond? (x->x+1): (x->x+2); func(10)", 12L); 54 | } 55 | 56 | @Test 57 | public void testFact() { 58 | ELProcessor elp = new ELProcessor(); 59 | testExpr(elp, "factorial", "fact = n->n==0? 1: n*fact(n-1); fact(5)", 120L); 60 | testExpr(elp, "fibonacci", "f = n->n==0? 0: n==1? 1: f(n-1)+f(n-2); f(10)", 55L); 61 | } 62 | 63 | @Test 64 | public void testVar() { 65 | ELProcessor elp = new ELProcessor(); 66 | elp.setVariable("v", "x->x+1"); 67 | testExpr(elp, "assignment to variable", "v(10)", 11L); 68 | } 69 | 70 | @Test 71 | public void testLambda() { 72 | ELProcessor elp = new ELProcessor(); 73 | testExpr(elp, "Lambda Lambda", "f = ()->y->y+1; f()(100)", 101L); 74 | testExpr(elp, "Lambda Lambda 2", "f = (x)->(tem=x; y->tem+y); f(1)(100)", 101L); 75 | testExpr(elp, "Lambda Lambda 3", "(()->y->y+1)()(100)", 101L); 76 | testExpr(elp, "Lambda Lambda 4", "(x->(y->x+y)(1))(100)", 101L); 77 | testExpr(elp, "Lambda Lambda 5", "(x->(y->x+y))(1)(100)", 101L); 78 | testExpr(elp, "Lambda Lambda 6" 79 | , "(x->y->x(0)+y)(x->x+1)(100)", 101L); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstMethodArguments.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | import com.sun.el.lang.EvaluationContext; 45 | 46 | /** 47 | * @author Kin-man Chung 48 | */ 49 | public 50 | class AstMethodArguments extends SimpleNode { 51 | public AstMethodArguments(int id) { 52 | super(id); 53 | } 54 | 55 | Class[] getParamTypes () { 56 | return null; 57 | } 58 | 59 | public Object[] getParameters(EvaluationContext ctx) throws ELException { 60 | 61 | if (this.children == null) 62 | return new Object[] {}; 63 | 64 | Object[] obj = new Object[this.children.length]; 65 | for (int i = 0; i < obj.length; i++) { 66 | obj[i] = this.children[i].getValue(ctx); 67 | } 68 | return obj; 69 | } 70 | 71 | public int getParameterCount() { 72 | return this.children == null? 0: this.children.length; 73 | } 74 | 75 | @Override 76 | public boolean isParametersProvided() { 77 | return true; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstDynamicExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstDynamicExpression extends SimpleNode { 52 | public AstDynamicExpression(int id) { 53 | super(id); 54 | } 55 | 56 | public Class getType(EvaluationContext ctx) 57 | throws ELException { 58 | return this.children[0].getType(ctx); 59 | } 60 | 61 | public Object getValue(EvaluationContext ctx) 62 | throws ELException { 63 | return this.children[0].getValue(ctx); 64 | } 65 | 66 | public boolean isReadOnly(EvaluationContext ctx) 67 | throws ELException { 68 | return this.children[0].isReadOnly(ctx); 69 | } 70 | 71 | public void setValue(EvaluationContext ctx, Object value) 72 | throws ELException { 73 | this.children[0].setValue(ctx, value); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstDeferredExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstDeferredExpression extends SimpleNode { 52 | public AstDeferredExpression(int id) { 53 | super(id); 54 | } 55 | 56 | public Class getType(EvaluationContext ctx) 57 | throws ELException { 58 | return this.children[0].getType(ctx); 59 | } 60 | 61 | public Object getValue(EvaluationContext ctx) 62 | throws ELException { 63 | return this.children[0].getValue(ctx); 64 | } 65 | 66 | public boolean isReadOnly(EvaluationContext ctx) 67 | throws ELException { 68 | return this.children[0].isReadOnly(ctx); 69 | } 70 | 71 | public void setValue(EvaluationContext ctx, Object value) 72 | throws ELException { 73 | this.children[0].setValue(ctx, value); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstCompositeExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstCompositeExpression extends SimpleNode { 52 | 53 | public AstCompositeExpression(int id) { 54 | super(id); 55 | } 56 | 57 | public Class getType(EvaluationContext ctx) 58 | throws ELException { 59 | return String.class; 60 | } 61 | 62 | public Object getValue(EvaluationContext ctx) 63 | throws ELException { 64 | StringBuffer sb = new StringBuffer(16); 65 | Object obj = null; 66 | if (this.children != null) { 67 | for (int i = 0; i < this.children.length; i++) { 68 | obj = this.children[i].getValue(ctx); 69 | if (obj != null) { 70 | sb.append(obj); 71 | } 72 | } 73 | } 74 | return sb.toString(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstInteger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import java.math.BigInteger; 44 | 45 | import javax.el.ELException; 46 | 47 | import com.sun.el.lang.EvaluationContext; 48 | 49 | /** 50 | * @author Jacob Hookom [jacob@hookom.net] 51 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 52 | */ 53 | public final class AstInteger extends SimpleNode { 54 | public AstInteger(int id) { 55 | super(id); 56 | } 57 | 58 | private Number number; 59 | 60 | protected Number getInteger() { 61 | if (this.number == null) { 62 | try { 63 | this.number = Long.valueOf(this.image); 64 | } catch (ArithmeticException e1) { 65 | this.number = new BigInteger(this.image); 66 | } 67 | } 68 | return number; 69 | } 70 | 71 | public Class getType(EvaluationContext ctx) 72 | throws ELException { 73 | return this.getInteger().getClass(); 74 | } 75 | 76 | public Object getValue(EvaluationContext ctx) 77 | throws ELException { 78 | return this.getInteger(); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /api/src/main/java/javax/el/EvaluationListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package javax.el; 42 | 43 | /** 44 | * The listener interface for receiving notification when an 45 | * EL expression is evaluated. 46 | * 47 | * @since EL 3.0 48 | */ 49 | public abstract class EvaluationListener { 50 | 51 | /** 52 | * Receives notification before an EL expression is evaluated 53 | * @param context The ELContext 54 | * @param expression The EL expression string to be evaluated 55 | */ 56 | public void beforeEvaluation(ELContext context, String expression) { 57 | } 58 | 59 | /** 60 | * Receives notification after an EL expression is evaluated 61 | * @param context The ELContext 62 | * @param expression The EL expression string to be evaluated 63 | */ 64 | public void afterEvaluation(ELContext context, String expression) { 65 | } 66 | 67 | /** 68 | * Receives notification when the (base, property) pair is resolved 69 | * @param context The ELContext 70 | * @param base The base object 71 | * @param property The property object 72 | */ 73 | public void propertyResolved(ELContext context, Object base, Object property) { 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/test/java/org/glassfish/el/test/EvalListenerTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package org.glassfish.el.test; 7 | 8 | import java.util.ArrayList; 9 | import javax.el.ELManager; 10 | import javax.el.ELContext; 11 | import javax.el.ELProcessor; 12 | import javax.el.EvaluationListener; 13 | import org.junit.After; 14 | import org.junit.AfterClass; 15 | import org.junit.Before; 16 | import org.junit.BeforeClass; 17 | import org.junit.Test; 18 | import static org.junit.Assert.*; 19 | 20 | /** 21 | * 22 | * @author kichung 23 | */ 24 | public class EvalListenerTest { 25 | 26 | public EvalListenerTest() { 27 | } 28 | 29 | @BeforeClass 30 | public static void setUpClass() throws Exception { 31 | } 32 | 33 | @AfterClass 34 | public static void tearDownClass() throws Exception { 35 | } 36 | 37 | @Before 38 | public void setUp() { 39 | } 40 | 41 | @After 42 | public void tearDown() { 43 | } 44 | 45 | @Test 46 | public void testEvalListener() { 47 | ELProcessor elp = new ELProcessor(); 48 | ELManager elm = elp.getELManager(); 49 | final ArrayList msgs = new ArrayList(); 50 | elm.addEvaluationListener(new EvaluationListener() { 51 | @Override 52 | public void beforeEvaluation(ELContext ctxt, String expr) { 53 | System.out.println("Before: " + expr); 54 | msgs.add("Before: " + expr); 55 | } 56 | @Override 57 | public void afterEvaluation(ELContext ctxt, String expr) { 58 | System.out.println("After: " + expr); 59 | msgs.add("After: " + expr); 60 | } 61 | }); 62 | elp.eval("100 + 10"); 63 | elp.eval("x = 5; x*101"); 64 | String[] expected = {"Before: ${100 + 10}", 65 | "After: ${100 + 10}", 66 | "Before: ${x = 5; x*101}", 67 | "After: ${x = 5; x*101}" }; 68 | for (int i = 0; i < expected.length; i++) { 69 | assertEquals(expected[i], msgs.get(i)); 70 | } 71 | } 72 | 73 | @Test 74 | public void testResListener() { 75 | ELProcessor elp = new ELProcessor(); 76 | ELManager elm = elp.getELManager(); 77 | final ArrayList msgs = new ArrayList(); 78 | elm.addEvaluationListener(new EvaluationListener() { 79 | @Override 80 | public void propertyResolved(ELContext ctxt, Object b, Object p) { 81 | System.out.println("Resolved: " + b + " " + p); 82 | msgs.add("Resolved: " + b + " " + p); 83 | } 84 | }); 85 | elp.eval("x = 10"); 86 | elp.eval("[1,2,3][2]"); 87 | elp.eval("'abcd'.length()"); 88 | elp.eval("'xyz'.class"); 89 | String[] expected = { 90 | "Resolved: null x", 91 | "Resolved: [1, 2, 3] 2", 92 | "Resolved: abcd length", 93 | "Resolved: xyz class" 94 | }; 95 | for (int i = 0; i < expected.length; i++) { 96 | assertEquals(expected[i], msgs.get(i)); 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstFloatingPoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import java.math.BigDecimal; 44 | 45 | import javax.el.ELException; 46 | 47 | import com.sun.el.lang.EvaluationContext; 48 | 49 | /** 50 | * @author Jacob Hookom [jacob@hookom.net] 51 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 52 | */ 53 | public final class AstFloatingPoint extends SimpleNode { 54 | public AstFloatingPoint(int id) { 55 | super(id); 56 | } 57 | 58 | private Number number; 59 | 60 | public Number getFloatingPoint() { 61 | if (this.number == null) { 62 | try { 63 | this.number = Double.valueOf(this.image); 64 | } catch (ArithmeticException e0) { 65 | this.number = new BigDecimal(this.image); 66 | } 67 | } 68 | return this.number; 69 | } 70 | 71 | public Object getValue(EvaluationContext ctx) 72 | throws ELException { 73 | return this.getFloatingPoint(); 74 | } 75 | 76 | public Class getType(EvaluationContext ctx) 77 | throws ELException { 78 | return this.getFloatingPoint().getClass(); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/stream/Optional.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | * 40 | * @author Kin-man Chung 41 | */ 42 | 43 | package com.sun.el.stream; 44 | 45 | import java.util.Iterator; 46 | import java.util.Comparator; 47 | 48 | import javax.el.ELContext; 49 | import javax.el.LambdaExpression; 50 | 51 | public class Optional { 52 | 53 | private final static Optional EMPTY = new Optional(); 54 | private final Object value; 55 | 56 | Optional(Object value) { 57 | if (value == null) { 58 | throw new NullPointerException(); 59 | } 60 | this.value = value; 61 | } 62 | 63 | Optional() { 64 | this.value = null; 65 | } 66 | 67 | public boolean isPresent() { 68 | return value != null; 69 | } 70 | 71 | public void ifPresent(LambdaExpression lambda) { 72 | if (value != null) { 73 | lambda.invoke(value); 74 | } 75 | } 76 | 77 | public Object get() { 78 | if (value == null) { 79 | throw new java.util.NoSuchElementException("No value present"); 80 | } 81 | return value; 82 | } 83 | 84 | public Object orElse(Object other) { 85 | return value != null? value: other; 86 | } 87 | 88 | public Object orElseGet(LambdaExpression other) { 89 | return value != null? value: other.invoke(); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /api/src/main/java/javax/el/ELContextListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | * 40 | * 41 | * This file incorporates work covered by the following copyright and 42 | * permission notice: 43 | * 44 | * Copyright 2004 The Apache Software Foundation 45 | * 46 | * Licensed under the Apache License, Version 2.0 (the "License"); 47 | * you may not use this file except in compliance with the License. 48 | * You may obtain a copy of the License at 49 | * 50 | * http://www.apache.org/licenses/LICENSE-2.0 51 | * 52 | * Unless required by applicable law or agreed to in writing, software 53 | * distributed under the License is distributed on an "AS IS" BASIS, 54 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 55 | * See the License for the specific language governing permissions and 56 | * limitations under the License. 57 | */ 58 | 59 | package javax.el; 60 | 61 | /** 62 | * The listener interface for receiving notification when an 63 | * {@link ELContext} is created. 64 | * 65 | * @see ELContext 66 | * @see ELContextEvent 67 | * @since JSP 2.1 68 | */ 69 | public interface ELContextListener extends java.util.EventListener { 70 | 71 | /** 72 | * Invoked when a new ELContext has been created. 73 | * 74 | * @param ece the notification event. 75 | */ 76 | public void contextCreated(ELContextEvent ece); 77 | 78 | } 79 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/lang/VariableMapperFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.lang; 42 | 43 | import javax.el.ValueExpression; 44 | import javax.el.VariableMapper; 45 | 46 | /** 47 | * Creates a VariableMapper for the variables used in the expression. 48 | */ 49 | public class VariableMapperFactory extends VariableMapper { 50 | 51 | private final VariableMapper target; 52 | private VariableMapper momento; 53 | 54 | public VariableMapperFactory(VariableMapper target) { 55 | if (target == null) { 56 | throw new NullPointerException("Target VariableMapper cannot be null"); 57 | } 58 | this.target = target; 59 | } 60 | 61 | public VariableMapper create() { 62 | return this.momento; 63 | } 64 | 65 | public ValueExpression resolveVariable(String variable) { 66 | ValueExpression expr = this.target.resolveVariable(variable); 67 | if (expr != null) { 68 | if (this.momento == null) { 69 | this.momento = new VariableMapperImpl(); 70 | } 71 | this.momento.setVariable(variable, expr); 72 | } 73 | return expr; 74 | } 75 | 76 | public ValueExpression setVariable(String variable, ValueExpression expression) { 77 | throw new UnsupportedOperationException("Cannot Set Variables on Factory"); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstMapData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import java.util.HashSet; 44 | import java.util.HashMap; 45 | import javax.el.ELException; 46 | import com.sun.el.lang.EvaluationContext; 47 | 48 | /** 49 | * @author Kin-man Chung 50 | */ 51 | public 52 | class AstMapData extends SimpleNode { 53 | public AstMapData(int id) { 54 | super(id); 55 | } 56 | 57 | public Object getValue(EvaluationContext ctx) { 58 | HashSet set = new HashSet(); 59 | HashMap map = new HashMap(); 60 | 61 | int paramCount = this.jjtGetNumChildren(); 62 | for (int i = 0; i < paramCount; i++) { 63 | Node entry = this.children[i]; 64 | Object v1 = entry.jjtGetChild(0).getValue(ctx); 65 | if (entry.jjtGetNumChildren() > 1) { 66 | // expr: expr 67 | map.put(v1, entry.jjtGetChild(1).getValue(ctx)); 68 | } else { 69 | set.add(v1); 70 | } 71 | } 72 | // It is error to have mixed set/map entries 73 | if (set.size() > 0 && map.size() > 0) { 74 | throw new ELException("Cannot mix set entry with map entry."); 75 | } 76 | if (map.size() > 0) { 77 | return map; 78 | } 79 | return set; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/lang/FunctionMapperFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.lang; 42 | 43 | import java.lang.reflect.Method; 44 | 45 | import javax.el.FunctionMapper; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public class FunctionMapperFactory extends FunctionMapper { 52 | 53 | protected FunctionMapperImpl memento = null; 54 | protected FunctionMapper target; 55 | 56 | public FunctionMapperFactory(FunctionMapper mapper) { 57 | if (mapper == null) { 58 | throw new NullPointerException("FunctionMapper target cannot be null"); 59 | } 60 | this.target = mapper; 61 | } 62 | 63 | 64 | /* (non-Javadoc) 65 | * @see javax.el.FunctionMapper#resolveFunction(java.lang.String, java.lang.String) 66 | */ 67 | public Method resolveFunction(String prefix, String localName) { 68 | if (this.memento == null) { 69 | this.memento = new FunctionMapperImpl(); 70 | } 71 | Method m = this.target.resolveFunction(prefix, localName); 72 | if (m != null) { 73 | this.memento.addFunction(prefix, localName, m); 74 | } 75 | return m; 76 | } 77 | 78 | public FunctionMapper create() { 79 | return this.memento; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/lang/VariableMapperImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.lang; 42 | 43 | import java.io.Externalizable; 44 | import java.io.IOException; 45 | import java.io.ObjectInput; 46 | import java.io.ObjectOutput; 47 | import java.util.HashMap; 48 | import java.util.Map; 49 | 50 | import javax.el.ValueExpression; 51 | import javax.el.VariableMapper; 52 | 53 | public class VariableMapperImpl extends VariableMapper implements Externalizable { 54 | 55 | private static final long serialVersionUID = 1L; 56 | 57 | private Map vars = 58 | new HashMap(); 59 | 60 | public VariableMapperImpl() { 61 | super(); 62 | } 63 | 64 | public ValueExpression resolveVariable(String variable) { 65 | return this.vars.get(variable); 66 | } 67 | 68 | public ValueExpression setVariable(String variable, 69 | ValueExpression expression) { 70 | return this.vars.put(variable, expression); 71 | } 72 | 73 | // Safe cast. 74 | @SuppressWarnings("unchecked") 75 | public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { 76 | this.vars = (Map) in.readObject(); 77 | } 78 | 79 | public void writeExternal(ObjectOutput out) throws IOException { 80 | out.writeObject(this.vars); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstEmpty.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import java.util.Collection; 44 | import java.util.Map; 45 | 46 | import javax.el.ELException; 47 | 48 | import com.sun.el.lang.EvaluationContext; 49 | 50 | /** 51 | * @author Jacob Hookom [jacob@hookom.net] 52 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 53 | */ 54 | public final class AstEmpty extends SimpleNode { 55 | public AstEmpty(int id) { 56 | super(id); 57 | } 58 | 59 | public Class getType(EvaluationContext ctx) 60 | throws ELException { 61 | return Boolean.class; 62 | } 63 | 64 | public Object getValue(EvaluationContext ctx) 65 | throws ELException { 66 | Object obj = this.children[0].getValue(ctx); 67 | if (obj == null) { 68 | return Boolean.TRUE; 69 | } else if (obj instanceof String) { 70 | return Boolean.valueOf(((String) obj).length() == 0); 71 | } else if (obj instanceof Object[]) { 72 | return Boolean.valueOf(((Object[]) obj).length == 0); 73 | } else if (obj instanceof Collection) { 74 | return Boolean.valueOf(((Collection) obj).isEmpty()); 75 | } else if (obj instanceof Map) { 76 | return Boolean.valueOf(((Map) obj).isEmpty()); 77 | } 78 | return Boolean.FALSE; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstLiteralExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstLiteralExpression extends SimpleNode { 52 | public AstLiteralExpression(int id) { 53 | super(id); 54 | } 55 | 56 | public Class getType(EvaluationContext ctx) throws ELException { 57 | return String.class; 58 | } 59 | 60 | public Object getValue(EvaluationContext ctx) throws ELException { 61 | return this.image; 62 | } 63 | 64 | public void setImage(String image) { 65 | if (image.indexOf('\\') == -1) { 66 | this.image = image; 67 | return; 68 | } 69 | int size = image.length(); 70 | StringBuffer buf = new StringBuffer(size); 71 | for (int i = 0; i < size; i++) { 72 | char c = image.charAt(i); 73 | if (c == '\\' && i + 1 < size) { 74 | char c1 = image.charAt(i + 1); 75 | if (c1 == '\\' || c1 == '"' || c1 == '\'' || c1 == '#' 76 | || c1 == '$') { 77 | c = c1; 78 | i++; 79 | } 80 | } 81 | buf.append(c); 82 | } 83 | this.image = buf.toString(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /api/src/main/java/javax/el/PrivateMessages.properties: -------------------------------------------------------------------------------- 1 | # 2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | # 4 | # Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. 5 | # 6 | # The contents of this file are subject to the terms of either the GNU 7 | # General Public License Version 2 only ("GPL") or the Common Development 8 | # and Distribution License("CDDL") (collectively, the "License"). You 9 | # may not use this file except in compliance with the License. You can 10 | # obtain a copy of the License at 11 | # https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | # or packager/legal/LICENSE.txt. See the License for the specific 13 | # language governing permissions and limitations under the License. 14 | # 15 | # When distributing the software, include this License Header Notice in each 16 | # file and include the License file at packager/legal/LICENSE.txt. 17 | # 18 | # GPL Classpath Exception: 19 | # Oracle designates this particular file as subject to the "Classpath" 20 | # exception as provided by Oracle in the GPL Version 2 section of the License 21 | # file that accompanied this code. 22 | # 23 | # Modifications: 24 | # If applicable, add the following below the License Header, with the fields 25 | # enclosed by brackets [] replaced by your own identifying information: 26 | # "Portions Copyright [year] [name of copyright owner]" 27 | # 28 | # Contributor(s): 29 | # If you wish your version of this file to be governed by only the CDDL or 30 | # only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | # elects to include this software in this distribution under the [CDDL or GPL 32 | # Version 2] license." If you don't indicate a single choice of license, a 33 | # recipient has the option to distribute your version of this file under 34 | # either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | # its licensees as provided above. However, if you add GPL Version 2 code 36 | # and therefore, elected the GPL Version 2 license, then the option applies 37 | # only if the new code is made subject to such option by the copyright 38 | # holder. 39 | # 40 | # 41 | # This file incorporates work covered by the following copyright and 42 | # permission notice: 43 | # 44 | # Copyright 2004 The Apache Software Foundation 45 | # 46 | # Licensed under the Apache License, Version 2.0 (the "License"); 47 | # you may not use this file except in compliance with the License. 48 | # You may obtain a copy of the License at 49 | # 50 | # http://www.apache.org/licenses/LICENSE-2.0 51 | # 52 | # Unless required by applicable law or agreed to in writing, software 53 | # distributed under the License is distributed on an "AS IS" BASIS, 54 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 55 | # See the License for the specific language governing permissions and 56 | # limitations under the License. 57 | # 58 | 59 | # This properties file is essentially "package private" but because 60 | # there is no way to attach an access specifier to a properties file we 61 | # are including this comment to serve as such. 62 | setPropertyFailed=Can''t set property ''{0}'' on class ''{1}'' to value ''{2}''. 63 | propertyNotFound=The class ''{0}'' does not have the property ''{1}''. 64 | propertyNotReadable=The class ''{0}'' does not have a readable property ''{1}''. 65 | resolverNotWritable=The ELResolver for the class ''{0}'' is not writable. 66 | propertyNotWritable=The class ''{0}'' does not have a writable property ''{1}''. 67 | staticFieldReadError=Either ''{1}'' is not a public static field of the class ''{0}'' or field is inaccessible 68 | staticFieldWriteError=Cannot write to the field ''{1}}'' of the class ''{0}'' 69 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstString extends SimpleNode { 52 | public AstString(int id) { 53 | super(id); 54 | } 55 | 56 | private String string; 57 | 58 | public String getString() { 59 | if (this.string == null) { 60 | this.string = this.image.substring(1, this.image.length() - 1); 61 | } 62 | return this.string; 63 | } 64 | 65 | public Class getType(EvaluationContext ctx) 66 | throws ELException { 67 | return String.class; 68 | } 69 | 70 | public Object getValue(EvaluationContext ctx) 71 | throws ELException { 72 | return this.getString(); 73 | } 74 | 75 | public void setImage(String image) { 76 | if (image.indexOf('\\') == -1) { 77 | this.image = image; 78 | return; 79 | } 80 | int size = image.length(); 81 | StringBuffer buf = new StringBuffer(size); 82 | for (int i = 0; i < size; i++) { 83 | char c = image.charAt(i); 84 | if (c == '\\' && i + 1 < size) { 85 | char c1 = image.charAt(i + 1); 86 | if (c1 == '\\' || c1 == '"' || c1 == '\'' || c1 == '#' 87 | || c1 == '$') { 88 | c = c1; 89 | i++; 90 | } 91 | } 92 | buf.append(c); 93 | } 94 | this.image = buf.toString(); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /api/src/main/java/javax/el/ELContextEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | * 40 | * 41 | * This file incorporates work covered by the following copyright and 42 | * permission notice: 43 | * 44 | * Copyright 2004 The Apache Software Foundation 45 | * 46 | * Licensed under the Apache License, Version 2.0 (the "License"); 47 | * you may not use this file except in compliance with the License. 48 | * You may obtain a copy of the License at 49 | * 50 | * http://www.apache.org/licenses/LICENSE-2.0 51 | * 52 | * Unless required by applicable law or agreed to in writing, software 53 | * distributed under the License is distributed on an "AS IS" BASIS, 54 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 55 | * See the License for the specific language governing permissions and 56 | * limitations under the License. 57 | */ 58 | 59 | package javax.el; 60 | 61 | /** 62 | * An event which indicates that an {@link ELContext} has been created. 63 | * The source object is the ELContext that was created. 64 | * 65 | * @see ELContext 66 | * @see ELContextListener 67 | * @since JSP 2.1 68 | */ 69 | public class ELContextEvent extends java.util.EventObject { 70 | 71 | /** 72 | * Constructs an ELContextEvent object to indicate that an 73 | * ELContext has been created. 74 | * 75 | * @param source the ELContext that was created. 76 | */ 77 | public ELContextEvent(ELContext source) { 78 | super(source); 79 | } 80 | 81 | /** 82 | * Returns the ELContext that was created. 83 | * This is a type-safe equivalent of the {@link #getSource} method. 84 | * 85 | * @return the ELContext that was created. 86 | */ 87 | public ELContext getELContext() { 88 | return (ELContext) getSource(); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/JJTELParserState.java: -------------------------------------------------------------------------------- 1 | /* Generated By:JavaCC: Do not edit this line. JJTELParserState.java Version 5.0 */ 2 | package com.sun.el.parser; 3 | 4 | public class JJTELParserState { 5 | private java.util.List nodes; 6 | private java.util.List marks; 7 | 8 | private int sp; // number of nodes on stack 9 | private int mk; // current mark 10 | private boolean node_created; 11 | 12 | public JJTELParserState() { 13 | nodes = new java.util.ArrayList(); 14 | marks = new java.util.ArrayList(); 15 | sp = 0; 16 | mk = 0; 17 | } 18 | 19 | /* Determines whether the current node was actually closed and 20 | pushed. This should only be called in the final user action of a 21 | node scope. */ 22 | public boolean nodeCreated() { 23 | return node_created; 24 | } 25 | 26 | /* Call this to reinitialize the node stack. It is called 27 | automatically by the parser's ReInit() method. */ 28 | public void reset() { 29 | nodes.clear(); 30 | marks.clear(); 31 | sp = 0; 32 | mk = 0; 33 | } 34 | 35 | /* Returns the root node of the AST. It only makes sense to call 36 | this after a successful parse. */ 37 | public Node rootNode() { 38 | return nodes.get(0); 39 | } 40 | 41 | /* Pushes a node on to the stack. */ 42 | public void pushNode(Node n) { 43 | nodes.add(n); 44 | ++sp; 45 | } 46 | 47 | /* Returns the node on the top of the stack, and remove it from the 48 | stack. */ 49 | public Node popNode() { 50 | if (--sp < mk) { 51 | mk = marks.remove(marks.size()-1); 52 | } 53 | return nodes.remove(nodes.size()-1); 54 | } 55 | 56 | /* Returns the node currently on the top of the stack. */ 57 | public Node peekNode() { 58 | return nodes.get(nodes.size()-1); 59 | } 60 | 61 | /* Returns the number of children on the stack in the current node 62 | scope. */ 63 | public int nodeArity() { 64 | return sp - mk; 65 | } 66 | 67 | 68 | public void clearNodeScope(Node n) { 69 | while (sp > mk) { 70 | popNode(); 71 | } 72 | mk = marks.remove(marks.size()-1); 73 | } 74 | 75 | 76 | public void openNodeScope(Node n) { 77 | marks.add(mk); 78 | mk = sp; 79 | n.jjtOpen(); 80 | } 81 | 82 | 83 | /* A definite node is constructed from a specified number of 84 | children. That number of nodes are popped from the stack and 85 | made the children of the definite node. Then the definite node 86 | is pushed on to the stack. */ 87 | public void closeNodeScope(Node n, int num) { 88 | mk = marks.remove(marks.size()-1); 89 | while (num-- > 0) { 90 | Node c = popNode(); 91 | c.jjtSetParent(n); 92 | n.jjtAddChild(c, num); 93 | } 94 | n.jjtClose(); 95 | pushNode(n); 96 | node_created = true; 97 | } 98 | 99 | 100 | /* A conditional node is constructed if its condition is true. All 101 | the nodes that have been pushed since the node was opened are 102 | made children of the conditional node, which is then pushed 103 | on to the stack. If the condition is false the node is not 104 | constructed and they are left on the stack. */ 105 | public void closeNodeScope(Node n, boolean condition) { 106 | if (condition) { 107 | int a = nodeArity(); 108 | mk = marks.remove(marks.size()-1); 109 | while (a-- > 0) { 110 | Node c = popNode(); 111 | c.jjtSetParent(n); 112 | n.jjtAddChild(c, a); 113 | } 114 | n.jjtClose(); 115 | pushNode(n); 116 | node_created = true; 117 | } else { 118 | mk = marks.remove(marks.size()-1); 119 | node_created = false; 120 | } 121 | } 122 | } 123 | /* JavaCC - OriginalChecksum=a169ec9bf66edaa6db0c5550b112beee (do not edit this line) */ 124 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/util/MessageFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.util; 42 | 43 | import java.text.MessageFormat; 44 | import java.util.ResourceBundle; 45 | 46 | /** 47 | * @author Jacob Hookom [jacob@hookom.net] 48 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 49 | */ 50 | public final class MessageFactory { 51 | 52 | protected final static ResourceBundle bundle = ResourceBundle 53 | .getBundle("com.sun.el.Messages"); 54 | /** 55 | * 56 | */ 57 | public MessageFactory() { 58 | super(); 59 | } 60 | 61 | public static String get(final String key) { 62 | return bundle.getString(key); 63 | } 64 | 65 | public static String get(final String key, final Object obj0) { 66 | return getArray(key, new Object[] { obj0 }); 67 | } 68 | 69 | public static String get(final String key, final Object obj0, 70 | final Object obj1) { 71 | return getArray(key, new Object[] { obj0, obj1 }); 72 | } 73 | 74 | public static String get(final String key, final Object obj0, 75 | final Object obj1, final Object obj2) { 76 | return getArray(key, new Object[] { obj0, obj1, obj2 }); 77 | } 78 | 79 | public static String get(final String key, final Object obj0, 80 | final Object obj1, final Object obj2, final Object obj3) { 81 | return getArray(key, new Object[] { obj0, obj1, obj2, obj3 }); 82 | } 83 | 84 | public static String get(final String key, final Object obj0, 85 | final Object obj1, final Object obj2, final Object obj3, 86 | final Object obj4) { 87 | return getArray(key, new Object[] { obj0, obj1, obj2, obj3, obj4 }); 88 | } 89 | 90 | public static String getArray(final String key, final Object[] objA) { 91 | return MessageFormat.format(bundle.getString(key), objA); 92 | } 93 | 94 | } 95 | -------------------------------------------------------------------------------- /src/test/java/org/glassfish/el/test/ElasticityTest.java.sav: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | 6 | package org.glassfish.el.test; 7 | 8 | import java.util.*; 9 | import javax.el.*; 10 | import org.junit.After; 11 | import org.junit.AfterClass; 12 | import org.junit.Before; 13 | import org.junit.BeforeClass; 14 | import org.junit.Test; 15 | import static org.junit.Assert.*; 16 | 17 | /** 18 | * 19 | * @author kichung 20 | */ 21 | public class ElasticityTest { 22 | 23 | ELProcessor elp; 24 | 25 | public ElasticityTest() { 26 | } 27 | 28 | @BeforeClass 29 | public static void setUpClass() throws Exception { 30 | } 31 | 32 | @AfterClass 33 | public static void tearDownClass() throws Exception { 34 | } 35 | 36 | @Before 37 | public void setUp() { 38 | elp = new ELProcessor(); 39 | } 40 | 41 | @After 42 | public void tearDown() { 43 | } 44 | 45 | static public class Data { 46 | int s; 47 | int d; 48 | 49 | public Data(int s, int d) { 50 | this.s = s; 51 | this.d = d; 52 | } 53 | 54 | public int getS() { 55 | return this.s; 56 | } 57 | 58 | public int getD() { 59 | return this.d; 60 | } 61 | } 62 | 63 | static public class Metric { 64 | int limit; 65 | List list = new ArrayList(); 66 | 67 | public Metric(int limit) { 68 | this.limit = limit; 69 | } 70 | 71 | public int getLimit() { 72 | return limit; 73 | } 74 | 75 | public List getList() { 76 | return list; 77 | } 78 | } 79 | Map clusters = new HashMap(); 80 | 81 | private void init() { 82 | Metric m1 = new Metric(10); 83 | m1.getList().add(new Data(1, 80)); 84 | m1.getList().add(new Data(3, 90)); 85 | m1.getList().add(new Data(4, 100)); 86 | m1.getList().add(new Data(5, 50)); 87 | m1.getList().add(new Data(6, 60)); 88 | 89 | Metric m2 = new Metric(10); 90 | m2.getList().add(new Data(1, 80)); 91 | m2.getList().add(new Data(3, 82)); 92 | m2.getList().add(new Data(7, 90)); 93 | m2.getList().add(new Data(9, 140)); 94 | m2.getList().add(new Data(15, 80)); 95 | 96 | Metric m3 = new Metric(10); 97 | m3.getList().add(new Data(4, 100)); 98 | m3.getList().add(new Data(5, 81)); 99 | m3.getList().add(new Data(6, 200)); 100 | m3.getList().add(new Data(20, 80)); 101 | 102 | clusters.put("c1", m1); 103 | clusters.put("c2", m2); 104 | clusters.put("c3", m3); 105 | 106 | elp.defineBean("c", clusters); 107 | } 108 | @Test 109 | public void testElaticity() { 110 | init(); 111 | Object obj; 112 | 113 | obj = elp.eval( 114 | "c.values().select(" + 115 | "v->v.list.where(d->d.s>1 && d.s<10)." + 116 | "average(d->d.d)).toList()"); 117 | 118 | System.out.println(obj); 119 | obj = elp.eval( 120 | "c.values().select(v->v.list." + 121 | "where(d->d.s>1 && d.s<10)." + 122 | "average(d->d.d) > 100).toList()"); 123 | System.out.println(obj); 124 | obj = elp.eval( 125 | "c.values().select(v->v.list." + 126 | "where(d->d.s>1 && d.s<10)." + 127 | "average(d->d.d) > 100).any()"); 128 | System.out.println(obj); 129 | obj = elp.eval( 130 | "c.entrySet().select(s->[s.key, s.value.list." + 131 | "where(d->d.s>1 && d.s<10)." + 132 | "average(d->d.d)]).toList()"); 133 | System.out.println(obj); 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstLambdaExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import java.util.List; 44 | import javax.el.ELException; 45 | import javax.el.ValueExpression; 46 | import javax.el.LambdaExpression; 47 | import com.sun.el.lang.EvaluationContext; 48 | import com.sun.el.ValueExpressionImpl; 49 | import com.sun.el.util.MessageFactory; 50 | 51 | /** 52 | * @author Kin-man Chung 53 | */ 54 | public 55 | class AstLambdaExpression extends SimpleNode { 56 | 57 | public AstLambdaExpression(int id) { 58 | super(id); 59 | } 60 | 61 | public Object getValue(EvaluationContext ctx) throws ELException { 62 | // Create a lambda expression 63 | ValueExpression expr = 64 | new ValueExpressionImpl("#{Lambda Expression}", 65 | this.children[1], 66 | ctx.getFunctionMapper(), 67 | ctx.getVariableMapper(), 68 | null); 69 | Listparameters = 70 | ((AstLambdaParameters) this.children[0]).getParameters(); 71 | LambdaExpression lambda = new LambdaExpression(parameters, expr); 72 | if (this.children.length <= 2) { 73 | return lambda; 74 | } 75 | 76 | // There are arguments following the lambda exprn, invoke it now. 77 | Object ret = null; 78 | for (int i = 2; i < this.children.length; i++) { 79 | if (ret != null) { 80 | if (!(ret instanceof LambdaExpression)) { 81 | throw new ELException(MessageFactory.get( 82 | "error.lambda.call")); 83 | } 84 | lambda = (LambdaExpression) ret; 85 | } 86 | AstMethodArguments args = (AstMethodArguments) this.children[i]; 87 | ret = lambda.invoke(ctx, args.getParameters(ctx)); 88 | } 89 | return ret; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/AstChoice.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | 45 | import com.sun.el.lang.EvaluationContext; 46 | 47 | /** 48 | * @author Jacob Hookom [jacob@hookom.net] 49 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 50 | */ 51 | public final class AstChoice extends SimpleNode { 52 | public AstChoice(int id) { 53 | super(id); 54 | } 55 | 56 | public Class getType(EvaluationContext ctx) 57 | throws ELException { 58 | Object val = this.getValue(ctx); 59 | return (val != null) ? val.getClass() : null; 60 | } 61 | 62 | public Object getValue(EvaluationContext ctx) 63 | throws ELException { 64 | Object obj0 = this.children[0].getValue(ctx); 65 | Boolean b0 = coerceToBoolean(obj0); 66 | return this.children[((b0.booleanValue() ? 1 : 2))].getValue(ctx); 67 | } 68 | 69 | public boolean isReadOnly(EvaluationContext ctx) 70 | throws ELException { 71 | Object obj0 = this.children[0].getValue(ctx); 72 | Boolean b0 = coerceToBoolean(obj0); 73 | return this.children[((b0.booleanValue() ? 1 : 2))].isReadOnly(ctx); 74 | } 75 | 76 | public void setValue(EvaluationContext ctx, Object value) 77 | throws ELException { 78 | Object obj0 = this.children[0].getValue(ctx); 79 | Boolean b0 = coerceToBoolean(obj0); 80 | this.children[((b0.booleanValue()? 1: 2))].setValue(ctx, value); 81 | } 82 | 83 | public Object invoke(EvaluationContext ctx, 84 | Class[] paramTypes, 85 | Object[] paramValues) 86 | throws ELException { 87 | Object obj0 = this.children[0].getValue(ctx); 88 | Boolean b0 = coerceToBoolean(obj0); 89 | return this.children[((b0.booleanValue() ? 1 : 2))] 90 | .invoke(ctx, paramTypes, paramValues); 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /api/src/main/java/javax/el/VariableMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | * 40 | * 41 | * This file incorporates work covered by the following copyright and 42 | * permission notice: 43 | * 44 | * Copyright 2004 The Apache Software Foundation 45 | * 46 | * Licensed under the Apache License, Version 2.0 (the "License"); 47 | * you may not use this file except in compliance with the License. 48 | * You may obtain a copy of the License at 49 | * 50 | * http://www.apache.org/licenses/LICENSE-2.0 51 | * 52 | * Unless required by applicable law or agreed to in writing, software 53 | * distributed under the License is distributed on an "AS IS" BASIS, 54 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 55 | * See the License for the specific language governing permissions and 56 | * limitations under the License. 57 | */ 58 | 59 | package javax.el; 60 | 61 | /** 62 | * The interface to a map between EL variables and the EL expressions 63 | * they are associated with. 64 | * 65 | * @since JSP 2.1 66 | */ 67 | 68 | public abstract class VariableMapper { 69 | 70 | /** 71 | * @param variable The variable name 72 | * @return the ValueExpression assigned to the variable, 73 | * null if there is no previous assignment to this variable. 74 | */ 75 | public abstract ValueExpression resolveVariable( 76 | String variable); 77 | 78 | /** 79 | * Assign a ValueExpression to an EL variable, replacing 80 | * any previously assignment to the same variable. 81 | * The assignment for the variable is removed if 82 | * the expression is null. 83 | * 84 | * @param variable The variable name 85 | * @param expression The ValueExpression to be assigned 86 | * to the variable. 87 | * @return The previous ValueExpression assigned to this variable, 88 | * null if there is no previous assignment to this variable. 89 | */ 90 | public abstract ValueExpression setVariable( 91 | String variable, 92 | ValueExpression expression); 93 | } 94 | -------------------------------------------------------------------------------- /src/test/java/org/glassfish/el/test/OperatorTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this template, choose Tools | Templates 3 | * and open the template in the editor. 4 | */ 5 | package org.glassfish.el.test; 6 | 7 | import org.junit.AfterClass; 8 | import org.junit.Before; 9 | import org.junit.BeforeClass; 10 | import org.junit.Test; 11 | import static org.junit.Assert.*; 12 | import javax.el.ELProcessor; 13 | import javax.el.ELManager; 14 | import javax.el.ExpressionFactory; 15 | import javax.el.ValueExpression; 16 | import javax.el.MethodExpression; 17 | 18 | /** 19 | * 20 | * @author Kin-man 21 | */ 22 | public class OperatorTest { 23 | 24 | static ELProcessor elp; 25 | 26 | public OperatorTest() { 27 | } 28 | 29 | @BeforeClass 30 | public static void setUpClass() throws Exception { 31 | elp = new ELProcessor(); 32 | } 33 | 34 | @AfterClass 35 | public static void tearDownClass() throws Exception { 36 | } 37 | 38 | @Before 39 | public void setUp() { 40 | } 41 | 42 | void testExpr(String testname, String expr, Long expected) { 43 | System.out.println("=== Test " + testname + " ==="); 44 | System.out.println(" ** " + expr); 45 | Object result = elp.eval(expr); 46 | System.out.println(" returns " + result); 47 | assertEquals(expected, result); 48 | } 49 | 50 | void testExpr(String testname, String expr, String expected) { 51 | System.out.println("=== Test " + testname + " ==="); 52 | System.out.println(" ** " + expr); 53 | Object result = elp.eval(expr); 54 | System.out.println(" returns " + result); 55 | assertEquals(expected, result); 56 | } 57 | 58 | @Test 59 | public void testConcat() { 60 | testExpr("concat", "a = null; b = null; a + b", 0L); 61 | testExpr("add", "10 + 11", 21L); 62 | testExpr("concat", "'10' + 11", 21L); 63 | testExpr("concat 2", "11 + '10'", 21L); 64 | testExpr("concat 3", "100 += 10 ", "10010"); 65 | testExpr("concat 4", "'100' += 10", "10010"); 66 | testExpr("concat 5", "'100' + 10 + 1", 111L); 67 | testExpr("concat 6", "'100' += 10 + 1", "10011"); 68 | } 69 | 70 | @Test 71 | public void testAssign() { 72 | elp.eval("vv = 10"); 73 | testExpr("assign", "vv+1", 11L); 74 | elp.eval("vv = 100"); 75 | testExpr("assign 2", "vv", 100L); 76 | testExpr("assign 3", "x = vv = vv+1; x + vv", 202L); 77 | elp.eval("map = {'one':100, 'two':200}"); 78 | testExpr("assign 4", "map.two = 201; map.two", 201L); 79 | testExpr("assign string", "x='string'; x += 1", "string1"); 80 | } 81 | 82 | @Test 83 | public void testSemi() { 84 | testExpr("semi", "10; 20", 20L); 85 | testExpr("semi0", "10; 20; 30", 30L); 86 | elp.eval("x = 10; 20"); 87 | testExpr("semi 2", "x", 10L); 88 | testExpr("semi 3", "(x = 10; 20) + (x ; x+1)", 31L); 89 | testExpr("semi 4", "(x = 10; y) = 11; x + y", 21L); 90 | } 91 | @Test 92 | public void testMisc() { 93 | testExpr("quote", "\"'\"", "'"); 94 | testExpr("quote", "'\"'", "\""); 95 | ELManager elm = elp.getELManager(); 96 | ValueExpression v = elm.getExpressionFactory().createValueExpression( 97 | elm.getELContext(), "#${1+1}", Object.class); 98 | Object ret = v.getValue(elm.getELContext()); 99 | assertEquals(ret, "#2"); 100 | 101 | elp.setVariable("debug", "true"); 102 | ret = elp.eval("debug == true"); 103 | // elp.eval("[1,2][true]"); // throws IllegalArgumentExpression 104 | /* 105 | elp.defineBean("date", new Date(2013, 1,2)); 106 | elp.eval("date.getYear()"); 107 | 108 | elp.defineBean("href", null); 109 | testExpr("space", "(empty href)?'#':href", "#"); 110 | MethodExpression m = elm.getExpressionFactory().createMethodExpression( 111 | elm.getELContext(), "${name}", Object.class, new Class[] {}); 112 | m.invoke(elm.getELContext(), null); 113 | */ 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /impl/src/main/java/com/sun/el/parser/Node.java: -------------------------------------------------------------------------------- 1 | /* 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 | * 4 | * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * The contents of this file are subject to the terms of either the GNU 7 | * General Public License Version 2 only ("GPL") or the Common Development 8 | * and Distribution License("CDDL") (collectively, the "License"). You 9 | * may not use this file except in compliance with the License. You can 10 | * obtain a copy of the License at 11 | * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html 12 | * or packager/legal/LICENSE.txt. See the License for the specific 13 | * language governing permissions and limitations under the License. 14 | * 15 | * When distributing the software, include this License Header Notice in each 16 | * file and include the License file at packager/legal/LICENSE.txt. 17 | * 18 | * GPL Classpath Exception: 19 | * Oracle designates this particular file as subject to the "Classpath" 20 | * exception as provided by Oracle in the GPL Version 2 section of the License 21 | * file that accompanied this code. 22 | * 23 | * Modifications: 24 | * If applicable, add the following below the License Header, with the fields 25 | * enclosed by brackets [] replaced by your own identifying information: 26 | * "Portions Copyright [year] [name of copyright owner]" 27 | * 28 | * Contributor(s): 29 | * If you wish your version of this file to be governed by only the CDDL or 30 | * only the GPL Version 2, indicate your decision by adding "[Contributor] 31 | * elects to include this software in this distribution under the [CDDL or GPL 32 | * Version 2] license." If you don't indicate a single choice of license, a 33 | * recipient has the option to distribute your version of this file under 34 | * either the CDDL, the GPL Version 2 or to extend the choice of license to 35 | * its licensees as provided above. However, if you add GPL Version 2 code 36 | * and therefore, elected the GPL Version 2 license, then the option applies 37 | * only if the new code is made subject to such option by the copyright 38 | * holder. 39 | */ 40 | 41 | package com.sun.el.parser; 42 | 43 | import javax.el.ELException; 44 | import javax.el.MethodInfo; 45 | import javax.el.ValueReference; 46 | 47 | import com.sun.el.lang.EvaluationContext; 48 | 49 | /* All AST nodes must implement this interface. It provides basic 50 | machinery for constructing the parent and child relationships 51 | between nodes. */ 52 | 53 | /** 54 | * @author Jacob Hookom [jacob@hookom.net] 55 | * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: kchung $ 56 | */ 57 | public interface Node { 58 | 59 | /** This method is called after the node has been made the current 60 | node. It indicates that child nodes can now be added to it. */ 61 | public void jjtOpen(); 62 | 63 | /** This method is called after all the child nodes have been 64 | added. */ 65 | public void jjtClose(); 66 | 67 | /** This pair of methods are used to inform the node of its 68 | parent. */ 69 | public void jjtSetParent(Node n); 70 | public Node jjtGetParent(); 71 | 72 | /** This method tells the node to add its argument to the node's 73 | list of children. */ 74 | public void jjtAddChild(Node n, int i); 75 | 76 | /** This method returns a child node. The children are numbered 77 | from zero, left to right. */ 78 | public Node jjtGetChild(int i); 79 | 80 | /** Return the number of children the node has. */ 81 | public int jjtGetNumChildren(); 82 | 83 | public String getImage(); 84 | 85 | public Object getValue(EvaluationContext ctx) throws ELException; 86 | public void setValue(EvaluationContext ctx, Object value) throws ELException; 87 | public Class getType(EvaluationContext ctx) throws ELException; 88 | public ValueReference getValueReference(EvaluationContext ctx) 89 | throws ELException; 90 | public boolean isReadOnly(EvaluationContext ctx) throws ELException; 91 | public void accept(NodeVisitor visitor) throws ELException; 92 | public MethodInfo getMethodInfo(EvaluationContext ctx, Class[] paramTypes) throws ELException; 93 | public Object invoke(EvaluationContext ctx, Class[] paramTypes, Object[] paramValues) throws ELException; 94 | 95 | public boolean equals(Object n); 96 | public int hashCode(); 97 | public boolean isParametersProvided(); 98 | } 99 | --------------------------------------------------------------------------------