001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.openejb.jee;
017:
018: import javax.xml.bind.annotation.XmlAccessType;
019: import javax.xml.bind.annotation.XmlAccessorType;
020: import javax.xml.bind.annotation.XmlAttribute;
021: import javax.xml.bind.annotation.XmlElement;
022: import javax.xml.bind.annotation.XmlID;
023: import javax.xml.bind.annotation.XmlTransient;
024: import javax.xml.bind.annotation.XmlType;
025: import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
026: import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
027: import java.util.ArrayList;
028: import java.util.Collection;
029: import java.util.List;
030: import java.util.Map;
031:
032: /**
033: * The function element is used to provide information on each
034: * function in the tag library that is to be exposed to the EL.
035: * <p/>
036: * The function element may have several subelements defining:
037: * <p/>
038: * description Optional tag-specific information
039: * <p/>
040: * display-name A short name that is intended to be displayed
041: * by tools
042: * <p/>
043: * icon Optional icon element that can be used by tools
044: * <p/>
045: * name A unique name for this function
046: * <p/>
047: * function-class Provides the name of the Java class that
048: * implements the function
049: * <p/>
050: * function-signature Provides the signature, as in the Java Language
051: * Specification, of the Java method that is to be
052: * used to implement the function.
053: * <p/>
054: * example Optional informal description of an
055: * example of a use of this function
056: * <p/>
057: * function-extension Zero or more extensions that provide extra
058: * information about this function, for tool
059: * consumption
060: */
061: @XmlAccessorType(XmlAccessType.FIELD)
062: @XmlType(name="functionType",propOrder={"descriptions","displayNames","icon","name","functionClass","functionSignature","example","functionExtension"})
063: public class Function {
064: @XmlTransient
065: protected TextMap description = new TextMap();
066: @XmlTransient
067: protected TextMap displayName = new TextMap();
068: @XmlElement(name="icon",required=true)
069: protected LocalCollection<Icon> icon = new LocalCollection<Icon>();
070:
071: @XmlElement(required=true)
072: protected String name;
073: @XmlElement(name="function-class",required=true)
074: protected String functionClass;
075: @XmlElement(name="function-signature",required=true)
076: protected String functionSignature;
077: protected String example;
078: @XmlElement(name="function-extension")
079: protected List<TldExtension> functionExtension;
080: @XmlAttribute
081: @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
082: @XmlID
083: protected String id;
084:
085: @XmlElement(name="description",required=true)
086: public Text[] getDescriptions() {
087: return description.toArray();
088: }
089:
090: public void setDescriptions(Text[] text) {
091: description.set(text);
092: }
093:
094: public String getDescription() {
095: return description.get();
096: }
097:
098: @XmlElement(name="display-name",required=true)
099: public Text[] getDisplayNames() {
100: return displayName.toArray();
101: }
102:
103: public void setDisplayNames(Text[] text) {
104: displayName.set(text);
105: }
106:
107: public String getDisplayName() {
108: return displayName.get();
109: }
110:
111: public Collection<Icon> getIcons() {
112: if (icon == null) {
113: icon = new LocalCollection<Icon>();
114: }
115: return icon;
116: }
117:
118: public Map<String, Icon> getIconMap() {
119: if (icon == null) {
120: icon = new LocalCollection<Icon>();
121: }
122: return icon.toMap();
123: }
124:
125: public Icon getIcon() {
126: return icon.getLocal();
127: }
128:
129: public String getName() {
130: return name;
131: }
132:
133: public void setName(String value) {
134: this .name = value;
135: }
136:
137: public String getFunctionClass() {
138: return functionClass;
139: }
140:
141: public void setFunctionClass(String value) {
142: this .functionClass = value;
143: }
144:
145: public String getFunctionSignature() {
146: return functionSignature;
147: }
148:
149: public void setFunctionSignature(String value) {
150: this .functionSignature = value;
151: }
152:
153: public String getExample() {
154: return example;
155: }
156:
157: public void setExample(String value) {
158: this .example = value;
159: }
160:
161: public List<TldExtension> getFunctionExtension() {
162: if (functionExtension == null) {
163: functionExtension = new ArrayList<TldExtension>();
164: }
165: return this .functionExtension;
166: }
167:
168: public String getId() {
169: return id;
170: }
171:
172: public void setId(String value) {
173: this.id = value;
174: }
175: }
|