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-2007 The Kuali Foundation
 3  
  * 
 4  
  * 
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  * 
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.kuali.rice.core.api.reflect;
 18  
 
 19  
 import java.io.Serializable;
 20  
 import java.util.ArrayList;
 21  
 import java.util.Collection;
 22  
 import java.util.HashMap;
 23  
 import java.util.List;
 24  
 import java.util.Map;
 25  
 
 26  
 /**
 27  
  * A marker interface for object definitions.
 28  
  * 
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 30  
  */
 31  
 public class ObjectDefinition implements Serializable {
 32  
 
 33  
         private static final long serialVersionUID = 835423601196288352L;
 34  
 
 35  
         private String className;
 36  
         private String applicationId;
 37  
         private boolean atRemotingLayer;
 38  0
         private final List<DataDefinition> constructorParameters = new ArrayList<DataDefinition>();
 39  0
         private final Map<String, PropertyDefinition> properties = new HashMap<String, PropertyDefinition>();
 40  
 
 41  
         public ObjectDefinition(Class<?> objectClass) {
 42  0
                 this(objectClass.getName());
 43  0
         }
 44  
         
 45  0
         public ObjectDefinition(String className, String applicationId) {
 46  0
                 this.className = className;
 47  0
                 this.applicationId = applicationId;
 48  0
         }
 49  
         
 50  0
         public ObjectDefinition(String className) {
 51  0
                 if (className == null) {
 52  0
                         throw new IllegalArgumentException("Extension class name cannot be null");
 53  
                 }
 54  0
                 this.className = className;
 55  0
         }
 56  
 
 57  
         public String getClassName() {
 58  0
                 return this.className;
 59  
         }
 60  
 
 61  
         public void addConstructorParameter(DataDefinition parameter) {
 62  0
             this.constructorParameters.add(parameter);
 63  0
         }
 64  
 
 65  
         public void removeConstructorParameter(DataDefinition parameter) {
 66  0
             this.constructorParameters.remove(parameter);
 67  0
         }
 68  
 
 69  
         public void setConstructorParameters(List<DataDefinition> parameters) {
 70  0
             this.constructorParameters.clear();
 71  0
             this.constructorParameters.addAll(parameters);
 72  0
         }
 73  
 
 74  
         public List<DataDefinition> getConstructorParameters() {
 75  0
                 return this.constructorParameters;
 76  
         }
 77  
 
 78  
         public void addProperty(PropertyDefinition property) {
 79  0
                 if (property == null) {
 80  0
                         return;
 81  
                 }
 82  0
                 if (property.getName() == null) {
 83  0
                         throw new IllegalArgumentException("PropertyDefinition cannot have a null name.");
 84  
                 }
 85  0
                 this.properties.put(property.getName(), property);
 86  0
         }
 87  
 
 88  
         public PropertyDefinition getProperty(String name) {
 89  0
                 return (PropertyDefinition) this.properties.get(name);
 90  
         }
 91  
 
 92  
         public Collection<PropertyDefinition> getProperties() {
 93  0
                 return this.properties.values();
 94  
         }
 95  
 
 96  
         public void setProperties(Collection<PropertyDefinition> properties) {
 97  0
                 this.properties.clear();
 98  0
                 if (properties == null) {
 99  0
                         return;
 100  
                 }
 101  0
                 for (PropertyDefinition prop: properties) {
 102  0
                         addProperty(prop);
 103  
                 }
 104  0
         }
 105  
 
 106  
     public String toString() {
 107  0
         return "[ObjectDefinition: className: " + getClassName()
 108  
                + ", applicationId: " + getApplicationId()
 109  
                + "]";
 110  
     }
 111  
 
 112  
         public boolean isAtRemotingLayer() {
 113  0
                 return this.atRemotingLayer;
 114  
         }
 115  
 
 116  
         public void setAtRemotingLayer(boolean atRemotingLayer) {
 117  0
                 this.atRemotingLayer = atRemotingLayer;
 118  0
         }
 119  
 
 120  
         public String getApplicationId() {
 121  0
                 return this.applicationId;
 122  
         }
 123  
 
 124  
         public void setApplicationId(String applicationId) {
 125  0
                 this.applicationId = applicationId;
 126  0
         }
 127  
 }