Coverage Report - org.apache.tapestry5.services.ApplicationStateContribution
 
Classes in this File Line Coverage Branch Coverage Complexity
ApplicationStateContribution
100%
9/9
N/A
1
 
 1  
 // Copyright 2007 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry5.services;
 16  
 
 17  
 import org.apache.tapestry5.ioc.internal.util.Defense;
 18  
 
 19  
 /**
 20  
  * A contribution to the configuration of the {@link ApplicationStateManager}, identifying the strategy and creator for
 21  
  * a particular Session State Object (SSO), identified by the SSO's class.
 22  
  */
 23  
 public final class ApplicationStateContribution
 24  
 {
 25  
     private final String strategy;
 26  
 
 27  
     private final ApplicationStateCreator creator;
 28  
 
 29  
     public ApplicationStateContribution(String strategy)
 30  
     {
 31  2
         this(strategy, null);
 32  2
     }
 33  
 
 34  
     public ApplicationStateContribution(String strategy, ApplicationStateCreator creator)
 35  12
     {
 36  12
         Defense.notBlank(strategy, "strategy");
 37  
 
 38  12
         this.strategy = strategy;
 39  12
         this.creator = creator;
 40  12
     }
 41  
 
 42  
     /**
 43  
      * The creator for the ASO. If null, the the ASO is created directly from the ASO class, via its public no-arguments
 44  
      * constructor.
 45  
      */
 46  
     public ApplicationStateCreator getCreator()
 47  
     {
 48  12
         return creator;
 49  
     }
 50  
 
 51  
     /**
 52  
      * The name of the strategy used to control where the ASO is stored.
 53  
      */
 54  
     public String getStrategy()
 55  
     {
 56  12
         return strategy;
 57  
     }
 58  
 
 59  
 }