01: package org.osbl.persistence.model;
02:
03: import org.conform.format.AbstractFormat;
04: import org.conform.format.Format;
05: import org.osbl.persistence.model.TreeNodeEntity;
06:
07: public class TreeNodeEntityFormat extends AbstractFormat {
08: static final String[] INDENTION = new String[] { "", " ", " ",
09: " ", " ", };
10:
11: Format format;
12:
13: public TreeNodeEntityFormat(Format format) {
14: this .format = format;
15: }
16:
17: public String format(Object value) {
18: if (value == null)
19: return null;
20:
21: TreeNodeEntity treeNodeEntity = (TreeNodeEntity) value;
22: return INDENTION[treeNodeEntity.getDepth() - 1]
23: + format.format(value);
24: }
25: }
|