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