Coverage Report - org.kuali.rice.kew.api.document.PropertyDefinition
 
Classes in this File Line Coverage Branch Coverage Complexity
PropertyDefinition
0%
0/14
0%
0/2
1.4
PropertyDefinition$Constants
0%
0/2
N/A
1.4
PropertyDefinition$Elements
0%
0/1
N/A
1.4
 
 1  
 /*
 2  
  * Copyright 2005-2009, 2011 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.kew.api.document;
 17  
 
 18  
 import java.util.Collection;
 19  
 
 20  
 import javax.xml.bind.annotation.XmlAccessType;
 21  
 import javax.xml.bind.annotation.XmlAccessorType;
 22  
 import javax.xml.bind.annotation.XmlAnyElement;
 23  
 import javax.xml.bind.annotation.XmlElement;
 24  
 import javax.xml.bind.annotation.XmlRootElement;
 25  
 import javax.xml.bind.annotation.XmlType;
 26  
 
 27  
 import org.apache.commons.lang.StringUtils;
 28  
 import org.kuali.rice.core.api.CoreConstants;
 29  
 import org.w3c.dom.Element;
 30  
 
 31  
 @XmlRootElement(name = PropertyDefinition.Constants.ROOT_ELEMENT_NAME)
 32  
 @XmlAccessorType(XmlAccessType.NONE)
 33  
 @XmlType(name = PropertyDefinition.Constants.TYPE_NAME, propOrder = {
 34  
         PropertyDefinition.Elements.NAME,
 35  
         PropertyDefinition.Elements.VALUE,
 36  
         CoreConstants.CommonElements.FUTURE_ELEMENTS
 37  
 })
 38  
 public final class PropertyDefinition {
 39  
 
 40  
     @XmlElement(name = Elements.NAME, required = true)
 41  
     private final String name;
 42  
 
 43  
     @XmlElement(name = Elements.VALUE, required = false)
 44  
     private final String value;
 45  
 
 46  0
     @SuppressWarnings("unused")
 47  
     @XmlAnyElement
 48  
     private final Collection<Element> _futureElements = null;
 49  
 
 50  
     @SuppressWarnings("unused")
 51  0
     private PropertyDefinition() {
 52  0
         this.name = null;
 53  0
         this.value = null;
 54  0
     }
 55  
 
 56  
     public static PropertyDefinition create(String name, String value) {
 57  0
         return new PropertyDefinition(name, value);
 58  
     }
 59  
 
 60  0
     private PropertyDefinition(String name, String value) {
 61  0
         if (StringUtils.isBlank(name)) {
 62  0
             throw new IllegalArgumentException("name is null or blank");
 63  
         }
 64  0
         this.name = name;
 65  0
         this.value = value;
 66  0
     }
 67  
 
 68  
     public String getName() {
 69  0
         return name;
 70  
     }
 71  
 
 72  
     public String getValue() {
 73  0
         return value;
 74  
     }
 75  
 
 76  
     /**
 77  
      * Defines some internal constants used on this class.
 78  
      */
 79  0
     static class Constants {
 80  
         final static String ROOT_ELEMENT_NAME = "propertyDefinition";
 81  
         final static String TYPE_NAME = "PropertyDefinitionType";
 82  0
         final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[]{CoreConstants.CommonElements.FUTURE_ELEMENTS};
 83  
     }
 84  
 
 85  
     /**
 86  
      * A private class which exposes constants which define the XML element names to use when this
 87  
      * object is marshalled to XML.
 88  
      */
 89  0
     static class Elements {
 90  
         final static String NAME = "name";
 91  
         final static String VALUE = "value";
 92  
     }
 93  
 
 94  
 }