Dust off JMX demo
This commit is contained in:
@@ -71,6 +71,13 @@ public class DefaultFieldSet implements FieldSet {
|
||||
}
|
||||
return (String[]) names.toArray();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.item.file.mapping.FieldSet#hasNames()
|
||||
*/
|
||||
public boolean hasNames() {
|
||||
return names!=null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
||||
@@ -40,6 +40,13 @@ public interface FieldSet {
|
||||
*/
|
||||
String[] getNames();
|
||||
|
||||
/**
|
||||
* Check if there are names defined for the fields.
|
||||
*
|
||||
* @return true if there are names for the fields
|
||||
*/
|
||||
boolean hasNames();
|
||||
|
||||
/**
|
||||
* @return fields wrapped by this '<code>FieldSet</code>' instance as
|
||||
* String values.
|
||||
|
||||
@@ -45,11 +45,13 @@ public class FieldSetTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testNames() throws Exception {
|
||||
assertTrue(fieldSet.hasNames());
|
||||
assertEquals(fieldSet.getFieldCount(), fieldSet.getNames().length);
|
||||
}
|
||||
|
||||
public void testNamesNotKnown() throws Exception {
|
||||
fieldSet = new DefaultFieldSet(new String[] { "foo" });
|
||||
assertFalse(fieldSet.hasNames());
|
||||
try {
|
||||
fieldSet.getNames();
|
||||
fail("Expected IllegalStateException");
|
||||
|
||||
Reference in New Issue
Block a user