| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| SimpleBooleanFormatter | 
  | 
  | 2.0;2 | 
| 1 |  /* | |
| 2 |   * Copyright 2006-2008 The Kuali Foundation | |
| 3 |   *  | |
| 4 |   * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 5 |   * you may not use this file except in compliance with the License. | |
| 6 |   * You may obtain a copy of the License at | |
| 7 |   *  | |
| 8 |   * http://www.opensource.org/licenses/ecl2.php | |
| 9 |   *  | |
| 10 |   * Unless required by applicable law or agreed to in writing, software | |
| 11 |   * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 |   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 |   * See the License for the specific language governing permissions and | |
| 14 |   * limitations under the License. | |
| 15 |   */ | |
| 16 |  package org.kuali.rice.core.web.format; | |
| 17 | ||
| 18 | ||
| 19 |  /** | |
| 20 |   * This class is used to convert Boolean objects into and from 'true' and 'false' Strings, since that's what JSTL expects to use in | |
| 21 |   * conditionals. | |
| 22 |   */ | |
| 23 | 0 |  public class SimpleBooleanFormatter extends Formatter { | 
| 24 |      /** | |
| 25 |       * Converts the given true/false String into a Boolean. | |
| 26 |       */ | |
| 27 |      protected Object convertToObject(String target) { | |
| 28 | 0 |          return Boolean.valueOf(target); | 
| 29 | }  | |
| 30 | ||
| 31 |      /** | |
| 32 |       * Converts the given Boolean into a boolean String. | |
| 33 |       */ | |
| 34 |      public Object format(Object value) { | |
| 35 | 0 |          Object formatted = value; | 
| 36 | ||
| 37 | 0 |          if ((value != null) && (value instanceof Boolean)) { | 
| 38 | 0 |              formatted = value.toString(); | 
| 39 | }  | |
| 40 | ||
| 41 | 0 |          return formatted; | 
| 42 | }  | |
| 43 | }  |