Coverage Report - org.apache.myfaces.config.impl.digester.elements.ManagedProperty
 
Classes in this File Line Coverage Branch Coverage Complexity
ManagedProperty
0%
0/32
0%
0/8
1.286
ManagedProperty$1
N/A
N/A
1.286
ManagedProperty$DummyValueBinding
0%
0/6
N/A
1.286
 
 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.config.impl.digester.elements;
 20  
 
 21  
 import javax.faces.context.FacesContext;
 22  
 import javax.faces.el.ValueBinding;
 23  
 
 24  
 import org.apache.myfaces.config.impl.digester.elements.ListEntries;
 25  
 import org.apache.myfaces.util.ContainerUtils;
 26  
 
 27  
 
 28  
 /**
 29  
  * @author <a href="mailto:oliver@rossmueller.com">Oliver Rossmueller</a> (latest modification by $Author: skitching $)
 30  
  * @author Anton Koinov
 31  
  *
 32  
  * @version $Revision: 684459 $ $Date: 2008-08-10 06:13:56 -0500 (Sun, 10 Aug 2008) $
 33  
  */
 34  0
 public class ManagedProperty implements org.apache.myfaces.config.element.ManagedProperty
 35  
 {
 36  0
     private static final ValueBinding DUMMY_VB = new DummyValueBinding();
 37  
 
 38  0
     private int                       _type    = TYPE_UNKNOWN;
 39  
     private String                    _propertyName;
 40  
     private String                    _propertyClass;
 41  
     private ValueBinding              _valueBinding;
 42  
     private String                    _value;
 43  
     private MapEntries                _mapEntries;
 44  
     private ListEntries               _listEntries;
 45  
 
 46  
     public int getType()
 47  
     {
 48  0
         return _type;
 49  
     }
 50  
 
 51  
 
 52  
     public org.apache.myfaces.config.element.MapEntries getMapEntries()
 53  
     {
 54  0
         return _mapEntries;
 55  
     }
 56  
 
 57  
 
 58  
     public void setMapEntries(MapEntries mapEntries)
 59  
     {
 60  0
         _mapEntries = mapEntries;
 61  0
         _type = TYPE_MAP;
 62  0
     }
 63  
 
 64  
 
 65  
     public org.apache.myfaces.config.element.ListEntries getListEntries()
 66  
     {
 67  0
         return _listEntries;
 68  
     }
 69  
 
 70  
 
 71  
     public void setListEntries(ListEntries listEntries)
 72  
     {
 73  0
         _listEntries = listEntries;
 74  0
         _type = TYPE_LIST;
 75  0
     }
 76  
 
 77  
 
 78  
     public String getPropertyName()
 79  
     {
 80  0
         return _propertyName;
 81  
     }
 82  
 
 83  
 
 84  
     public void setPropertyName(String propertyName)
 85  
     {
 86  0
         _propertyName = propertyName;
 87  0
     }
 88  
 
 89  
 
 90  
     public String getPropertyClass()
 91  
     {
 92  0
         return _propertyClass;
 93  
     }
 94  
 
 95  
 
 96  
     public void setPropertyClass(String propertyClass)
 97  
     {
 98  0
         _propertyClass = propertyClass;
 99  0
     }
 100  
 
 101  
 
 102  
     public boolean isNullValue()
 103  
     {
 104  0
         return _type == TYPE_NULL;
 105  
     }
 106  
 
 107  
 
 108  
     public void setNullValue()
 109  
     {
 110  0
         _type = TYPE_NULL;
 111  0
     }
 112  
 
 113  
 
 114  
     public void setValue(String value)
 115  
     {
 116  0
         _value = value;
 117  0
         _type = TYPE_VALUE;
 118  0
     }
 119  
 
 120  
     public String getValue()
 121  
     {
 122  0
         return _value;
 123  
     }
 124  
 
 125  
 
 126  
     public Object getRuntimeValue(FacesContext facesContext)
 127  
     {
 128  0
         getValueBinding(facesContext);
 129  
 
 130  0
         return (_valueBinding == DUMMY_VB)
 131  
             ? _value : _valueBinding.getValue(facesContext);
 132  
     }
 133  
 
 134  
 
 135  
     public ValueBinding getValueBinding(FacesContext facesContext)
 136  
     {
 137  0
         if (_valueBinding == null)
 138  
         {
 139  0
             _valueBinding =
 140  
                 isValueReference()
 141  
                 ? facesContext.getApplication().createValueBinding(_value)
 142  
                 : DUMMY_VB;
 143  
         }
 144  0
         return _valueBinding;
 145  
     }
 146  
 
 147  
 
 148  
     public boolean isValueReference()
 149  
     {
 150  0
         return ContainerUtils.isValueReference(_value);
 151  
     }
 152  
 
 153  
 
 154  0
     private static class DummyValueBinding extends ValueBinding
 155  
     {
 156  
         public String getExpressionString()
 157  
         {
 158  0
             throw new UnsupportedOperationException();
 159  
         }
 160  
 
 161  
         public Class getType(FacesContext facesContext)
 162  
         {
 163  0
             throw new UnsupportedOperationException();
 164  
         }
 165  
 
 166  
         public Object getValue(FacesContext facesContext)
 167  
         {
 168  0
             throw new UnsupportedOperationException();
 169  
         }
 170  
 
 171  
         public boolean isReadOnly(FacesContext facesContext)
 172  
         {
 173  0
             throw new UnsupportedOperationException();
 174  
         }
 175  
 
 176  
         public void setValue(FacesContext facesContext, Object value)
 177  
         {
 178  0
             throw new UnsupportedOperationException();
 179  
         }
 180  
     }
 181  
 }