Java Doc for BaseValueParser.java in  » J2EE » Expresso » com » jcorporate » expresso » core » misc » upload » 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 » J2EE » Expresso » com.jcorporate.expresso.core.misc.upload 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jcorporate.expresso.core.misc.upload.BaseValueParser

All known Subclasses:   com.jcorporate.expresso.core.misc.upload.DefaultParameterParser,
BaseValueParser
public class BaseValueParser implements ValueParser(Code)
BaseValueParser is a base class for classes that need to parse name/value Parameters, for example GET/POST data or Cookies (DefaultParameterParser and DefaultCookieParser)

It can also be used standalone, for an example see DataStreamParser.

NOTE: The name= portion of a name=value pair may be converted to lowercase or uppercase when the object is initialized and when new data is added. This behaviour is determined by the url.case.folding property in TurbineResources.properties. Adding a name/value pair may overwrite existing name=value pairs if the names match:

 ValueParser vp = new BaseValueParser();
 vp.add("ERROR",1);
 vp.add("eRrOr",2);
 int result = vp.getInt("ERROR");
 

In the above example, result is 2.
author:
   Ilkka Priha
author:
   Jon S. Stevens
author:
   Sean Legassick
author:
   Jason van Zyl
version:
   $Id: BaseValueParser.java,v 1.7 2004/11/18 02:03:27 lhamel Exp $



Field Summary
protected  Hashtableparameters
     Random access storage for parameter data.

Constructor Summary
public  BaseValueParser()
    
public  BaseValueParser(String newEncoding)
    

Method Summary
public  voidadd(String name, double value)
     Add a name/value pair into this object.
public  voidadd(String name, int value)
     Add a name/value pair into this object.
public  voidadd(String name, Integer value)
     Add a name/value pair into this object.
public  voidadd(String name, long value)
     Add a name/value pair into this object.
public  voidadd(String name, String value)
     Add a name/value pair into this object.
public  voidappend(String name, String value)
     Add a String parameters.
public  voidclear()
     Clear all name/value pairs out of this object.
public  booleancontainsKey(Object key)
     Determine whether a given key has been inserted.
public  Stringconvert(String value)
     Trims the string data and applies the conversion specified in the property given by URL_CASE_FOLDING.
public static  StringconvertAndTrim(String value)
     A static version of the convert method, which trims the string data and applies the conversion specified in the property given by URL_CASE_FOLDING.
public  voiddispose()
     Disposes the parser.
public  Stringget(String name)
     Return a String for the given name.
public  BigDecimalgetBigDecimal(String name, BigDecimal defaultValue)
     Return a BigDecimal for the given name.
public  BigDecimalgetBigDecimal(String name)
     Return a BigDecimal for the given name.
public  BigDecimal[]getBigDecimals(String name)
     Return an array of BigDecimals for the given name.
public  BooleangetBool(String name, boolean defaultValue)
     Return a Boolean for the given name.
public  BooleangetBool(String name)
     Return a Boolean for the given name.
public  booleangetBoolean(String name, boolean defaultValue)
     Return a boolean for the given name.
public  booleangetBoolean(String name)
     Return a boolean for the given name.
public  bytegetByte(String name, byte defaultValue)
     Return a byte for the given name.
public  bytegetByte(String name)
     Return a byte for the given name.
public  byte[]getBytes(String name)
     Return an array of bytes for the given name.
public  StringgetCharacterEncoding()
     Get the character encoding that will be used by this ValueParser.
public  doublegetDouble(String name, double defaultValue)
     Return a double for the given name.
public  doublegetDouble(String name)
     Return a double for the given name.
public  floatgetFloat(String name, float defaultValue)
     Return a float for the given name.
public  floatgetFloat(String name)
     Return a float for the given name.
public  intgetInt(String name, int defaultValue)
     Return an int for the given name.
public  intgetInt(String name)
     Return an int for the given name.
public  IntegergetInteger(String name, int defaultValue)
     Return an Integer for the given name.
public  IntegergetInteger(String name, Integer def)
     Return an Integer for the given name.
public  IntegergetInteger(String name)
     Return an Integer for the given name.
public  Integer[]getIntegers(String name)
     Return an array of Integers for the given name.
public  int[]getInts(String name)
     Return an array of ints for the given name.
public  Object[]getKeys()
    
public  longgetLong(String name, long defaultValue)
     Return a long for the given name.
public  longgetLong(String name)
     Return a long for the given name.
public  Long[]getLongObjects(String name)
     Return an array of Longs for the given name.
public  long[]getLongs(String name)
     Return an array of longs for the given name.
public  ObjectgetObject(String name)
     Return an Object for the given name.
public  Object[]getObjects(String name)
     Return an array of Objects for the given name.
public  StringgetString(String name)
     Return a String for the given name.
public  StringgetString(String name, String defaultValue)
     Return a String for the given name.
public  String[]getStrings(String name)
     Return an array of Strings for the given name.
public  String[]getStrings(String name, String[] defaultValue)
     Return an array of Strings for the given name.
public  Enumerationkeys()
    
public  Objectremove(String name)
     Removes the named parameter from the contained hashtable.
public  voidsetCharacterEncoding(String s)
     Set the character encoding that will be used by this ValueParser.
public  voidsetProperties(Object bean)
     Uses bean introspection to set writable properties of bean from the parameters, where a (case-insensitive) name match between the bean property and the parameter is looked for.
public  voidsetString(String name, String value)
     Set a parameter to a specific value.
public  voidsetStrings(String name, String[] values)
     Set a parameter to a specific value.
public  StringtoString()
     Simple method that attempts to get a toString() representation of this object.

Field Detail
parameters
protected Hashtable parameters(Code)
Random access storage for parameter data.




Constructor Detail
BaseValueParser
public BaseValueParser()(Code)
Default constructor



BaseValueParser
public BaseValueParser(String newEncoding)(Code)
Constructor that takes a character encoding




Method Detail
add
public void add(String name, double value)(Code)
Add a name/value pair into this object.
Parameters:
  name - A String with the name.
Parameters:
  value - A double with the value.



add
public void add(String name, int value)(Code)
Add a name/value pair into this object.
Parameters:
  name - A String with the name.
Parameters:
  value - An int with the value.



add
public void add(String name, Integer value)(Code)
Add a name/value pair into this object.
Parameters:
  name - A String with the name.
Parameters:
  value - An Integer with the value.



add
public void add(String name, long value)(Code)
Add a name/value pair into this object.
Parameters:
  name - A String with the name.
Parameters:
  value - A long with the value.



add
public void add(String name, String value)(Code)
Add a name/value pair into this object.
Parameters:
  name - A String with the name.
Parameters:
  value - A long with the value.



append
public void append(String name, String value)(Code)
Add a String parameters. If there are any Strings already associated with the name, append to the array. This is used for handling parameters from mulitipart POST requests.
Parameters:
  name - A String with the name.
Parameters:
  value - A String with the value.



clear
public void clear()(Code)
Clear all name/value pairs out of this object.



containsKey
public boolean containsKey(Object key)(Code)
Determine whether a given key has been inserted. All keys are stored in lowercase strings, so override method to account for this.
Parameters:
  key - An Object with the key to search for. True if the object is found.



convert
public String convert(String value)(Code)
Trims the string data and applies the conversion specified in the property given by URL_CASE_FOLDING. It returns a new string so that it does not destroy the value data.
Parameters:
  value - A String to be processed. A new String converted to lowercase and trimmed.



convertAndTrim
public static String convertAndTrim(String value)(Code)
A static version of the convert method, which trims the string data and applies the conversion specified in the property given by URL_CASE_FOLDING. It returns a new string so that it does not destroy the value data.
Parameters:
  value - A String to be processed. A new String converted to lowercase and trimmed.



dispose
public void dispose()(Code)
Disposes the parser.



get
public String get(String name)(Code)
Return a String for the given name. If the name does not exist, return null. It is the same as the getString() method however has been added for simplicity when working with template tools such as Velocity which allow you to do something like this:

$data.Parameters.form_variable_name
Parameters:
  name - A String with the name. A String.




getBigDecimal
public BigDecimal getBigDecimal(String name, BigDecimal defaultValue)(Code)
Return a BigDecimal for the given name. If the name does not exist, return 0.0.
Parameters:
  name - A String with the name.
Parameters:
  defaultValue - The default value. A BigDecimal.



getBigDecimal
public BigDecimal getBigDecimal(String name)(Code)
Return a BigDecimal for the given name. If the name does not exist, return 0.0.
Parameters:
  name - A String with the name. A BigDecimal.



getBigDecimals
public BigDecimal[] getBigDecimals(String name)(Code)
Return an array of BigDecimals for the given name. If the name does not exist, return null.
Parameters:
  name - A String with the name. A BigDecimal[].



getBool
public Boolean getBool(String name, boolean defaultValue)(Code)
Return a Boolean for the given name. If the name does not exist, return defaultValue.
Parameters:
  name - A String with the name.
Parameters:
  defaultValue - The default value. A Boolean.



getBool
public Boolean getBool(String name)(Code)
Return a Boolean for the given name. If the name does not exist, return false.
Parameters:
  name - A String with the name. A Boolean.



getBoolean
public boolean getBoolean(String name, boolean defaultValue)(Code)
Return a boolean for the given name. If the name does not exist, return defaultValue.
Parameters:
  name - A String with the name.
Parameters:
  defaultValue - The default value. A boolean.



getBoolean
public boolean getBoolean(String name)(Code)
Return a boolean for the given name. If the name does not exist, return false.
Parameters:
  name - A String with the name. A boolean.



getByte
public byte getByte(String name, byte defaultValue)(Code)
Return a byte for the given name. If the name does not exist, return defaultValue.
Parameters:
  name - A String with the name.
Parameters:
  defaultValue - The default value. A byte.



getByte
public byte getByte(String name)(Code)
Return a byte for the given name. If the name does not exist, return 0.
Parameters:
  name - A String with the name. A byte.



getBytes
public byte[] getBytes(String name) throws UnsupportedEncodingException(Code)
Return an array of bytes for the given name. If the name does not exist, return null. The array is returned according to the HttpRequest's character encoding.
Parameters:
  name - A String with the name. A byte[].



getCharacterEncoding
public String getCharacterEncoding()(Code)
Get the character encoding that will be used by this ValueParser.



getDouble
public double getDouble(String name, double defaultValue)(Code)
Return a double for the given name. If the name does not exist, return defaultValue.
Parameters:
  name - A String with the name.
Parameters:
  defaultValue - The default value. A double.



getDouble
public double getDouble(String name)(Code)
Return a double for the given name. If the name does not exist, return 0.0.
Parameters:
  name - A String with the name. A double.



getFloat
public float getFloat(String name, float defaultValue)(Code)
Return a float for the given name. If the name does not exist, return defaultValue.
Parameters:
  name - A String with the name.
Parameters:
  defaultValue - The default value. A float.



getFloat
public float getFloat(String name)(Code)
Return a float for the given name. If the name does not exist, return 0.0.
Parameters:
  name - A String with the name. A float.



getInt
public int getInt(String name, int defaultValue)(Code)
Return an int for the given name. If the name does not exist, return defaultValue.
Parameters:
  name - A String with the name.
Parameters:
  defaultValue - The default value. An int.



getInt
public int getInt(String name)(Code)
Return an int for the given name. If the name does not exist, return 0.
Parameters:
  name - A String with the name. An int.



getInteger
public Integer getInteger(String name, int defaultValue)(Code)
Return an Integer for the given name. If the name does not exist, return defaultValue.
Parameters:
  name - A String with the name.
Parameters:
  defaultValue - The default value. An Integer.



getInteger
public Integer getInteger(String name, Integer def)(Code)
Return an Integer for the given name. If the name does not exist, return defaultValue. You cannot pass in a null here for the default value.
Parameters:
  name - A String with the name.
Parameters:
  defaultValue - The default value. An Integer.



getInteger
public Integer getInteger(String name)(Code)
Return an Integer for the given name. If the name does not exist, return 0.
Parameters:
  name - A String with the name. An Integer.



getIntegers
public Integer[] getIntegers(String name)(Code)
Return an array of Integers for the given name. If the name does not exist, return null.
Parameters:
  name - A String with the name. An Integer[].



getInts
public int[] getInts(String name)(Code)
Return an array of ints for the given name. If the name does not exist, return null.
Parameters:
  name - A String with the name. An int[].



getKeys
public Object[] getKeys()(Code)



getLong
public long getLong(String name, long defaultValue)(Code)
Return a long for the given name. If the name does not exist, return defaultValue.
Parameters:
  name - A String with the name.
Parameters:
  defaultValue - The default value. A long.



getLong
public long getLong(String name)(Code)
Return a long for the given name. If the name does not exist, return 0.
Parameters:
  name - A String with the name. A long.



getLongObjects
public Long[] getLongObjects(String name)(Code)
Return an array of Longs for the given name. If the name does not exist, return null.
Parameters:
  name - A String with the name. A Long[].



getLongs
public long[] getLongs(String name)(Code)
Return an array of longs for the given name. If the name does not exist, return null.
Parameters:
  name - A String with the name. A long[].



getObject
public Object getObject(String name)(Code)
Return an Object for the given name. If the name does not exist, return null.
Parameters:
  name - A String with the name. An Object.



getObjects
public Object[] getObjects(String name)(Code)
Return an array of Objects for the given name. If the name does not exist, return null.
Parameters:
  name - A String with the name. An Object[].



getString
public String getString(String name)(Code)
Return a String for the given name. If the name does not exist, return null.
Parameters:
  name - A String with the name. A String.



getString
public String getString(String name, String defaultValue)(Code)
Return a String for the given name. If the name does not exist, return the defaultValue.
Parameters:
  name - A String with the name.
Parameters:
  defaultValue - The default value. A String.



getStrings
public String[] getStrings(String name)(Code)
Return an array of Strings for the given name. If the name does not exist, return null.
Parameters:
  name - A String with the name. A String[].



getStrings
public String[] getStrings(String name, String[] defaultValue)(Code)
Return an array of Strings for the given name. If the name does not exist, return the defaultValue.
Parameters:
  name - A String with the name.
Parameters:
  defaultValue - The default value. A String[].



keys
public Enumeration keys()(Code)



remove
public Object remove(String name)(Code)
Removes the named parameter from the contained hashtable. Wraps to the contained Hashtable.remove(). The value that was mapped to the key (a String[])or null if the key was not mapped.



setCharacterEncoding
public void setCharacterEncoding(String s)(Code)
Set the character encoding that will be used by this ValueParser.



setProperties
public void setProperties(Object bean) throws Exception(Code)
Uses bean introspection to set writable properties of bean from the parameters, where a (case-insensitive) name match between the bean property and the parameter is looked for.
Parameters:
  bean - An Object.
throws:
  Exception - , a generic exception.



setString
public void setString(String name, String value)(Code)
Set a parameter to a specific value.

This is useful if you want your action to override the values of the parameters for the screen to use.
Parameters:
  name - The name of the parameter.
Parameters:
  value - The value to set.




setStrings
public void setStrings(String name, String[] values)(Code)
Set a parameter to a specific value.

This is useful if you want your action to override the values of the parameters for the screen to use.
Parameters:
  name - The name of the parameter.
Parameters:
  values - The value to set.




toString
public String toString()(Code)
Simple method that attempts to get a toString() representation of this object. It doesn't do well with String[]'s though. A String.



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.