From 40a9d99496e098562f090fb7ffce9e749011b131 Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Mon, 20 May 2024 17:58:16 -0400 Subject: Formatting pass --- .../java/net/wotonomy/test/TestDataSource.java | 158 +++++++++------------ 1 file changed, 66 insertions(+), 92 deletions(-) (limited to 'projects/net.wotonomy.test/src/main/java/net/wotonomy/test/TestDataSource.java') 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); + } } -- cgit v1.2.3