diff options
2 files changed, 39 insertions, 32 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java index 52f788cde..ea5fb6b30 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/delegates/GsonMapPersistenceDelegate.java @@ -63,11 +63,8 @@ public class GsonMapPersistenceDelegate extends ExecutableExtension implements I this.defaultFileExtension = defaultFileExtension; } - /* - * (non-Javadoc) - * @see - * org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#getPersistedClass( - * java.lang.Object) + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#getPersistedClass(java.lang.Object) */ @Override public Class<?> getPersistedClass(Object context) { @@ -81,25 +78,25 @@ public class GsonMapPersistenceDelegate extends ExecutableExtension implements I return defaultFileExtension; } - /* - * (non-Javadoc) - * @see - * org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#writeList(java.lang - * .Object[], java.lang.Object) + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#writeList(java.lang.Object[], java.lang.Object) */ @Override public Object writeList(Object[] context, Object container) throws IOException { + Assert.isNotNull(context); + Assert.isNotNull(container); + return write(context, container, true); } - /* - * (non-Javadoc) - * @see - * org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#write(java.lang.Object - * , java.lang.Object) + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#write(java.lang.Object, java.lang.Object) */ @Override public final Object write(Object context, Object container) throws IOException { + Assert.isNotNull(context); + Assert.isNotNull(container); + return write(context, container, false); } @@ -198,25 +195,21 @@ public class GsonMapPersistenceDelegate extends ExecutableExtension implements I return null; } - /* - * (non-Javadoc) - * @see - * org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#readList(java.lang - * .Class, java.lang.Object) + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#readList(java.lang.Class, java.lang.Object) */ @Override public Object[] readList(Class<?> contextClass, Object container) throws IOException { + Assert.isNotNull(container); return (Object[])read(contextClass, container, true); } - /* - * (non-Javadoc) - * @see - * org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#read(java.lang.Object, - * java.lang.Object) + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#read(java.lang.Object, java.lang.Object) */ @Override public final Object read(Object context, Object container) throws IOException { + Assert.isNotNull(container); return read(context, container, false); } @@ -305,11 +298,8 @@ public class GsonMapPersistenceDelegate extends ExecutableExtension implements I return list.toArray(); } - /* - * (non-Javadoc) - * @see - * org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#delete(java.lang.Object - * , java.lang.Object) + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistenceDelegate#delete(java.lang.Object, java.lang.Object) */ @Override public boolean delete(Object context, Object container) throws IOException { diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/interfaces/IPersistenceDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/interfaces/IPersistenceDelegate.java index 50aa36fa5..5476d3112 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/interfaces/IPersistenceDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.persistence/src/org/eclipse/tcf/te/runtime/persistence/interfaces/IPersistenceDelegate.java @@ -19,7 +19,7 @@ import org.eclipse.tcf.te.runtime.interfaces.extensions.IExecutableExtension; public interface IPersistenceDelegate extends IExecutableExtension { /** - * Writes the given context to the given persistence container using the key. + * Writes the given context to the given persistence container. * If the container does not exist yet, the class needs to be given. * * @param context The context to persist. Must not be <code>null</code>. @@ -29,6 +29,15 @@ public interface IPersistenceDelegate extends IExecutableExtension { */ public Object write(Object context, Object container) throws IOException; + /** + * Writes the given list of context objects to the given persistence container. + * If the container does not exist yet, the class needs to be given. + * + * @param context The list of contexts to persist. Must not be <code>null</code>. + * @param container The persistence container or class for a new one. Must not be <code>null</code>. + * + * @return The new or updated container instance. + */ public Object writeList(Object[] context, Object container) throws IOException; /** @@ -43,13 +52,21 @@ public interface IPersistenceDelegate extends IExecutableExtension { * Reads the context from the given persistence container. * If the context does not exist yet, the class needs to be given. * - * @param context The context to update or class for a new context. Must not be <code>null</code>. + * @param context The context to update or class for a new context or <code>null</code>. * @param container The persistence container. Must not be <code>null</code>. * * @return The new or updated context instance. */ public Object read(Object context, Object container) throws IOException; + /** + * Reads a list of context objects from the given persistence container. + * + * @param contextClass The class type of the context objects to read or <code>null</code>. + * @param container The persistence container. Must not be <code>null</code>. + * + * @return The list of context objects. Might be empty. + */ public Object[] readList(Class<?> contextClass, Object container) throws IOException; /** |