01: /*
02: * ValueFilter.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.db.importer.modifier;
13:
14: import java.util.LinkedList;
15: import java.util.List;
16: import workbench.db.ColumnIdentifier;
17:
18: /**
19: *
20: * @author support@sql-workbench.net
21: */
22: public class ValueFilter implements ImportValueModifier {
23: private List<ImportValueModifier> modifiers = new LinkedList<ImportValueModifier>();
24:
25: public ValueFilter() {
26: }
27:
28: public int getSize() {
29: int size = 0;
30: for (ImportValueModifier modifier : modifiers) {
31: size += modifier.getSize();
32: }
33: return size;
34: }
35:
36: public String modifyValue(ColumnIdentifier column, String value) {
37: for (ImportValueModifier modifier : modifiers) {
38: value = modifier.modifyValue(column, value);
39: }
40: return value;
41: }
42:
43: /**
44: * Adds a column modifier.
45: * The modifiers are called in the order how they are added.
46: *
47: * @param modifier
48: */
49: public void addColumnModifier(ImportValueModifier modifier) {
50: this.modifiers.add(modifier);
51: }
52:
53: }
|