Additional convenience methods as suggested by Sean Radford.
This commit is contained in:
parent
03781aeccd
commit
8a32fde12a
|
@ -74,6 +74,19 @@ public class ConfigAttributeDefinition {
|
||||||
this.configAttributes.add(newConfigAttribute);
|
this.configAttributes.add(newConfigAttribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether the specified <code>ConfigAttribute</code> is
|
||||||
|
* contained within this <code>ConfigAttributeDefinition</code>.
|
||||||
|
*
|
||||||
|
* @param configAttribute the attribute to locate
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if the specified <code>ConfigAttribute</code>
|
||||||
|
* is contained, <code>false</code> otherwise
|
||||||
|
*/
|
||||||
|
public boolean contains(ConfigAttribute configAttribute) {
|
||||||
|
return configAttributes.contains(configAttribute);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof ConfigAttributeDefinition) {
|
if (obj instanceof ConfigAttributeDefinition) {
|
||||||
ConfigAttributeDefinition test = (ConfigAttributeDefinition) obj;
|
ConfigAttributeDefinition test = (ConfigAttributeDefinition) obj;
|
||||||
|
@ -102,6 +115,16 @@ public class ConfigAttributeDefinition {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of <code>ConfigAttribute</code>s defined by this
|
||||||
|
* <code>ConfigAttributeDefinition</code>.
|
||||||
|
*
|
||||||
|
* @return the number of <code>ConfigAttribute</code>s contained
|
||||||
|
*/
|
||||||
|
public int size() {
|
||||||
|
return configAttributes.size();
|
||||||
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.configAttributes.toString();
|
return this.configAttributes.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,12 @@ public class ConfigAttributeEditorTests extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals(5, position);
|
assertEquals(5, position);
|
||||||
|
|
||||||
|
assertEquals(5, result.size());
|
||||||
|
|
||||||
|
assertTrue(result.contains(new SecurityConfig("HELLO")));
|
||||||
|
assertTrue(result.contains(new SecurityConfig("TOMORROW")));
|
||||||
|
assertFalse(result.contains(new SecurityConfig("FOOBAR")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEmptyStringReturnsNull() {
|
public void testEmptyStringReturnsNull() {
|
||||||
|
|
Loading…
Reference in New Issue