|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  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 |     | 
     | 
  |  28 |     | 
     | 
  |  29 |     | 
     | 
  |  30 |     | 
     | 
  |  31 |     | 
   public class ObjectDefinition implements Serializable { | 
  |  32 |     | 
     | 
  |  33 |     | 
           private static final long serialVersionUID = 835423601196288352L;  | 
  |  34 |     | 
     | 
  |  35 |     | 
           private String className;  | 
  |  36 |     | 
           private String serviceNamespace;  | 
  |  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 serviceNamespace) { | 
  |  46 |    0 |                    this.className = className;  | 
  |  47 |    0 |                    this.serviceNamespace = serviceNamespace;  | 
  |  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 |     | 
                  + ", serviceNamespace: " + getServiceNamespace()  | 
  |  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 getServiceNamespace() { | 
  |  121 |    0 |                    return this.serviceNamespace;  | 
  |  122 |     | 
           }  | 
  |  123 |     | 
     | 
  |  124 |     | 
           public void setServiceNamespace(String serviceNamespace) { | 
  |  125 |    0 |                    this.serviceNamespace = serviceNamespace;  | 
  |  126 |    0 |            }  | 
  |  127 |     | 
   }  |