Differences between revisions 1 and 2
Revision 1 as of 2007-10-29 23:18:21
Size: 6033
Editor: NathanBubna
Comment: rough draft of GenericTools doc
Revision 2 as of 2009-09-20 22:06:12
Size: 6075
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
[wiki:VelocityTools2/GenericTools GenericTools] is the set of classes that provide basic infrastructure for using tools in standard Java SE Velocity projects, as well as a set of tools for use in generic Velocity templates. These tools have no Java EE dependencies and are often safe to use as "singletons". Some of them are not thread-safe to allow both a no-arg constructor and configurability, but the state-changing methods are declared protected with the exception of configure(Map) which is--by default--rendered useless after being used just once. If you require strict thread-safety, be very cautious in using any configurable tools. [[VelocityTools2/GenericTools|GenericTools]] is the set of classes that provide basic infrastructure for using tools in standard Java SE Velocity projects, as well as a set of tools for use in generic Velocity templates. These tools have no Java EE dependencies and are often safe to use as "singletons". Some of them are not thread-safe to allow both a no-arg constructor and configurability, but the state-changing methods are declared protected with the exception of configure(Map) which is--by default--rendered useless after being used just once. If you require strict thread-safety, be very cautious in using any configurable tools.
Line 5: Line 5:
The default configuration provided for [wiki:VelocityTools2/GenericTools GenericTools] is [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/tools.xml?view=markup here]. The default configuration provided for [[VelocityTools2/GenericTools|GenericTools]] is [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/tools.xml?view=markup|here]].
Line 17: Line 17:
  * commons-beanutils - core infrastructure, [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/MathTool.java?view=markup MathTool], [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/SortTool.java?view=markup SortTool]   * commons-beanutils - core infrastructure, [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/MathTool.java?view=markup|MathTool]], [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/SortTool.java?view=markup|SortTool]]
Line 19: Line 19:
  * commons-lang - [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/EscapeTool.java?view=markup EscapeTool]
  * velocity - [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ClassTool.java?view=markup ClassTool], [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/IteratorTool.java?view=markup IteratorTool], [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/RenderTool.java?view=markup RenderTool]
  * commons-lang - [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/EscapeTool.java?view=markup|EscapeTool]]
  * velocity - [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ClassTool.java?view=markup|ClassTool]], [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/IteratorTool.java?view=markup|IteratorTool]], [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/RenderTool.java?view=markup|RenderTool]]
Line 23: Line 23:
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/Alternator.java?view=markup Alternator] & [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/AlternatorTool.java?view=markup AlternatorTool] - For easily alternating over values in a list or array.
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ClassTool.java?view=markup ClassTool] - For simplifying reflective lookup of information about Classes and their fields, methods and constructors.
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ConversionTool.java?view=markup ConversionTool] - For converting String values to richer object types.
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/DateTool.java?view=markup DateTool] & [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ComparisonDateTool.java?view=markup ComparisonDateTool] - For manipulating, formatting, and comparing dates.
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/DisplayTool.java?view=markup DisplayTool] - For controlling display of references (e.g. truncating values, "pretty printing" lists, and displaying alternates when a reference is null).
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/EscapeTool.java?view=markup EscapeTool] - For common escaping needs in Velocity templates (e.g. escaping html, xml, javascript etc.)
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/FieldTool.java?view=markup FieldTool] - For (easy) access to static fields in a class, such as string constants.
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/IteratorTool.java?view=markup IteratorTool] - Wraps lists to let the designer specify a condition to terminate the loop, and reuse the same list in different loops.
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ListTool.java?view=markup ListTool] - For working with arrays and lists, treats both transparently the same.
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/MathTool.java?view=markup MathTool] - For performing math functions.
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/NumberTool.java?view=markup NumberTool] - For formatting and converting numbers.
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/RenderTool.java?view=markup RenderTool] - To evaluate and render arbitrary strings of VTL, including recursive rendering.
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java?view=markup ResourceTool] - For simplified access to ResourceBundles for internationalization or other dynamic content needs.
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/SortTool.java?view=markup SortTool] - Used to sort collections (or arrays, iterators, etc) on any arbitary set of properties exposed by the objects contained within the collection.
 * [http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ValueParser.java?view=markup ValueParser] - Used to retrieve and parse (aka convert) String values pulled from a map.
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/Alternator.java?view=markup|Alternator]] & [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/AlternatorTool.java?view=markup|AlternatorTool]] - For easily alternating over values in a list or array.
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ClassTool.java?view=markup|ClassTool]] - For simplifying reflective lookup of information about Classes and their fields, methods and constructors.
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ConversionTool.java?view=markup|ConversionTool]] - For converting String values to richer object types.
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/DateTool.java?view=markup|DateTool]] & [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ComparisonDateTool.java?view=markup|ComparisonDateTool]] - For manipulating, formatting, and comparing dates.
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/DisplayTool.java?view=markup|DisplayTool]] - For controlling display of references (e.g. truncating values, "pretty printing" lists, and displaying alternates when a reference is null).
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/EscapeTool.java?view=markup|EscapeTool]] - For common escaping needs in Velocity templates (e.g. escaping html, xml, javascript etc.)
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/FieldTool.java?view=markup|FieldTool]] - For (easy) access to static fields in a class, such as string constants.
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/IteratorTool.java?view=markup|IteratorTool]] - Wraps lists to let the designer specify a condition to terminate the loop, and reuse the same list in different loops.
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ListTool.java?view=markup|ListTool]] - For working with arrays and lists, treats both transparently the same.
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/MathTool.java?view=markup|MathTool]] - For performing math functions.
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/NumberTool.java?view=markup|NumberTool]] - For formatting and converting numbers.
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/RenderTool.java?view=markup|RenderTool]] - To evaluate and render arbitrary strings of VTL, including recursive rendering.
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java?view=markup|ResourceTool]] - For simplified access to ResourceBundles for internationalization or other dynamic content needs.
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/SortTool.java?view=markup|SortTool]] - Used to sort collections (or arrays, iterators, etc) on any arbitary set of properties exposed by the objects contained within the collection.
 * [[http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/generic/ValueParser.java?view=markup|ValueParser]] - Used to retrieve and parse (aka convert) String values pulled from a map.

Overview

GenericTools is the set of classes that provide basic infrastructure for using tools in standard Java SE Velocity projects, as well as a set of tools for use in generic Velocity templates. These tools have no Java EE dependencies and are often safe to use as "singletons". Some of them are not thread-safe to allow both a no-arg constructor and configurability, but the state-changing methods are declared protected with the exception of configure(Map) which is--by default--rendered useless after being used just once. If you require strict thread-safety, be very cautious in using any configurable tools.

Default Configuration

The default configuration provided for GenericTools is here.

Dependencies

TODO: just link to an anchor in a comprehensive dependencies overview page?

  • Compile Time Requirements
    • commons-beanutils
    • commons-collections
    • commons-digester
    • commons-lang
    • commons-logging
    • velocity
  • Runtime Requirements

Tools

  • Alternator & AlternatorTool - For easily alternating over values in a list or array.

  • ClassTool - For simplifying reflective lookup of information about Classes and their fields, methods and constructors.

  • ConversionTool - For converting String values to richer object types.

  • DateTool & ComparisonDateTool - For manipulating, formatting, and comparing dates.

  • DisplayTool - For controlling display of references (e.g. truncating values, "pretty printing" lists, and displaying alternates when a reference is null).

  • EscapeTool - For common escaping needs in Velocity templates (e.g. escaping html, xml, javascript etc.)

  • FieldTool - For (easy) access to static fields in a class, such as string constants.

  • IteratorTool - Wraps lists to let the designer specify a condition to terminate the loop, and reuse the same list in different loops.

  • ListTool - For working with arrays and lists, treats both transparently the same.

  • MathTool - For performing math functions.

  • NumberTool - For formatting and converting numbers.

  • RenderTool - To evaluate and render arbitrary strings of VTL, including recursive rendering.

  • ResourceTool - For simplified access to ResourceBundles for internationalization or other dynamic content needs.

  • SortTool - Used to sort collections (or arrays, iterators, etc) on any arbitary set of properties exposed by the objects contained within the collection.

  • ValueParser - Used to retrieve and parse (aka convert) String values pulled from a map.

VelocityTools2/GenericTools (last edited 2009-09-20 22:06:12 by localhost)