source: trunk/loci/formats/auto/FilterMetadata.vm @ 3917

Revision 3917, 2.9 KB checked in by curtis, 12 years ago (diff)

A bunch of work on the loci.formats.meta autogenerator. Not finished yet.

Line 
1//
2// FilterMetadata.vm
3//
4
5/*
6LOCI Bio-Formats package for reading and converting biological file formats.
7Copyright (C) 2005-@year@ Melissa Linkert, Curtis Rueden, Chris Allan,
8Eric Kjellman and Brian Loranger.
9
10This program is free software; you can redistribute it and/or modify
11it under the terms of the GNU Library General Public License as published by
12the Free Software Foundation; either version 2 of the License, or
13(at your option) any later version.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18GNU Library General Public License for more details.
19
20You should have received a copy of the GNU Library General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23*/
24
25/*-----------------------------------------------------------------------------
26 *
27 * THIS IS AUTOMATICALLY GENERATED CODE.  DO NOT MODIFY.
28 * Created by $user via MetadataAutogen on $timestamp
29 *
30 *-----------------------------------------------------------------------------
31 */
32
33package loci.formats.meta;
34
35import loci.formats.DataTools;
36
37/**
38 * An implementation of {@link MetadataStore} that removes unprintable
39 * characters from metadata values before storing them in a delegate
40 * MetadataStore.
41 *
42 * <dl><dt><b>Source code:</b></dt>
43 * <dd><a href="https://skyking.microscopy.wisc.edu/trac/java/browser/trunk/loci/formats/meta/FilterMetadata.java">Trac</a>,
44 * <a href="https://skyking.microscopy.wisc.edu/svn/java/trunk/loci/formats/meta/FilterMetadata.java">SVN</a></dd></dl>
45 *
46 * @author Melissa Linkert linkert at wisc.edu
47 * @author Curtis Rueden ctrueden at wisc.edu
48 */
49public class FilterMetadata implements MetadataStore {
50
51  // -- Fields --
52
53  private MetadataStore store;
54  private boolean filter;
55
56  // -- Constructor --
57
58  public FilterMetadata(MetadataStore store, boolean filter) {
59    this.store = store;
60    this.filter = filter;
61  }
62
63  // -- MetadataStore API methods --
64
65  public void createRoot() {
66    store.createRoot();
67  }
68
69  public Object getRoot() {
70    return store.getRoot();
71  }
72
73  public void setRoot(Object root) {
74    store.setRoot(root);
75  }
76
77#foreach ($entity in $q.entities())
78#set ($dummy = $q.setEntity($entity))
79
80  // -- $entity property storage -
81#foreach ($prop in $q.props())
82#set ($dummy = $q.setProperty($prop))
83
84  /* @see MetadataStore#set$entity$prop($q.type(), $q.indicesList(true, false)) */
85  public void set$entity$prop($q.type() $q.var($prop), $q.indicesList(true, true)) {
86#if ($q.type() == "String")
87    String value = filter ? DataTools.sanitize($q.var($prop)) : $q.var($prop);
88    store.set$entity$prop(value, $q.indicesList(false, true));
89#else
90    store.set$entity$prop($q.var($prop), $q.indicesList(false, true));
91#end
92  }
93#end##foreach $prop
94#end##foreach $entity
95
96}
Note: See TracBrowser for help on using the repository browser.