Author: apetrelli
Date: Fri Dec 17 14:31:10 2010
New Revision: 1050400
URL: http://svn.apache.org/viewvc?rev=1050400&view=rev
Log:
VELTOOLS-133
Added Javadocs.
Added:
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/package-info.java
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/package-info.java
Modified:
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/Taglib2Directive.java
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Attribute.java
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Tag.java
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Taglib.java
Modified:
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/Taglib2Directive.java
URL:
http://svn.apache.org/viewvc/velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/Taglib2Directive.java?rev=1050400&r1=1050399&r2=1050400&view=diff
==============================================================================
---
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/Taglib2Directive.java
(original)
+++
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/Taglib2Directive.java
Fri Dec 17 14:31:10 2010
@@ -1,5 +1,24 @@
package org.apache.velocity.tools.plugin.taglib;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
Modified:
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Attribute.java
URL:
http://svn.apache.org/viewvc/velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Attribute.java?rev=1050400&r1=1050399&r2=1050400&view=diff
==============================================================================
---
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Attribute.java
(original)
+++
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Attribute.java
Fri Dec 17 14:31:10 2010
@@ -1,5 +1,24 @@
package org.apache.velocity.tools.plugin.taglib.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
import java.util.HashMap;
import java.util.Map;
@@ -7,10 +26,16 @@ import org.apache.commons.digester.annot
import org.apache.commons.digester.annotations.rules.ObjectCreate;
import org.apache.commons.digester.annotations.rules.SetTop;
+/**
+ * It represents a tag attribute, in a tag library descriptor.
+ */
@ObjectCreate(pattern = "taglib/tag/attribute")
public class Attribute
{
+ /**
+ * Maps primitive types to their wrapped equivalents.
+ */
private static Map<String, String> primitive2wrapped;
static {
@@ -25,84 +50,167 @@ public class Attribute
primitive2wrapped.put("boolean", Boolean.class.getName());
}
+ /**
+ * The name of the attribute.
+ */
@BeanPropertySetter(pattern = "taglib/tag/attribute/name")
private String name;
+ /**
+ * The description of the attribute.
+ */
@BeanPropertySetter(pattern = "taglib/tag/attribute/description")
private String description;
+ /**
+ * It tells if the attribute is required.
+ */
@BeanPropertySetter(pattern = "taglib/tag/attribute/required")
private boolean required = false;
+ /**
+ * It tells if the attribute can have a value that is the result of
runtime expression.
+ */
@BeanPropertySetter(pattern = "taglib/tag/attribute/rtexprvalue")
private boolean rtexprvalue = false;
+ /**
+ * The type of the attribute.
+ */
@BeanPropertySetter(pattern = "taglib/tag/attribute/type")
private String type;
+ /**
+ * The containing tag.
+ */
private Tag tag;
+ /**
+ * Returns the name of the attribute.
+ *
+ * @return The name of the attribute.
+ */
public String getName()
{
return name;
}
+ /**
+ * Sets the name of the attribute.
+ *
+ * @param name The name of the attribute.
+ */
public void setName(String name)
{
this.name = name;
}
+ /**
+ * Returns the description of the attribute.
+ *
+ * @return The description of the attribute.
+ */
public String getDescription()
{
return description;
}
+ /**
+ * Sets the description of the attribute.
+ *
+ * @param description The description of the attribute.
+ */
public void setDescription(String description)
{
this.description = description;
}
+ /**
+ * Returns <code>true</code> if the attribute is required.
+ *
+ * @return <code>true</code> if the attribute is required.
+ */
public boolean isRequired()
{
return required;
}
+ /**
+ * It tells if the attribute is required.
+ *
+ * @param required <code>true</code> if the attribute is required.
+ */
public void setRequired(boolean required)
{
this.required = required;
}
+ /**
+ * Returns <code>true</code> if the attribute accepts runtime expression.
+ *
+ * @return <code>true</code> if the attribute accepts runtime expression.
+ */
public boolean isRtexprvalue()
{
return rtexprvalue;
}
+ /**
+ * It tells ifthe attribute accepts runtime expression.
+ *
+ * @param rtexprvalue <code>true</code> if the attribute accepts runtime
expression.
+ */
public void setRtexprvalue(boolean rtexprvalue)
{
this.rtexprvalue = rtexprvalue;
}
+ /**
+ * Returns the type of the attribute.
+ *
+ * @return The type of the attribute.
+ */
public String getType()
{
return type;
}
+ /**
+ * Sets the type of the attribute.
+ *
+ * @param type The type of the attribute.
+ */
public void setType(String type)
{
this.type = type;
}
+ /**
+ * Sets the tag that contains this attribute.
+ *
+ * @param tag The container tag.
+ */
@SetTop(pattern="taglib/tag/attribute")
- public void setTag(Tag tag)
+ public void setJTag(Tag tag)
{
this.tag = tag;
}
+ /**
+ * Returns the tag that contains this attribute.
+ *
+ * @return The container tag.
+ */
public Tag getTag()
{
return tag;
}
+ /**
+ * Returns the type that should be used in the Velocity directive for this
attribute.
+ *
+ * @return The type to use in Velocity directive.
+ */
public String getWrappedType() {
if (type == null) {
return String.class.getName();
@@ -114,6 +222,11 @@ public class Attribute
return retValue;
}
+ /**
+ * Returns the name of the setter method.
+ *
+ * @return The name of the setter method.
+ */
public String getSetterName() {
return "set" + name.substring(0, 1).toUpperCase() + name.substring(1);
}
Modified:
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Tag.java
URL:
http://svn.apache.org/viewvc/velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Tag.java?rev=1050400&r1=1050399&r2=1050400&view=diff
==============================================================================
---
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Tag.java
(original)
+++
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Tag.java
Fri Dec 17 14:31:10 2010
@@ -1,5 +1,24 @@
package org.apache.velocity.tools.plugin.taglib.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
import java.util.ArrayList;
import java.util.List;
@@ -10,83 +29,166 @@ import org.apache.commons.digester.annot
import org.apache.commons.digester.annotations.rules.SetNext;
import
org.apache.velocity.tools.view.jsp.taglib.jspimpl.VelocityToolsJspException;
+/**
+ * It represents a tag in a tag library descriptor.
+ */
@ObjectCreate(pattern = "taglib/tag")
public class Tag
{
+ /**
+ * The name of the tag.
+ */
@BeanPropertySetter(pattern = "taglib/tag/name")
private String name;
+ /**
+ * The description of the tag.
+ */
@BeanPropertySetter(pattern = "taglib/tag/description")
private String description;
+ /**
+ * The Java class of the tag.
+ */
@BeanPropertySetter(pattern = "taglib/tag/tag-class")
private String tagClass;
+ /**
+ * The type of the body content.
+ */
@BeanPropertySetter(pattern = "taglib/tag/body-content")
private String bodyContent;
+ /**
+ * The list of supported attributes.
+ */
private List<Attribute> attributes = new ArrayList<Attribute>();
+ /**
+ * Returns the name of the tag.
+ *
+ * @return The name of the tag.
+ */
public String getName()
{
return name;
}
+ /**
+ * Sets the name of the tag.
+ *
+ * @param name The name of the tag.
+ */
public void setName(String name)
{
this.name = name;
}
+ /**
+ * Returns the description of the tag.
+ *
+ * @return The description of the tag.
+ */
public String getDescription()
{
return description;
}
+ /**
+ * Sets the description of the tag.
+ *
+ * @param description The description of the tag.
+ */
public void setDescription(String description)
{
this.description = description;
}
+ /**
+ * Returns the class of the tag.
+ *
+ * @return The class of the tag.
+ */
public String getTagClass()
{
return tagClass;
}
+ /**
+ * Sets the class of the tag.
+ *
+ * @param tagClass The class of the tag.
+ */
public void setTagClass(String tagClass)
{
this.tagClass = tagClass;
}
+ /**
+ * Returns the body content of the tag.
+ *
+ * @return The body content of the tag.
+ */
public String getBodyContent()
{
return bodyContent;
}
+ /**
+ * Sets the body content of the tag.
+ *
+ * @param bodyContent The body content of the tag.
+ */
public void setBodyContent(String bodyContent)
{
this.bodyContent = bodyContent;
}
+ /**
+ * Returns the contained attributes.
+ *
+ * @return The attributes.
+ */
public List<Attribute> getAttributes()
{
return attributes;
}
+ /**
+ * Adds an attribute to the supported attributes.
+ *
+ * @param attribute A new supported attribute.
+ */
@SetNext
public void addAttribute(Attribute attribute)
{
attributes.add(attribute);
}
+ /**
+ * It tells if this tag implements {...@link SimpleTag}.
+ *
+ * @return <code>true</code> if it is a SimpleTag.
+ */
public boolean isSimpleTag() {
return SimpleTag.class.isAssignableFrom(getReflectedTagClass());
}
+ /**
+ * It tells if this tag has a body.
+ *
+ * @return <code>true</code> if this tag has a body.
+ */
public boolean hasBody() {
return !"empty".equals(bodyContent);
}
+ /**
+ * Returns the reflected tag class.
+ *
+ * @return The real tag class.
+ */
public Class<?> getReflectedTagClass()
{
Class<?> clazz;
Modified:
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Taglib.java
URL:
http://svn.apache.org/viewvc/velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Taglib.java?rev=1050400&r1=1050399&r2=1050400&view=diff
==============================================================================
---
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Taglib.java
(original)
+++
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/Taglib.java
Fri Dec 17 14:31:10 2010
@@ -1,5 +1,24 @@
package org.apache.velocity.tools.plugin.taglib.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
import java.util.ArrayList;
import java.util.List;
@@ -7,68 +26,136 @@ import org.apache.commons.digester.annot
import org.apache.commons.digester.annotations.rules.ObjectCreate;
import org.apache.commons.digester.annotations.rules.SetNext;
+/**
+ * It represents a Tag Library, as read from a Tag Library Descriptor.
+ */
@ObjectCreate(pattern = "taglib")
public class Taglib
{
+ /**
+ * The description of the taglib.
+ */
@BeanPropertySetter(pattern = "taglib/description")
private String description;
+ /**
+ * The version of this taglib.
+ */
@BeanPropertySetter(pattern = "taglib/tlib-version")
private String tlibVersion;
+ /**
+ * The short name of the taglib.
+ */
@BeanPropertySetter(pattern = "taglib/short-name")
private String shortName;
+ /**
+ * The normalized URI to access this taglib.
+ */
@BeanPropertySetter(pattern = "taglib/uri")
private String uri;
+ /**
+ * The contained tags.
+ */
private List<Tag> tags = new ArrayList<Tag>();
+ /**
+ * Returns the description.
+ *
+ * @return The description.
+ */
public String getDescription()
{
return description;
}
+ /**
+ * Sets the description.
+ *
+ * @param description The description.
+ */
public void setDescription(String description)
{
this.description = description;
}
+ /**
+ * Returns the taglib version.
+ *
+ * @return The taglib version.
+ */
public String getTlibVersion()
{
return tlibVersion;
}
+ /**
+ * Sets the taglib version.
+ *
+ * @param tlibVersion The taglib version.
+ */
public void setTlibVersion(String tlibVersion)
{
this.tlibVersion = tlibVersion;
}
+ /**
+ * Returns the short name of the taglib.
+ *
+ * @return The short name of the taglib.
+ */
public String getShortName()
{
return shortName;
}
+ /**
+ * Sets the short name of the taglib.
+ *
+ * @param shortName The short name of the taglib.
+ */
public void setShortName(String shortName)
{
this.shortName = shortName;
}
+ /**
+ * Returns the URI of the taglib.
+ *
+ * @return The URI of the taglib.
+ */
public String getUri()
{
return uri;
}
+ /**
+ * Sets the URI of the taglib.
+ *
+ * @param uri The URI of the taglib.
+ */
public void setUri(String uri)
{
this.uri = uri;
}
+ /**
+ * Returns the tags of this taglib.
+ *
+ * @return The tags.
+ */
public List<Tag> getTags()
{
return tags;
}
+ /**
+ * Adds a new tag to the contained tag.
+ *
+ * @param tag The tag to add.
+ */
@SetNext
public void addTag(Tag tag)
{
Added:
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/package-info.java
URL:
http://svn.apache.org/viewvc/velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/package-info.java?rev=1050400&view=auto
==============================================================================
---
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/package-info.java
(added)
+++
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/model/package-info.java
Fri Dec 17 14:31:10 2010
@@ -0,0 +1,25 @@
+/*
+ * $Id: package-info.java 1044659 2010-12-11 14:16:04Z apetrelli $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Model classes representing a tag library descriptor elements.
+ */
+package org.apache.velocity.tools.plugin.taglib.model;
+
Added:
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/package-info.java
URL:
http://svn.apache.org/viewvc/velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/package-info.java?rev=1050400&view=auto
==============================================================================
---
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/package-info.java
(added)
+++
velocity/tools/trunk/maven-velocity-tools-plugin/src/main/java/org/apache/velocity/tools/plugin/taglib/package-info.java
Fri Dec 17 14:31:10 2010
@@ -0,0 +1,25 @@
+/*
+ * $Id: package-info.java 1044659 2010-12-11 14:16:04Z apetrelli $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Wraps a JSP tag library into one Velocity directive per tag.
+ */
+package org.apache.velocity.tools.plugin.taglib;
+