Coverage Report - org.apache.myfaces.application.cdi.AbstractExternalBeanWrapper
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractExternalBeanWrapper
0%
0/21
0%
0/18
1.889
 
 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.application.cdi;
 20  
 
 21  
 import javax.faces.FacesWrapper;
 22  
 import javax.faces.component.PartialStateHolder;
 23  
 import javax.faces.component.StateHolder;
 24  
 import javax.faces.context.FacesContext;
 25  
 
 26  
 abstract class AbstractExternalBeanWrapper<T> implements PartialStateHolder, FacesWrapper<T>
 27  
 {
 28  
     private T wrapped;
 29  
 
 30  
     protected AbstractExternalBeanWrapper(T wrapped)
 31  0
     {
 32  0
         this.wrapped = wrapped;
 33  0
     }
 34  
 
 35  
     @Override
 36  
     public void markInitialState()
 37  
     {
 38  0
         if (this.wrapped instanceof PartialStateHolder)
 39  
         {
 40  0
             ((PartialStateHolder) this.wrapped).markInitialState();
 41  
         }
 42  0
     }
 43  
 
 44  
     @Override
 45  
     public void clearInitialState()
 46  
     {
 47  0
         if (this.wrapped instanceof PartialStateHolder)
 48  
         {
 49  0
             ((PartialStateHolder) this.wrapped).clearInitialState();
 50  
         }
 51  0
     }
 52  
 
 53  
     @Override
 54  
     public boolean initialStateMarked()
 55  
     {
 56  0
         return this.wrapped instanceof PartialStateHolder && ((PartialStateHolder) this.wrapped).initialStateMarked();
 57  
     }
 58  
 
 59  
     @Override
 60  
     public Object saveState(FacesContext context)
 61  
     {
 62  0
         if (this.wrapped instanceof StateHolder)
 63  
         {
 64  0
             return ((StateHolder)wrapped).saveState(context);
 65  
         }
 66  
 
 67  0
         return null;
 68  
     }
 69  
 
 70  
     @Override
 71  
     public void restoreState(FacesContext context, Object state)
 72  
     {
 73  0
         if (this.wrapped instanceof StateHolder)
 74  
         {
 75  0
             ((StateHolder)this.wrapped).restoreState(context, state);
 76  
         }
 77  0
     }
 78  
 
 79  
     @Override
 80  
     public boolean isTransient()
 81  
     {
 82  0
         return this.wrapped instanceof StateHolder && ((StateHolder) this.wrapped).isTransient();
 83  
     }
 84  
 
 85  
     @Override
 86  
     public void setTransient(boolean newTransientValue)
 87  
     {
 88  0
         if (this.wrapped instanceof StateHolder)
 89  
         {
 90  0
             ((StateHolder) this.wrapped).setTransient(newTransientValue);
 91  
         }
 92  0
     }
 93  
 
 94  
     @Override
 95  
     public T getWrapped()
 96  
     {
 97  0
         return this.wrapped;
 98  
     }
 99  
 }