001 package org.apache.commons.ognl; 002 003 /* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022 import org.apache.commons.ognl.enhance.UnsupportedCompilationException; 023 024 /** 025 * $Id: ASTThisVarRef.java 1184964 2011-10-17 00:26:34Z mcucchiara $ 026 * @author Luke Blanshard (blanshlu@netscape.net) 027 * @author Drew Davidson (drew@ognl.org) 028 */ 029 public class ASTThisVarRef 030 extends ASTVarRef 031 { 032 033 public ASTThisVarRef( int id ) 034 { 035 super( id ); 036 } 037 038 public ASTThisVarRef( OgnlParser p, int id ) 039 { 040 super( p, id ); 041 } 042 043 protected Object getValueBody( OgnlContext context, Object source ) 044 throws OgnlException 045 { 046 return context.getCurrentObject(); 047 } 048 049 protected void setValueBody( OgnlContext context, Object target, Object value ) 050 throws OgnlException 051 { 052 context.setCurrentObject( value ); 053 } 054 055 public String toGetSourceString( OgnlContext context, Object target ) 056 { 057 throw new UnsupportedCompilationException( "Unable to compile this references." ); 058 } 059 060 public String toSetSourceString( OgnlContext context, Object target ) 061 { 062 throw new UnsupportedCompilationException( "Unable to compile this references." ); 063 } 064 065 public <R, P> R accept( NodeVisitor<? extends R, ? super P> visitor, P data ) 066 throws OgnlException 067 { 068 return visitor.visit( this, data ); 069 } 070 }