Coverage Report - org.apache.myfaces.el.unified.resolver.implicitobject.ImplicitObject
 
Classes in this File Line Coverage Branch Coverage Complexity
ImplicitObject
0%
0/13
N/A
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *   http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.myfaces.el.unified.resolver.implicitobject;
 20  
 
 21  
 import java.beans.FeatureDescriptor;
 22  
 import javax.el.ELContext;
 23  
 import javax.el.ELResolver;
 24  
 import javax.faces.context.ExternalContext;
 25  
 import javax.faces.context.FacesContext;
 26  
 
 27  
 /**
 28  
  * Implementors of this class encapsulate the information needed to resolve the implicit object.
 29  
  * 
 30  
  * @author Stan Silvert
 31  
  */
 32  0
 public abstract class ImplicitObject
 33  
 {
 34  
 
 35  
     public abstract Object getValue(ELContext context);
 36  
 
 37  
     public abstract FeatureDescriptor getDescriptor();
 38  
 
 39  
     /**
 40  
      * Returns an interned String representing the name of the implicit object.
 41  
      */
 42  
     public abstract String getName();
 43  
 
 44  
     /**
 45  
      * Returns the most general type allowed for a future call to setValue()
 46  
      */
 47  
     public abstract Class<?> getType();
 48  
 
 49  
     protected FeatureDescriptor makeDescriptor(String name, String description, Class<?> elResolverType)
 50  
     {
 51  0
         FeatureDescriptor fd = new FeatureDescriptor();
 52  0
         fd.setValue(ELResolver.RESOLVABLE_AT_DESIGN_TIME, Boolean.TRUE);
 53  0
         fd.setValue(ELResolver.TYPE, elResolverType);
 54  0
         fd.setName(name);
 55  0
         fd.setDisplayName(name);
 56  0
         fd.setShortDescription(description);
 57  0
         fd.setExpert(false);
 58  0
         fd.setHidden(false);
 59  0
         fd.setPreferred(true);
 60  0
         return fd;
 61  
     }
 62  
 
 63  
     // get the FacesContext from the ELContext
 64  
     protected FacesContext facesContext(ELContext context)
 65  
     {
 66  0
         return (FacesContext) context.getContext(FacesContext.class);
 67  
     }
 68  
 
 69  
     protected ExternalContext externalContext(ELContext context)
 70  
     {
 71  0
         return facesContext(context).getExternalContext();
 72  
     }
 73  
 
 74  
 }