View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.myfaces.tobago.apt.generate;
21  
22  import java.util.ArrayList;
23  import java.util.List;
24  
25  
26  public class TagInfo extends RendererInfo {
27    private List<PropertyInfo> properties = new ArrayList<PropertyInfo>();
28    private String componentClassName;
29    private String componentType;
30    private String componentFamily;
31    private PropertyInfo bodyContent;
32    private boolean checkBodyContent;
33  
34    public TagInfo(final String sourceClass, final String qualifiedName, final String rendererType) {
35      super(sourceClass, qualifiedName, rendererType);
36    }
37  
38    public TagInfo(final String sourceClass, final String qualifiedName) {
39      super(sourceClass, qualifiedName);
40    }
41  
42    public PropertyInfo getBodyContent() {
43      if (!checkBodyContent) {
44        checkBodyContent = true;
45        for (final PropertyInfo info : properties) {
46          if (info.isBodyContent()) {
47            bodyContent = info;
48            break;
49          }
50        }
51      }
52      return bodyContent;
53    }
54  
55    public void setBodyContent(final PropertyInfo bodyContent) {
56      this.bodyContent = bodyContent;
57    }
58  
59    public List<PropertyInfo> getProperties() {
60      return properties;
61    }
62  
63    public int getPropertiesSize() {
64      return properties.size();
65    }
66  
67    public int getPropertiesSizePlusOne() {
68      return properties.size() + 1;
69    }
70  
71    public void setComponentClassName(final String componentClass) {
72      addImport(componentClass);
73      this.componentClassName = ClassUtils.getSimpleName(componentClass);
74    }
75  
76    public String getComponentClassName() {
77      return componentClassName;
78    }
79  
80    public String getComponentType() {
81      return componentType;
82    }
83  
84    public void setComponentType(final String componentType) {
85      this.componentType = componentType;
86    }
87  
88    public String getComponentFamily() {
89      return componentFamily;
90    }
91  
92    public void setComponentFamily(final String componentFamily) {
93      this.componentFamily = componentFamily;
94    }
95  }