1 22 23 package org.objectweb.petals.tools.jbicommon.descriptor; 24 25 import java.util.ArrayList ; 26 import java.util.List ; 27 28 import org.apache.commons.lang.builder.EqualsBuilder; 29 import org.apache.commons.lang.builder.HashCodeBuilder; 30 import org.apache.commons.lang.builder.ToStringBuilder; 31 32 41 public class ServiceAssembly extends ExtensibleJbiElement { 42 43 46 private Identification identification; 47 48 51 private List <ServiceUnit> serviceUnits; 52 53 57 private List <Connection> connections; 58 59 62 public ServiceAssembly() { 63 super(); 64 serviceUnits = new ArrayList <ServiceUnit>(); 65 } 66 67 public void addServiceUnit(final ServiceUnit unit) { 68 serviceUnits.add(unit); 69 70 } 71 72 @Override 73 public boolean equals(final Object other) { 74 if (!(other instanceof ServiceAssembly)) { 75 return false; } 77 ServiceAssembly castOther = (ServiceAssembly) other; 78 return new EqualsBuilder().append(identification, 79 castOther.identification).append(serviceUnits, 80 castOther.serviceUnits).append(connections, 81 castOther.connections).isEquals(); 82 } 83 84 92 public List <Connection> getConnections() { 93 return connections; 94 } 95 96 100 105 public Identification getIdentification() { 106 return identification; 107 } 108 109 @Override 110 public int hashCode() { 111 return new HashCodeBuilder().append(identification) 112 .append(serviceUnits).append(connections).toHashCode(); 113 } 114 115 @Override 116 public String toString() { 117 return new ToStringBuilder(this).append("identification", 118 identification).append("serviceUnits", serviceUnits).append( 119 "connections", connections).toString(); 120 } 121 122 129 protected void setConnections(final List <Connection> connections) { 130 this.connections = connections; 131 } 132 133 139 protected void setIdentification(final Identification identification) { 140 this.identification = identification; 141 } 142 143 149 protected void setServiceUnits(final List <ServiceUnit> serviceUnits) { 150 this.serviceUnits = serviceUnits; 151 } 152 153 159 public List <ServiceUnit> getServiceUnits() { 160 return serviceUnits; 161 } 162 163 164 } 165 | Popular Tags |