KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > el > AbstractVariableResolver


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  * Free SoftwareFoundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Scott Ferguson
27  */

28
29 package com.caucho.el;
30
31 import javax.el.ELContext;
32 import javax.el.ELException;
33 import javax.el.ELResolver;
34 import javax.el.PropertyNotFoundException;
35 import javax.el.PropertyNotWritableException;
36 import java.beans.FeatureDescriptor JavaDoc;
37 import java.util.Iterator JavaDoc;
38 import java.util.logging.Logger JavaDoc;
39
40 /**
41  * Abstract variable resolver. Supports chaining and the "Var"
42  * special variable.
43  */

44 public class AbstractVariableResolver extends ELResolver
45 {
46   private static final Logger JavaDoc log
47     = Logger.getLogger(AbstractVariableResolver.class.getName());
48   
49   private ELResolver _next;
50   
51   /**
52    * Creates the resolver
53    */

54   public AbstractVariableResolver()
55   {
56   }
57   
58   /**
59    * Creates the resolver
60    */

61   public AbstractVariableResolver(ELResolver next)
62   {
63     _next = next;
64   }
65
66   /**
67    * Returns the next resolver.
68    */

69   public ELResolver getNext()
70   {
71     return _next;
72   }
73   
74   /**
75    * Returns the named variable value.
76    */

77   @Override JavaDoc
78   public Object JavaDoc getValue(ELContext context,
79              Object JavaDoc base,
80              Object JavaDoc property)
81   {
82     return null;
83   }
84
85   //
86
// ELResolver stubs
87
//
88

89   @Override JavaDoc
90   public Class JavaDoc<?> getCommonPropertyType(ELContext context,
91                     Object JavaDoc base)
92   {
93     return null;
94   }
95
96   public Iterator JavaDoc<FeatureDescriptor JavaDoc>
97     getFeatureDescriptors(ELContext context, Object JavaDoc base)
98   {
99     return null;
100   }
101
102   public Class JavaDoc<?> getType(ELContext context,
103               Object JavaDoc base,
104               Object JavaDoc property)
105   {
106     Object JavaDoc value = getValue(context, base, property);
107
108     if (value == null)
109       return null;
110     else
111       return value.getClass();
112   }
113
114   public boolean isReadOnly(ELContext context,
115                 Object JavaDoc base,
116                 Object JavaDoc property)
117     throws PropertyNotFoundException,
118        ELException
119   {
120     return true;
121   }
122
123   public void setValue(ELContext context,
124                Object JavaDoc base,
125                Object JavaDoc property,
126                Object JavaDoc value)
127     throws PropertyNotFoundException,
128        PropertyNotWritableException,
129        ELException
130   {
131   }
132
133   public String JavaDoc toString()
134   {
135     return "AbstractVariableResolver[]";
136   }
137 }
138
Popular Tags