View Javadoc
1   package org.andromda.taglibs.collections;
2   
3   import java.util.Collection;
4   import javax.servlet.jsp.tagext.BodyTagSupport;
5   
6   /**
7    *
8    */
9   public class ContainsTag extends BodyTagSupport
10  {
11      private static final long serialVersionUID = 34L;
12      private Object item = null;
13  
14      /**
15       * @return item
16       */
17      public Object getItem()
18      {
19          return this.item;
20      }
21  
22      /**
23       * @param item
24       */
25      public void setItem(Object item)
26      {
27          this.item = item;
28      }
29  
30      private Collection collection = null;
31  
32      /**
33       * @return collection
34       */
35      public Collection getCollection()
36      {
37          return this.collection;
38      }
39  
40      /**
41       * @param collection
42       */
43      public void setCollection(Collection collection)
44      {
45          this.collection = collection;
46      }
47  
48      private Object[] array = null;
49  
50      /**
51       * @return array
52       */
53      public Object[] getArray()
54      {
55          return array;
56      }
57  
58      /**
59       * @param array
60       */
61      public void setArray(Object[] array)
62      {
63          this.array = array;
64      }
65  
66      /**
67       * @see javax.servlet.jsp.tagext.BodyTagSupport#doStartTag()
68       */
69      public int doStartTag() throws javax.servlet.jsp.JspException
70      {
71          return ( (this.array != null && java.util.Arrays.asList(this.array).contains(this.item))
72              || (this.collection != null && this.collection.contains(this.item)) ) ? EVAL_BODY_BUFFERED : SKIP_BODY;
73      }
74  }