From 93aadcfbec878eafa18f46c7eaa3e8e6bb287f03 Mon Sep 17 00:00:00 2001 From: ribeaudc <ribeaudc> Date: Tue, 12 Jun 2007 06:53:17 +0000 Subject: [PATCH] remove: - 'setPropertyMapper' method from IParserObjectFactory: it does not belong to this interface. - DO_NOTHING_OBJECT_FACTORY -> STRING_ARRAY_OBJECT_FACTORY. SVN: 462 --- .../common/parser/IParserObjectFactory.java | 22 +++---------------- .../parser/DefaultReaderParserTest.java | 4 ++-- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/common/source/java/ch/systemsx/cisd/common/parser/IParserObjectFactory.java b/common/source/java/ch/systemsx/cisd/common/parser/IParserObjectFactory.java index 73b98aee868..88087777107 100644 --- a/common/source/java/ch/systemsx/cisd/common/parser/IParserObjectFactory.java +++ b/common/source/java/ch/systemsx/cisd/common/parser/IParserObjectFactory.java @@ -18,9 +18,7 @@ package ch.systemsx.cisd.common.parser; /** * A <code>IParserObjectFactory</code> implementation knows how to deal with given line tokens and convert them into - * an appropriate <code>Object</code>. A <code>IParserObjectFactory</code> needs a <code>IPropertyMapper</code> - * to perform its job. A <code>IPropertyMapper</code> helps to map passed tokens to created <code>Object</code> - * properties . + * an appropriate <code>Object</code>. * <p> * A <code>IParserObjectFactory</code> is typically registered in {@link IReaderParser}. * </p> @@ -32,15 +30,14 @@ public interface IParserObjectFactory<E> /** * This <code>IParserObjectFactory</code> implementation does nothing and returns the passed - * <code>lineTokens</code> as <code>String[]</code>. No mapping needed, so - * {@link #setPropertyMapper(IPropertyMapper)} does nothing. + * <code>lineTokens</code> as <code>String[]</code>. * <p> * This implementation could be used to debugging purposes. * </p> * * @author Christian Ribeaud */ - public final static IParserObjectFactory<String[]> DO_NOTHING_OBJECT_FACTORY = new IParserObjectFactory<String[]>() + public final static IParserObjectFactory<String[]> STRING_ARRAY_OBJECT_FACTORY = new IParserObjectFactory<String[]>() { // @@ -51,23 +48,10 @@ public interface IParserObjectFactory<E> { return lineTokens; } - - public final void setPropertyMapper(IPropertyMapper propertyMapper) - { - } - }; /** * Parses given text line and returns an appropriate <i>Object</i>. */ public E createObject(String[] lineTokens); - - /** - * Sets a <code>IPropertyMapper</code> to map line tokens. - * <p> - * Usually you must set a <code>IPropertyMapper</code> before using {@link #createObject(String[])}. - * </p> - */ - public void setPropertyMapper(IPropertyMapper propertyMapper); } \ No newline at end of file diff --git a/common/sourceTest/java/ch/systemsx/cisd/common/parser/DefaultReaderParserTest.java b/common/sourceTest/java/ch/systemsx/cisd/common/parser/DefaultReaderParserTest.java index 6535b4c7522..31d85e2f221 100644 --- a/common/sourceTest/java/ch/systemsx/cisd/common/parser/DefaultReaderParserTest.java +++ b/common/sourceTest/java/ch/systemsx/cisd/common/parser/DefaultReaderParserTest.java @@ -42,7 +42,7 @@ public final class DefaultReaderParserTest public final void testParseWithoutFactoryAndHeader() throws IOException { final IReaderParser<String[]> parser = new DefaultReaderParser<String[]>(); - parser.setObjectFactory(IParserObjectFactory.DO_NOTHING_OBJECT_FACTORY); + parser.setObjectFactory(IParserObjectFactory.STRING_ARRAY_OBJECT_FACTORY); final Reader reader = new StringReader(text); final List<String[]> result = parser.parse(reader, new DefaultLineFilter()); assertEquals(3, result.size()); @@ -56,7 +56,7 @@ public final class DefaultReaderParserTest public final void testParseWithoutFactoryWithLineFilter() throws IOException { final IReaderParser<String[]> parser = new DefaultReaderParser<String[]>(); - parser.setObjectFactory(IParserObjectFactory.DO_NOTHING_OBJECT_FACTORY); + parser.setObjectFactory(IParserObjectFactory.STRING_ARRAY_OBJECT_FACTORY); final Reader reader = new StringReader(text); final List<String[]> result = parser.parse(reader, new DefaultLineFilter(2)); assertEquals(2, result.size()); -- GitLab