org.progeeks.meta.format
Class UrlQueryFormat

java.lang.Object
  extended by org.progeeks.meta.format.AbstractPropertyFormat
      extended by org.progeeks.meta.format.UrlQueryFormat
All Implemented Interfaces:
PropertyFormat

public class UrlQueryFormat
extends AbstractPropertyFormat

This formatter will return a format in the pattern of: propName=propValue&prop2Name=prop2Value as typically used in queries. An optional operation to URLEncode the values may be specified. Default is false A separator string for separating the pairs in the format may also be specified. Default value is '&': name1=value1&name2=value2 An optional baseUrl property may also be defined and will be prepended to the formatted value.

Version:
$Revision: 1.6 $
Author:
Dave Garvis

Field Summary
static java.lang.String DEFAULT_SEPARATOR
           
 
Constructor Summary
UrlQueryFormat()
          Default constructor.
UrlQueryFormat(java.lang.String baseUrl, java.util.List propNames)
           
UrlQueryFormat(java.lang.String baseUrl, java.util.List propNames, java.lang.String separator)
           
UrlQueryFormat(java.lang.String baseUrl, java.util.List propNames, java.lang.String separator, boolean urlEncode)
          Constructor in which all config params may be specified.
 
Method Summary
 java.lang.String format(java.lang.Object obj)
          Returns the formatted String for the specified Object, null if the Object cannot be formatted or if any errors occur.
 java.lang.String getBaseUrl()
           
 java.lang.String getPairSeparator()
          Convenience getter for the pairSeparator pair.
 java.util.List getPropertyNames()
           
 boolean isUrlEncoding()
           
 java.lang.Object parseObject(java.lang.String source, int index)
          Parsing is not supported.
 void setBaseUrl(java.lang.String baseUrl)
           
 void setPairSeparator(java.lang.String pairSeparator)
          Convenience setter for the pairSeparator pair.
 void setPropertyNames(java.util.List propNames)
          Convenience setter for the property names list
 void setUrlEncoding(boolean urlEncode)
          Convenience setter for the urlEncode flag.
 java.lang.String toString()
          String summary.
 
Methods inherited from class org.progeeks.meta.format.AbstractPropertyFormat
format, parseObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_SEPARATOR

public static final java.lang.String DEFAULT_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

UrlQueryFormat

public UrlQueryFormat()
Default constructor. Constructs the formatter with defaults as explained in the class description.


UrlQueryFormat

public UrlQueryFormat(java.lang.String baseUrl,
                      java.util.List propNames)

UrlQueryFormat

public UrlQueryFormat(java.lang.String baseUrl,
                      java.util.List propNames,
                      java.lang.String separator)

UrlQueryFormat

public UrlQueryFormat(java.lang.String baseUrl,
                      java.util.List propNames,
                      java.lang.String separator,
                      boolean urlEncode)
Constructor in which all config params may be specified.

Method Detail

setPropertyNames

public void setPropertyNames(java.util.List propNames)
Convenience setter for the property names list


getPropertyNames

public java.util.List getPropertyNames()

setUrlEncoding

public void setUrlEncoding(boolean urlEncode)
Convenience setter for the urlEncode flag.


isUrlEncoding

public boolean isUrlEncoding()

setPairSeparator

public void setPairSeparator(java.lang.String pairSeparator)
Convenience setter for the pairSeparator pair.


getPairSeparator

public java.lang.String getPairSeparator()
Convenience getter for the pairSeparator pair.


setBaseUrl

public void setBaseUrl(java.lang.String baseUrl)

getBaseUrl

public java.lang.String getBaseUrl()

format

public java.lang.String format(java.lang.Object obj)
Returns the formatted String for the specified Object, null if the Object cannot be formatted or if any errors occur.

Specified by:
format in interface PropertyFormat
Specified by:
format in class AbstractPropertyFormat

parseObject

public java.lang.Object parseObject(java.lang.String source,
                                    int index)
Parsing is not supported.

Specified by:
parseObject in interface PropertyFormat
Specified by:
parseObject in class AbstractPropertyFormat

toString

public java.lang.String toString()
String summary.

Overrides:
toString in class java.lang.Object


Copyright © 2002-2003 Paul Speed. All Rights Reserved.