View Javadoc

1   /*
2    * Copyright 2005 Filipe Tavares
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.devyant.decorutils.tags.xmldecorator;
17  
18  import javax.servlet.jsp.tagext.TagData;
19  import javax.servlet.jsp.tagext.TagExtraInfo;
20  import javax.servlet.jsp.tagext.VariableInfo;
21  
22  /***
23   * Implementation of TagExtraInfo for the decorate tag, identifying
24   * the scripting object(s) to be made visible.
25   *
26   * @author Filipe Tavares
27   * @version $Revision: 1.0$ ($Author: ftavares$)
28   * @since 16/12/2004 3:28:52
29   */
30  public class XDecorateTagExtraInfo extends TagExtraInfo {
31      /***
32       * @see javax.servlet.jsp.tagext.TagExtraInfo#getVariableInfo(javax.servlet.jsp.tagext.TagData)
33       */
34      public final VariableInfo[] getVariableInfo(final TagData data) {
35          if (data.getAttributeString("attributes") == null) {
36              return null;
37          }
38          final String [] attr = data.getAttributeString("attributes")
39              .trim().split("//s*,+//s*");
40          VariableInfo [] info = new VariableInfo[attr.length];
41          
42          for (int i = 0; i < attr.length; i++) {
43              info[i] = new VariableInfo(attr[i],
44                      "java.lang.String",
45                      true,
46                      VariableInfo.NESTED);
47          }
48          
49          return info;
50      }
51  }