1 26 27 package org.objectweb.jonas_web.deployment.api; 28 29 import java.util.ArrayList ; 30 import java.util.Iterator ; 31 import java.util.List ; 32 33 39 public class MethodDesc { 40 41 44 private String name = null; 45 46 47 50 private boolean excluded = false; 51 52 53 56 private boolean unchecked = true; 57 58 61 private TransportGuaranteeDesc transportGuarantee; 62 63 64 69 private List roles = null; 70 71 72 77 public MethodDesc(String name) { 78 this.name = name.toUpperCase(); 79 this.roles = new ArrayList (); 80 this.transportGuarantee = new TransportGuaranteeDesc(); 81 } 82 83 84 88 public boolean isExcluded() { 89 return excluded; 90 } 91 92 96 public boolean isUnchecked() { 97 return unchecked; 98 } 99 100 103 public void setExcluded() { 104 excluded = true; 105 unchecked = false; 106 } 107 108 111 public void setUnchecked() { 112 excluded = false; 113 unchecked = true; 114 } 115 116 117 121 public void addTransportGuarantee(String transportGuaranteeValue) { 122 transportGuarantee.addTransportValue(transportGuaranteeValue); 123 } 124 125 126 131 public void addRole(String role, String transportGuaranteeRoleValue) { 132 if (!roles.contains(role)) { 133 roles.add(role); 134 } 135 addTransportGuarantee(transportGuaranteeRoleValue); 136 } 137 138 139 143 public boolean hasRole() { 144 return (roles.size() > 0); 145 } 146 147 148 152 public String getName() { 153 return name; 154 } 155 156 157 161 public Iterator getRolesIterator() { 162 return roles.iterator(); 163 } 164 165 166 170 public TransportGuaranteeDesc getTransportGuarantee() { 171 return transportGuarantee; 172 } 173 174 175 176 182 public boolean equals(Object other) { 183 if (other instanceof String ) { 184 return name.equals(other); 185 } else if (other instanceof MethodDesc) { 186 return name.equals(((MethodDesc) other).getName()); 187 } else { 188 return false; 189 } 190 } 191 192 196 public int hashCode() { 197 return name.hashCode(); 198 } 199 200 201 205 public String toString() { 206 StringBuffer sb = new StringBuffer (); 207 sb.append("Method[name="); 208 sb.append(name); 209 if (excluded) { 211 sb.append(";excluded"); 212 } 213 if (unchecked) { 215 sb.append(";unchecked"); 216 } 217 sb.append(transportGuarantee); 219 220 221 sb.append(";roles="); 223 for (Iterator it = getRolesIterator(); it.hasNext();) { 224 String role = (String ) it.next(); 225 sb.append(role); 226 } 227 sb.append("]"); 228 return sb.toString(); 229 230 } 231 } 232 | Popular Tags |