1 22 23 package org.objectweb.petals.tools.jbicommon.descriptor; 24 25 import org.apache.commons.lang.builder.EqualsBuilder; 26 import org.apache.commons.lang.builder.HashCodeBuilder; 27 import org.apache.commons.lang.builder.ToStringBuilder; 28 29 36 public class JBIDescriptor { 37 38 42 45 private static final String CL_PARENT_FIRST = "parent-first"; 46 47 50 private static final String CL_SELF_FIRST = "self-first"; 51 52 55 private ComponentDescription component; 56 57 60 private ServiceAssembly serviceAssembly; 61 62 65 private Services services; 66 67 70 private SharedLibrary sharedLibrary; 71 72 75 private double version; 76 77 80 public JBIDescriptor() { super(); 82 } 83 84 88 public static boolean isParentFirst(final String delegation) { 89 return (delegation == null) || (CL_PARENT_FIRST.equals(delegation)); 90 } 91 92 96 public static boolean isSelfFirst(final String delegation) { 97 return CL_SELF_FIRST.equals(delegation); 98 99 } 100 101 @Override 102 public boolean equals(final Object other) { 103 if (!(other instanceof JBIDescriptor)) { 104 return false; } 106 JBIDescriptor castOther = (JBIDescriptor) other; 107 return new EqualsBuilder().append(component, castOther.component) 108 .append(serviceAssembly, castOther.serviceAssembly).append( 109 services, castOther.services).append(sharedLibrary, 110 castOther.sharedLibrary).append(version, 111 castOther.version).isEquals(); 112 } 113 114 118 123 public ComponentDescription getComponent() { 124 return component; 125 } 126 127 132 public ServiceAssembly getServiceAssembly() { 133 return serviceAssembly; 134 } 135 136 141 public Services getServices() { 142 return services; 143 } 144 145 150 public SharedLibrary getSharedLibrary() { 151 return sharedLibrary; 152 } 153 154 160 public double getVersion() { 161 return version; 162 } 163 164 @Override 165 public int hashCode() { 166 return new HashCodeBuilder().append(component).append(serviceAssembly) 167 .append(services).append(sharedLibrary).append(version) 168 .toHashCode(); 169 } 170 171 @Override 172 public String toString() { 173 return new ToStringBuilder(this).append("component", component).append( 174 "serviceAssembly", serviceAssembly) 175 .append("services", services).append("sharedLibrary", 176 sharedLibrary).append("version", version).toString(); 177 } 178 179 185 protected void setComponent(final ComponentDescription component) { 186 this.component = component; 187 } 188 189 195 protected void setServiceAssembly(final ServiceAssembly serviceAssembly) { 196 this.serviceAssembly = serviceAssembly; 197 } 198 199 205 protected void setServices(final Services services) { 206 this.services = services; 207 } 208 209 213 219 protected void setSharedLibrary(final SharedLibrary sharedLibrary) { 220 this.sharedLibrary = sharedLibrary; 221 } 222 223 230 protected void setVersion(final double version) { 231 this.version = version; 232 } 233 } 234 | Popular Tags |