Coverage Report - org.apache.tapestry5.grid.SortConstraint
 
Classes in this File Line Coverage Branch Coverage Complexity
SortConstraint
62%
8/13
0%
0/8
0
 
 1  
 // Copyright 2008 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.grid;
 16  
 
 17  
 import org.apache.tapestry5.beaneditor.PropertyModel;
 18  
 import org.apache.tapestry5.ioc.internal.util.Defense;
 19  
 
 20  
 /**
 21  
  * Identifies how a single column (identified as a {@link org.apache.tapestry5.beaneditor.PropertyModel}) is sorted.
 22  
  */
 23  
 public class SortConstraint
 24  
 {
 25  
     private final PropertyModel propertyModel;
 26  
 
 27  
     private final ColumnSort columnSort;
 28  
 
 29  
     public SortConstraint(PropertyModel propertyModel, ColumnSort columnSort)
 30  42
     {
 31  42
         Defense.notNull(propertyModel, "propertyModel");
 32  42
         Defense.notNull(columnSort, "columnSort");
 33  
 
 34  42
         this.propertyModel = propertyModel;
 35  42
         this.columnSort = columnSort;
 36  42
     }
 37  
 
 38  
     public PropertyModel getPropertyModel()
 39  
     {
 40  34
         return propertyModel;
 41  
     }
 42  
 
 43  
     public ColumnSort getColumnSort()
 44  
     {
 45  34
         return columnSort;
 46  
     }
 47  
 
 48  
     // equals() is useful for testing
 49  
 
 50  
     @Override
 51  
     public boolean equals(Object o)
 52  
     {
 53  0
         if (this == o) return true;
 54  
 
 55  0
         if (o == null || getClass() != o.getClass()) return false;
 56  
 
 57  0
         SortConstraint that = (SortConstraint) o;
 58  
 
 59  0
         if (columnSort != that.columnSort) return false;
 60  
 
 61  0
         return propertyModel.equals(that.propertyModel);
 62  
     }
 63  
 }