Coverage Report - org.kuali.rice.core.api.reflect.ObjectDefinition
 
Classes in this File Line Coverage Branch Coverage Complexity
ObjectDefinition
0%
0/43
0%
0/10
1.529
 
 1  
 /**
 2  
  * Copyright 2005-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.core.api.reflect;
 17  
 
 18  
 import java.io.Serializable;
 19  
 import java.util.ArrayList;
 20  
 import java.util.Collection;
 21  
 import java.util.HashMap;
 22  
 import java.util.List;
 23  
 import java.util.Map;
 24  
 
 25  
 /**
 26  
  * A marker interface for object definitions.
 27  
  * 
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  */
 30  
 public class ObjectDefinition implements Serializable {
 31  
 
 32  
         private static final long serialVersionUID = 835423601196288352L;
 33  
 
 34  
         private String className;
 35  
         private String applicationId;
 36  
         private boolean atRemotingLayer;
 37  0
         private final List<DataDefinition> constructorParameters = new ArrayList<DataDefinition>();
 38  0
         private final Map<String, PropertyDefinition> properties = new HashMap<String, PropertyDefinition>();
 39  
 
 40  
         public ObjectDefinition(Class<?> objectClass) {
 41  0
                 this(objectClass.getName());
 42  0
         }
 43  
         
 44  0
         public ObjectDefinition(String className, String applicationId) {
 45  0
                 this.className = className;
 46  0
                 this.applicationId = applicationId;
 47  0
         }
 48  
         
 49  0
         public ObjectDefinition(String className) {
 50  0
                 if (className == null) {
 51  0
                         throw new IllegalArgumentException("Extension class name cannot be null");
 52  
                 }
 53  0
                 this.className = className;
 54  0
         }
 55  
 
 56  
         public String getClassName() {
 57  0
                 return this.className;
 58  
         }
 59  
 
 60  
         public void addConstructorParameter(DataDefinition parameter) {
 61  0
             this.constructorParameters.add(parameter);
 62  0
         }
 63  
 
 64  
         public void removeConstructorParameter(DataDefinition parameter) {
 65  0
             this.constructorParameters.remove(parameter);
 66  0
         }
 67  
 
 68  
         public void setConstructorParameters(List<DataDefinition> parameters) {
 69  0
             this.constructorParameters.clear();
 70  0
             this.constructorParameters.addAll(parameters);
 71  0
         }
 72  
 
 73  
         public List<DataDefinition> getConstructorParameters() {
 74  0
                 return this.constructorParameters;
 75  
         }
 76  
 
 77  
         public void addProperty(PropertyDefinition property) {
 78  0
                 if (property == null) {
 79  0
                         return;
 80  
                 }
 81  0
                 if (property.getName() == null) {
 82  0
                         throw new IllegalArgumentException("PropertyDefinition cannot have a null name.");
 83  
                 }
 84  0
                 this.properties.put(property.getName(), property);
 85  0
         }
 86  
 
 87  
         public PropertyDefinition getProperty(String name) {
 88  0
                 return (PropertyDefinition) this.properties.get(name);
 89  
         }
 90  
 
 91  
         public Collection<PropertyDefinition> getProperties() {
 92  0
                 return this.properties.values();
 93  
         }
 94  
 
 95  
         public void setProperties(Collection<PropertyDefinition> properties) {
 96  0
                 this.properties.clear();
 97  0
                 if (properties == null) {
 98  0
                         return;
 99  
                 }
 100  0
                 for (PropertyDefinition prop: properties) {
 101  0
                         addProperty(prop);
 102  
                 }
 103  0
         }
 104  
 
 105  
     public String toString() {
 106  0
         return "[ObjectDefinition: className: " + getClassName()
 107  
                + ", applicationId: " + getApplicationId()
 108  
                + "]";
 109  
     }
 110  
 
 111  
         public boolean isAtRemotingLayer() {
 112  0
                 return this.atRemotingLayer;
 113  
         }
 114  
 
 115  
         public void setAtRemotingLayer(boolean atRemotingLayer) {
 116  0
                 this.atRemotingLayer = atRemotingLayer;
 117  0
         }
 118  
 
 119  
         public String getApplicationId() {
 120  0
                 return this.applicationId;
 121  
         }
 122  
 
 123  
         public void setApplicationId(String applicationId) {
 124  0
                 this.applicationId = applicationId;
 125  0
         }
 126  
 }