diff options
| author | Benjamin Culkin <scorpress@gmail.com> | 2024-05-20 17:58:16 -0400 |
|---|---|---|
| committer | Benjamin Culkin <scorpress@gmail.com> | 2024-05-20 17:58:16 -0400 |
| commit | 40a9d99496e098562f090fb7ffce9e749011b131 (patch) | |
| tree | 437df24d65470582e943e494a52db8ed65a881ae /projects/net.wotonomy.test/src/main/java/net/wotonomy/test/TestDataSource.java | |
| parent | ff072dfe782f6f22123cd4ba050828d35c0d0fbd (diff) | |
Formatting pass
Diffstat (limited to 'projects/net.wotonomy.test/src/main/java/net/wotonomy/test/TestDataSource.java')
| -rw-r--r-- | projects/net.wotonomy.test/src/main/java/net/wotonomy/test/TestDataSource.java | 158 |
1 files changed, 66 insertions, 92 deletions
diff --git a/projects/net.wotonomy.test/src/main/java/net/wotonomy/test/TestDataSource.java b/projects/net.wotonomy.test/src/main/java/net/wotonomy/test/TestDataSource.java index 1d36bef..c55a386 100644 --- a/projects/net.wotonomy.test/src/main/java/net/wotonomy/test/TestDataSource.java +++ b/projects/net.wotonomy.test/src/main/java/net/wotonomy/test/TestDataSource.java @@ -7,109 +7,83 @@ import net.wotonomy.control.EOFetchSpecification; import net.wotonomy.foundation.NSArray; /** -* A custom DataSource that works with -* the datastore package for persistence. -*/ -public class TestDataSource extends EODataSource -{ - private EOEditingContext context; - private Object source; - private String key; - - public TestDataSource() - { - this( Test.editingContext ); + * A custom DataSource that works with the datastore package for persistence. + */ +public class TestDataSource extends EODataSource { + private EOEditingContext context; + private Object source; + private String key; + + public TestDataSource() { + this(Test.editingContext); } - - public TestDataSource( EOEditingContext aContext ) - { - context = aContext; + + public TestDataSource(EOEditingContext aContext) { + context = aContext; } - - public EOEditingContext editingContext() - { - return context; - } - - /** - * This implementation does nothing. - */ - public void insertObject ( Object anObject ) - { - // creates are handled by createObject(). + + public EOEditingContext editingContext() { + return context; } - /** - * Deletes the specified object from this data source. - */ - public void deleteObject ( Object anObject ) - { - editingContext().deleteObject( anObject ); + /** + * This implementation does nothing. + */ + public void insertObject(Object anObject) { + // creates are handled by createObject(). } - /** - * Returns a List containing the objects in this - * data source. This implementation returns all - * TestObjects that have been persisted to the - * datastore in the data directory. - */ - public NSArray fetchObjects () - { - if ( source == null ) - { - NSArray result = editingContext().objectsWithFetchSpecification( - new EOFetchSpecification() ); - if ( result.size() > 0 ) - { - result = new NSArray( result.objectAtIndex( 0 ) ); + /** + * Deletes the specified object from this data source. + */ + public void deleteObject(Object anObject) { + editingContext().deleteObject(anObject); + } + + /** + * Returns a List containing the objects in this data source. This + * implementation returns all TestObjects that have been persisted to the + * datastore in the data directory. + */ + public NSArray fetchObjects() { + if (source == null) { + NSArray result = editingContext().objectsWithFetchSpecification(new EOFetchSpecification()); + if (result.size() > 0) { + result = new NSArray(result.objectAtIndex(0)); //result.add( result.objectAtIndex( 0 ) ); - } - return result; - } - else - { - return new NSArray( - ((TestObject)source).getChildList() ); - } - } + } + return result; + } else { + return new NSArray(((TestObject) source).getChildList()); + } + } - /** - * Returns a data source that is capable of - * manipulating objects of the type returned by - * applying the specified key to objects - * vended by this data source. - * @see #qualifyWithRelationshipKey - */ - public EODataSource - dataSourceQualifiedByKey ( String aKey ) - { - return new TestDataSource( editingContext() ); + /** + * Returns a data source that is capable of manipulating objects of the type + * returned by applying the specified key to objects vended by this data source. + * + * @see #qualifyWithRelationshipKey + */ + public EODataSource dataSourceQualifiedByKey(String aKey) { + return new TestDataSource(editingContext()); } - /** - * Restricts this data source to vend those - * objects that are associated with the specified - * key on the specified object. - */ - public void - qualifyWithRelationshipKey ( - String aKey, Object anObject ) - { - key = aKey; - source = anObject; + /** + * Restricts this data source to vend those objects that are associated with the + * specified key on the specified object. + */ + public void qualifyWithRelationshipKey(String aKey, Object anObject) { + key = aKey; + source = anObject; } - /** - * Returns the description of the class of the - * objects that is vended by this data source, - * or null if this cannot be determined. - * This implementation returns TestObject. - */ - public EOClassDescription - classDescriptionForObjects () - { - return EOClassDescription.classDescriptionForClass( - TestObject.class ); - } + /** + * Returns the description of the class of the objects that is vended by this + * data source, or null if this cannot be determined. This implementation + * returns TestObject. + */ + public EOClassDescription classDescriptionForObjects() { + return EOClassDescription.classDescriptionForClass(TestObject.class); + } } |
