Java Doc for ValueParser.java in  » Template-Engine » Velocity » org » apache » velocity » tools » generic » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Template Engine » Velocity » org.apache.velocity.tools.generic 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.velocity.tools.generic.ValueParser

All known Subclasses:   org.apache.velocity.tools.view.tools.ParameterParser,
ValueParser
public class ValueParser (Code)

Utility class for easy parsing of String values held in a Map.

 Template example(s):
 $parser.foo                ->  bar
 $parser.getNumber('baz')   ->  12.6
 $parser.getInt('baz')      ->  12
 $parser.getNumbers('baz')  ->  [12.6]
 Toolbox configuration:
 <tool>
 <key>parser</key>
 <class>org.apache.velocity.generic.ValueParser</class>
 </tool>
 

This comes in very handy when parsing parameters.


author:
   Nathan Bubna
version:
   $Revision: 497988 $ $Date: 2007-01-19 14:48:13 -0800 (Fri, 19 Jan 2007) $
since:
   VelocityTools 1.2



Constructor Summary
public  ValueParser()
    
public  ValueParser(Map source)
    

Method Summary
public  booleanexists(String key)
     Convenience method for checking whether a certain parameter exists.
public  Objectget(String key)
     Convenience method for use in Velocity templates. This allows for easy "dot" access to parameters. e.g.
public  BooleangetBoolean(String key)
    
public  booleangetBoolean(String key, boolean alternate)
    
public  BooleangetBoolean(String key, Boolean alternate)
    
public  Boolean[]getBooleans(String key)
    
public  DoublegetDouble(String key)
    
public  DoublegetDouble(String key, Double alternate)
    
public  doublegetDouble(String key, double alternate)
    
public  double[]getDoubles(String key)
    
public  intgetInt(String key, int alternate)
    
public  IntegergetInteger(String key)
    
public  IntegergetInteger(String key, Integer alternate)
    
public  int[]getInts(String key)
    
public  LocalegetLocale(String key)
    
public  LocalegetLocale(String key, Locale alternate)
    
public  Locale[]getLocales(String key)
    
public  NumbergetNumber(String key)
    
public  NumbergetNumber(String key, Number alternate)
    
public  Number[]getNumbers(String key)
    
protected  MapgetSource()
    
public  StringgetString(String key)
    
public  StringgetString(String key, String alternate)
    
public  String[]getStrings(String key)
    
final protected  StringgetStringsDelimiter()
     Returns the delimiter used for separating values in a single String value.
protected  BooleanparseBoolean(String value)
     Converts a parameter value into a Boolean Sub-classes can override to allow for customized boolean parsing. (e.g.
protected  LocaleparseLocale(String value)
     Converts a String value into a Locale.
protected  NumberparseNumber(String value)
     Converts a parameter value into a Number This is used as the base for all numeric parsing methods.
protected  String[]parseStringList(String value)
     Converts a single String value into an array of Strings by splitting it on the tool's set delimiter.
protected  voidsetSource(Map source)
    
final protected  voidsetStringsDelimiter(String delimiter)
     Sets the delimiter used for separating values in a single String value.


Constructor Detail
ValueParser
public ValueParser()(Code)



ValueParser
public ValueParser(Map source)(Code)




Method Detail
exists
public boolean exists(String key)(Code)
Convenience method for checking whether a certain parameter exists.
Parameters:
  key - the parameter's key true if a parameter exists for the specifiedkey; otherwise, returns false.



get
public Object get(String key)(Code)
Convenience method for use in Velocity templates. This allows for easy "dot" access to parameters. e.g. $params.foo instead of $params.getString('foo')
Parameters:
  key - the parameter's key parameter matching the specified key ornull if there is no matchingparameter



getBoolean
public Boolean getBoolean(String key)(Code)

Parameters:
  key - the desired parameter's key a Boolean object for the specified key ornull if no matching parameter is found



getBoolean
public boolean getBoolean(String key, boolean alternate)(Code)

Parameters:
  key - the desired parameter's key
Parameters:
  alternate - The alternate boolean value boolean value for the specified key or thealternate boolean is no value is found



getBoolean
public Boolean getBoolean(String key, Boolean alternate)(Code)

Parameters:
  key - the desired parameter's key
Parameters:
  alternate - the alternate Boolean a Boolean for the specified key or the specifiedalternate if no matching parameter is found



getBooleans
public Boolean[] getBooleans(String key)(Code)

Parameters:
  key - the key for the desired parameter an array of Boolean objects associated with the given key.



getDouble
public Double getDouble(String key)(Code)

Parameters:
  key - the desired parameter's key a Double for the specified key ornull if no matching parameter is found



getDouble
public Double getDouble(String key, Double alternate)(Code)

Parameters:
  key - the desired parameter's key
Parameters:
  alternate - The alternate Double an Double for the specified key or the specifiedalternate if no matching parameter is found



getDouble
public double getDouble(String key, double alternate)(Code)

Parameters:
  key - the desired parameter's key
Parameters:
  alternate - The alternate double value the double value for the specified key or the specifiedalternate value if no matching parameter is found



getDoubles
public double[] getDoubles(String key)(Code)

Parameters:
  key - the key for the desired parameter an array of double values associated with the given key,or null if numbers are not associated with it.



getInt
public int getInt(String key, int alternate)(Code)

Parameters:
  key - the desired parameter's key
Parameters:
  alternate - The alternate int value the int value for the specified key or the specifiedalternate value if no matching parameter is found



getInteger
public Integer getInteger(String key)(Code)

Parameters:
  key - the desired parameter's key a Integer for the specified key ornull if no matching parameter is found



getInteger
public Integer getInteger(String key, Integer alternate)(Code)

Parameters:
  key - the desired parameter's key
Parameters:
  alternate - The alternate Integer an Integer for the specified key or the specifiedalternate if no matching parameter is found



getInts
public int[] getInts(String key)(Code)

Parameters:
  key - the key for the desired parameter an array of int values associated with the given key,or null if numbers are not associated with it.



getLocale
public Locale getLocale(String key)(Code)

Parameters:
  key - the desired parameter's key a Locale for the specified key ornull if no matching parameter is found



getLocale
public Locale getLocale(String key, Locale alternate)(Code)

Parameters:
  key - the desired parameter's key
Parameters:
  alternate - The alternate Locale a Locale for the specified key or the specifiedalternate if no matching parameter is found



getLocales
public Locale[] getLocales(String key)(Code)

Parameters:
  key - the key for the desired parameter an array of Locale objects associated with the given key,or null if Locales are not associated with it.



getNumber
public Number getNumber(String key)(Code)

Parameters:
  key - the desired parameter's key a Number for the specified key ornull if no matching parameter is found



getNumber
public Number getNumber(String key, Number alternate)(Code)

Parameters:
  key - the desired parameter's key
Parameters:
  alternate - The alternate Number a Number for the specified key or the specifiedalternate if no matching parameter is found



getNumbers
public Number[] getNumbers(String key)(Code)

Parameters:
  key - the key for the desired parameter an array of Number objects associated with the given key,or null if Numbers are not associated with it.



getSource
protected Map getSource()(Code)



getString
public String getString(String key)(Code)

Parameters:
  key - the parameter's key parameter matching the specified key ornull if there is no matchingparameter



getString
public String getString(String key, String alternate)(Code)

Parameters:
  key - the desired parameter's key
Parameters:
  alternate - The alternate value parameter matching the specified key or thespecified alternate String if there is no matchingparameter



getStrings
public String[] getStrings(String key)(Code)

Parameters:
  key - the key for the desired parameter an array of String objects containing all of the valuesassociated with the given key, or nullif the no values are associated with the given key



getStringsDelimiter
final protected String getStringsDelimiter()(Code)
Returns the delimiter used for separating values in a single String value. The default delimiter is a comma.
since:
   VelocityTools 1.3
See Also:   ValueParser.parseStringList



parseBoolean
protected Boolean parseBoolean(String value)(Code)
Converts a parameter value into a Boolean Sub-classes can override to allow for customized boolean parsing. (e.g. to handle "Yes/No" or "T/F")
Parameters:
  value - the string to be parsed the value as a Boolean



parseLocale
protected Locale parseLocale(String value)(Code)
Converts a String value into a Locale.
since:
   VelocityTools 1.3



parseNumber
protected Number parseNumber(String value) throws NumberFormatException(Code)
Converts a parameter value into a Number This is used as the base for all numeric parsing methods. So, sub-classes can override to allow for customized number parsing. (e.g. to handle fractions, compound numbers, etc.)
Parameters:
  value - the string to be parsed the value as a Number



parseStringList
protected String[] parseStringList(String value)(Code)
Converts a single String value into an array of Strings by splitting it on the tool's set delimiter. The default delimiter is a comma.
since:
   VelocityTools 1.3



setSource
protected void setSource(Map source)(Code)



setStringsDelimiter
final protected void setStringsDelimiter(String delimiter)(Code)
Sets the delimiter used for separating values in a single String value. The default delimiter is a comma.
since:
   VelocityTools 1.3
See Also:   ValueParser.parseStringList



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.