View Javadoc
1   package org.andromda.core.configuration;
2   
3   import java.io.Serializable;
4   import java.util.ArrayList;
5   import java.util.Arrays;
6   import java.util.Collection;
7   
8   /**
9    * Used to specify which filter should or should not be applied within a model.
10   *
11   * @author Chad Brandon
12   * @see org.andromda.core.configuration.Filters
13   */
14  public class Filter
15      implements Serializable
16  {
17      private static final long serialVersionUID = 34L;
18      private String value;
19  
20      /**
21       * Gets the value of this Filter.
22       *
23       * @return Returns the value.
24       */
25      public String getValue()
26      {
27          return value;
28      }
29  
30      /**
31       * Sets the value of this Filter.
32       *
33       * @param name the value of the filter.
34       */
35      public void setValue(final String name)
36      {
37          this.value = name;
38      }
39  
40      /**
41       * The flag indicating whether or not this filter
42       * should be applied.
43       */
44      private boolean apply = true;
45  
46      /**
47       * Whether or not this filter should be applied.
48       *
49       * @return Returns the shouldProcess.
50       */
51      public boolean isApply()
52      {
53          return this.apply;
54      }
55  
56      /**
57       * Sets whether or not this Filter should be applied.
58       *
59       * @param process The shouldProcess to set.
60       */
61      public void setApply(final boolean process)
62      {
63          this.apply = process;
64      }
65  
66      private Collection<String> namespaces = new ArrayList<String>();
67  
68      /**
69       * Sets the comma separated list of namespaces to which the filter applies.
70       *
71       * @param namespaces a comma separated list of namespaces to apply to the filter.
72       */
73      public void setNamespaces(String namespaces)
74      {
75          this.namespaces.clear();
76          this.namespaces.addAll(Arrays.asList(namespaces.split("\\s*,\\s*")));
77      }
78  
79      /**
80       * Gets the list of namespaces that this filter applies to.
81       *
82       * @return the list of namespaces.
83       */
84      public Collection<String> getNamespaceList()
85      {
86          return this.namespaces;
87      }
88  }