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 42 public class Services extends ExtensibleJbiElement { 43 44 47 private boolean bindingComponent; 48 49 52 private List <Provides> provides; 53 54 57 private List <Consumes> consumes; 58 59 62 public Services() { 63 super(); 64 consumes = new ArrayList <Consumes>(); 65 provides = new ArrayList <Provides>(); 66 } 67 68 @Override 69 public boolean equals(final Object other) { 70 if (!(other instanceof Services)) { 71 return false; } 73 Services castOther = (Services) other; 74 return new EqualsBuilder().append(bindingComponent, 75 castOther.bindingComponent) 76 .append(provides, castOther.provides).append(consumes, 77 castOther.consumes).isEquals(); 78 } 79 80 84 @Override 85 public int hashCode() { 86 return new HashCodeBuilder().append(bindingComponent).append(provides) 87 .append(consumes).toHashCode(); 88 } 89 90 96 public boolean isBindingComponent() { 97 return bindingComponent; 98 } 99 100 @Override 101 public String toString() { 102 return new ToStringBuilder(this).append("bindingComponent", 103 bindingComponent).append("provides", provides).append( 104 "consumes", consumes).toString(); 105 } 106 107 protected void addConsumes(final Consumes consumesElem) { 108 consumes.add(consumesElem); 109 } 110 111 protected void addProvides(final Provides providesElem) { 112 provides.add(providesElem); 113 } 114 115 121 protected void setBindingComponent(final boolean bindingComponent) { 122 this.bindingComponent = bindingComponent; 123 } 124 125 131 protected void setConsumes(final List <Consumes> consumes) { 132 this.consumes = consumes; 133 } 134 135 139 public List <Consumes> getConsumes() { 140 return consumes; 141 } 142 143 149 void setProvides(final List <Provides> provides) { 150 this.provides = provides; 151 } 152 153 157 public List <Provides> getProvides() { 158 return provides; 159 } 160 161 } 162 | Popular Tags |