<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<!--NewPage--> | |
<HTML> | |
<HEAD> | |
<!-- Generated by javadoc (build 1.5.0_14) on Mon Apr 26 10:16:11 PDT 2010 --> | |
<TITLE> | |
ConversionUtils (VelocityTools 2.0 Documentation) | |
</TITLE> | |
<META NAME="keywords" CONTENT="org.apache.velocity.tools.ConversionUtils class"> | |
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> | |
<SCRIPT type="text/javascript"> | |
function windowTitle() | |
{ | |
parent.document.title="ConversionUtils (VelocityTools 2.0 Documentation)"; | |
} | |
</SCRIPT> | |
<NOSCRIPT> | |
</NOSCRIPT> | |
</HEAD> | |
<BODY BGCOLOR="white" onload="windowTitle();"> | |
<!-- ========= START OF TOP NAVBAR ======= --> | |
<A NAME="navbar_top"><!-- --></A> | |
<A HREF="#skip-navbar_top" title="Skip navigation links"></A> | |
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> | |
<TR> | |
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> | |
<A NAME="navbar_top_firstrow"><!-- --></A> | |
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> | |
<TR ALIGN="center" VALIGN="top"> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> | |
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> | |
</TR> | |
</TABLE> | |
</TD> | |
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> | |
</EM> | |
</TD> | |
</TR> | |
<TR> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../../org/apache/velocity/tools/ClassUtils.html" title="class in org.apache.velocity.tools"><B>PREV CLASS</B></A> | |
<A HREF="../../../../org/apache/velocity/tools/OldToolInfo.html" title="class in org.apache.velocity.tools"><B>NEXT CLASS</B></A></FONT></TD> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../../index.html?org/apache/velocity/tools/ConversionUtils.html" target="_top"><B>FRAMES</B></A> | |
<A HREF="ConversionUtils.html" target="_top"><B>NO FRAMES</B></A> | |
<SCRIPT type="text/javascript"> | |
<!-- | |
if(window==top) { | |
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); | |
} | |
//--> | |
</SCRIPT> | |
<NOSCRIPT> | |
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> | |
</NOSCRIPT> | |
</FONT></TD> | |
</TR> | |
<TR> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> | |
</TR> | |
</TABLE> | |
<A NAME="skip-navbar_top"></A> | |
<!-- ========= END OF TOP NAVBAR ========= --> | |
<HR> | |
<!-- ======== START OF CLASS DATA ======== --> | |
<H2> | |
<FONT SIZE="-1"> | |
org.apache.velocity.tools</FONT> | |
<BR> | |
Class ConversionUtils</H2> | |
<PRE> | |
java.lang.Object | |
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.velocity.tools.ConversionUtils</B> | |
</PRE> | |
<HR> | |
<DL> | |
<DT><PRE>public class <B>ConversionUtils</B><DT>extends java.lang.Object</DL> | |
</PRE> | |
<P> | |
Utility methods for parsing or otherwise converting between types. | |
Current supported types are Number, Date, Calendar, | |
String, Boolean, Locale and URL | |
<P> | |
<P> | |
<DL> | |
<DT><B>Author:</B></DT> | |
<DD>Nathan Bubna</DD> | |
</DL> | |
<HR> | |
<P> | |
<!-- =========== FIELD SUMMARY =========== --> | |
<A NAME="field_summary"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> | |
<B>Field Summary</B></FONT></TH> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static <A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html" title="class in org.apache.velocity.tools">ConversionUtils</A></CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#INSTANCE">INSTANCE</A></B></CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>private static int</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#STYLE_CURRENCY">STYLE_CURRENCY</A></B></CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>private static int</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#STYLE_INTEGER">STYLE_INTEGER</A></B></CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>private static int</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#STYLE_NUMBER">STYLE_NUMBER</A></B></CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>private static int</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#STYLE_PERCENT">STYLE_PERCENT</A></B></CODE> | |
<BR> | |
</TD> | |
</TR> | |
</TABLE> | |
| |
<!-- ======== CONSTRUCTOR SUMMARY ======== --> | |
<A NAME="constructor_summary"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> | |
<B>Constructor Summary</B></FONT></TH> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>private </CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#ConversionUtils()">ConversionUtils</A></B>()</CODE> | |
<BR> | |
</TD> | |
</TR> | |
</TABLE> | |
| |
<!-- ========== METHOD SUMMARY =========== --> | |
<A NAME="method_summary"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> | |
<B>Method Summary</B></FONT></TH> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.text.DateFormat</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#getDateFormat(int, int, java.util.Locale, java.util.TimeZone)">getDateFormat</A></B>(int dateStyle, | |
int timeStyle, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</CODE> | |
<BR> | |
Returns a <CODE>DateFormat</CODE> instance for the specified | |
time style, date style, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.text.DateFormat</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#getDateFormat(java.lang.String, java.util.Locale, java.util.TimeZone)">getDateFormat</A></B>(java.lang.String format, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</CODE> | |
<BR> | |
Returns a <CODE>DateFormat</CODE> instance for the specified | |
format, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.text.DateFormat</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#getDateFormat(java.lang.String, java.lang.String, java.util.Locale, java.util.TimeZone)">getDateFormat</A></B>(java.lang.String dateStyle, | |
java.lang.String timeStyle, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</CODE> | |
<BR> | |
Returns a <CODE>DateFormat</CODE> instance for the specified | |
date style, time style, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static int</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#getDateStyleAsInt(java.lang.String)">getDateStyleAsInt</A></B>(java.lang.String style)</CODE> | |
<BR> | |
Checks a string to see if it matches one of the standard DateFormat | |
style patterns: full, long, medium, short, or default.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE> <A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html" title="class in org.apache.velocity.tools">ConversionUtils</A></CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#getInstance()">getInstance</A></B>()</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.text.NumberFormat</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#getNumberFormat(int, java.util.Locale)">getNumberFormat</A></B>(int numberStyle, | |
java.util.Locale locale)</CODE> | |
<BR> | |
Returns a <CODE>NumberFormat</CODE> instance for the specified | |
number style and <CODE>Locale</CODE>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.text.NumberFormat</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#getNumberFormat(java.lang.String, java.util.Locale)">getNumberFormat</A></B>(java.lang.String format, | |
java.util.Locale locale)</CODE> | |
<BR> | |
Returns a <CODE>NumberFormat</CODE> instance for the specified | |
format and <CODE>Locale</CODE>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static int</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#getNumberStyleAsInt(java.lang.String)">getNumberStyleAsInt</A></B>(java.lang.String style)</CODE> | |
<BR> | |
Checks a string to see if it matches one of the standard | |
NumberFormat style patterns: | |
number, currency, percent, integer, or default.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.lang.Boolean</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toBoolean(java.lang.Object)">toBoolean</A></B>(java.lang.Object value)</CODE> | |
<BR> | |
Converts any Object to a boolean using <A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toString(java.lang.Object)"><CODE>toString(Object)</CODE></A> | |
and <CODE>Boolean.valueOf(String)</CODE>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.util.Calendar</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toCalendar(java.util.Date, java.util.Locale)">toCalendar</A></B>(java.util.Date date, | |
java.util.Locale locale)</CODE> | |
<BR> | |
</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.util.Date</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toDate(java.lang.Object)">toDate</A></B>(java.lang.Object obj)</CODE> | |
<BR> | |
Attempts to convert an unidentified <CODE>Object</CODE> into a <CODE>Date</CODE>, | |
just short of turning it into a string and parsing it.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.util.Date</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toDate(java.lang.Object, java.lang.String, java.util.Locale, java.util.TimeZone)">toDate</A></B>(java.lang.Object obj, | |
java.lang.String format, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</CODE> | |
<BR> | |
Converts an object to an instance of <CODE>Date</CODE> using the | |
specified format, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE> if the | |
object is not already an instance of Date, Calendar, or Long.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.util.Date</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toDate(java.lang.String, java.lang.String, java.util.Locale, java.util.TimeZone)">toDate</A></B>(java.lang.String str, | |
java.lang.String format, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</CODE> | |
<BR> | |
Converts an object to an instance of <CODE>Date</CODE> using the | |
specified format, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE> if the | |
object is not already an instance of Date, Calendar, or Long.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.util.Locale</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toLocale(java.lang.String)">toLocale</A></B>(java.lang.String value)</CODE> | |
<BR> | |
Converts a string to a <CODE>Locale</CODE></TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toNumber(java.lang.Object)">toNumber</A></B>(java.lang.Object obj)</CODE> | |
<BR> | |
Attempts to convert an unidentified <CODE>Object</CODE> into a <CODE>Number</CODE>, | |
just short of turning it into a string and parsing it.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toNumber(java.lang.Object, boolean)">toNumber</A></B>(java.lang.Object obj, | |
boolean handleStrings)</CODE> | |
<BR> | |
Just like <A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toNumber(java.lang.Object)"><CODE>toNumber(Object)</CODE></A> except that you can tell | |
this to attempt parsing the object as a String by passing <code>true</code> | |
as the second parameter.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toNumber(java.lang.Object, java.lang.String, java.util.Locale)">toNumber</A></B>(java.lang.Object value, | |
java.lang.String format, | |
java.util.Locale locale)</CODE> | |
<BR> | |
Converts an object to an instance of <CODE>Number</CODE> using the | |
specified format and <CODE>Locale</CODE> to parse it, if necessary.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.lang.Number</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toNumber(java.lang.String, java.lang.String, java.util.Locale)">toNumber</A></B>(java.lang.String value, | |
java.lang.String format, | |
java.util.Locale locale)</CODE> | |
<BR> | |
Converts a string to an instance of <CODE>Number</CODE> using the | |
specified format and <CODE>Locale</CODE> to parse it.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toString(java.util.Collection)">toString</A></B>(java.util.Collection values)</CODE> | |
<BR> | |
Returns the first value as a String, if any; otherwise returns null.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.lang.String</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toString(java.lang.Object)">toString</A></B>(java.lang.Object value)</CODE> | |
<BR> | |
Converts objects to String in a more Tools-ish way than | |
String.valueOf(Object), especially with nulls, Arrays and Collections.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.net.URL</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toURL(java.lang.String)">toURL</A></B>(java.lang.String value)</CODE> | |
<BR> | |
Converts a string to a <CODE>URL</CODE>.</TD> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
<CODE>static java.net.URL</CODE></FONT></TD> | |
<TD><CODE><B><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toURL(java.lang.String, java.lang.Object)">toURL</A></B>(java.lang.String value, | |
java.lang.Object caller)</CODE> | |
<BR> | |
Converts a string to a <CODE>URL</CODE>.</TD> | |
</TR> | |
</TABLE> | |
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> | |
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> | |
</TR> | |
<TR BGCOLOR="white" CLASS="TableRowColor"> | |
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> | |
</TR> | |
</TABLE> | |
| |
<P> | |
<!-- ============ FIELD DETAIL =========== --> | |
<A NAME="field_detail"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> | |
<B>Field Detail</B></FONT></TH> | |
</TR> | |
</TABLE> | |
<A NAME="INSTANCE"><!-- --></A><H3> | |
INSTANCE</H3> | |
<PRE> | |
public static final <A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html" title="class in org.apache.velocity.tools">ConversionUtils</A> <B>INSTANCE</B></PRE> | |
<DL> | |
<DL> | |
</DL> | |
</DL> | |
<HR> | |
<A NAME="STYLE_NUMBER"><!-- --></A><H3> | |
STYLE_NUMBER</H3> | |
<PRE> | |
private static final int <B>STYLE_NUMBER</B></PRE> | |
<DL> | |
<DL> | |
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#org.apache.velocity.tools.ConversionUtils.STYLE_NUMBER">Constant Field Values</A></DL> | |
</DL> | |
<HR> | |
<A NAME="STYLE_CURRENCY"><!-- --></A><H3> | |
STYLE_CURRENCY</H3> | |
<PRE> | |
private static final int <B>STYLE_CURRENCY</B></PRE> | |
<DL> | |
<DL> | |
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#org.apache.velocity.tools.ConversionUtils.STYLE_CURRENCY">Constant Field Values</A></DL> | |
</DL> | |
<HR> | |
<A NAME="STYLE_PERCENT"><!-- --></A><H3> | |
STYLE_PERCENT</H3> | |
<PRE> | |
private static final int <B>STYLE_PERCENT</B></PRE> | |
<DL> | |
<DL> | |
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#org.apache.velocity.tools.ConversionUtils.STYLE_PERCENT">Constant Field Values</A></DL> | |
</DL> | |
<HR> | |
<A NAME="STYLE_INTEGER"><!-- --></A><H3> | |
STYLE_INTEGER</H3> | |
<PRE> | |
private static final int <B>STYLE_INTEGER</B></PRE> | |
<DL> | |
<DL> | |
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#org.apache.velocity.tools.ConversionUtils.STYLE_INTEGER">Constant Field Values</A></DL> | |
</DL> | |
<!-- ========= CONSTRUCTOR DETAIL ======== --> | |
<A NAME="constructor_detail"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> | |
<B>Constructor Detail</B></FONT></TH> | |
</TR> | |
</TABLE> | |
<A NAME="ConversionUtils()"><!-- --></A><H3> | |
ConversionUtils</H3> | |
<PRE> | |
private <B>ConversionUtils</B>()</PRE> | |
<DL> | |
</DL> | |
<!-- ============ METHOD DETAIL ========== --> | |
<A NAME="method_detail"><!-- --></A> | |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> | |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> | |
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> | |
<B>Method Detail</B></FONT></TH> | |
</TR> | |
</TABLE> | |
<A NAME="getInstance()"><!-- --></A><H3> | |
getInstance</H3> | |
<PRE> | |
public <A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html" title="class in org.apache.velocity.tools">ConversionUtils</A> <B>getInstance</B>()</PRE> | |
<DL> | |
<DD><DL> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getNumberFormat(java.lang.String, java.util.Locale)"><!-- --></A><H3> | |
getNumberFormat</H3> | |
<PRE> | |
public static java.text.NumberFormat <B>getNumberFormat</B>(java.lang.String format, | |
java.util.Locale locale)</PRE> | |
<DL> | |
<DD>Returns a <CODE>NumberFormat</CODE> instance for the specified | |
format and <CODE>Locale</CODE>. If the format specified is a standard | |
style pattern, then a number instance | |
will be returned with the number style set to the | |
specified style. If it is a custom format, then a customized | |
<CODE>NumberFormat</CODE> will be returned. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>format</CODE> - the custom or standard formatting pattern to be used<DD><CODE>locale</CODE> - the <CODE>Locale</CODE> to be used | |
<DT><B>Returns:</B><DD>an instance of <CODE>NumberFormat</CODE><DT><B>See Also:</B><DD><CODE>NumberFormat</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getNumberFormat(int, java.util.Locale)"><!-- --></A><H3> | |
getNumberFormat</H3> | |
<PRE> | |
public static java.text.NumberFormat <B>getNumberFormat</B>(int numberStyle, | |
java.util.Locale locale)</PRE> | |
<DL> | |
<DD>Returns a <CODE>NumberFormat</CODE> instance for the specified | |
number style and <CODE>Locale</CODE>. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>numberStyle</CODE> - the number style (number will be ignored if this is | |
less than zero or the number style is not recognized)<DD><CODE>locale</CODE> - the <CODE>Locale</CODE> to be used | |
<DT><B>Returns:</B><DD>an instance of <CODE>NumberFormat</CODE> or <code>null</code> | |
if an instance cannot be constructed with the given | |
parameters</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getNumberStyleAsInt(java.lang.String)"><!-- --></A><H3> | |
getNumberStyleAsInt</H3> | |
<PRE> | |
public static int <B>getNumberStyleAsInt</B>(java.lang.String style)</PRE> | |
<DL> | |
<DD>Checks a string to see if it matches one of the standard | |
NumberFormat style patterns: | |
number, currency, percent, integer, or default. | |
if it does it will return the integer constant for that pattern. | |
if not, it will return -1. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>style</CODE> - the string to be checked | |
<DT><B>Returns:</B><DD>the int identifying the style pattern<DT><B>See Also:</B><DD><CODE>NumberFormat</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toNumber(java.lang.Object)"><!-- --></A><H3> | |
toNumber</H3> | |
<PRE> | |
public static java.lang.Number <B>toNumber</B>(java.lang.Object obj)</PRE> | |
<DL> | |
<DD>Attempts to convert an unidentified <CODE>Object</CODE> into a <CODE>Number</CODE>, | |
just short of turning it into a string and parsing it. In other words, | |
this will convert to <CODE>Number</CODE> from a <CODE>Number</CODE>, <CODE>Calendar</CODE>, | |
or <CODE>Date</CODE>. If it can't do that, it will get the string value and have | |
<A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toNumber(java.lang.String, java.lang.String, java.util.Locale)"><CODE>toNumber(String,String,Locale)</CODE></A> try to parse it using the | |
default Locale and format. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>obj</CODE> - - the object to convert</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toNumber(java.lang.Object, boolean)"><!-- --></A><H3> | |
toNumber</H3> | |
<PRE> | |
public static java.lang.Number <B>toNumber</B>(java.lang.Object obj, | |
boolean handleStrings)</PRE> | |
<DL> | |
<DD>Just like <A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toNumber(java.lang.Object)"><CODE>toNumber(Object)</CODE></A> except that you can tell | |
this to attempt parsing the object as a String by passing <code>true</code> | |
as the second parameter. If you do so, then it will have | |
<A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toNumber(java.lang.String, java.lang.String, java.util.Locale)"><CODE>toNumber(String,String,Locale)</CODE></A> try to parse it using the | |
default Locale and format. | |
<P> | |
<DD><DL> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toNumber(java.lang.String, java.lang.String, java.util.Locale)"><!-- --></A><H3> | |
toNumber</H3> | |
<PRE> | |
public static java.lang.Number <B>toNumber</B>(java.lang.String value, | |
java.lang.String format, | |
java.util.Locale locale)</PRE> | |
<DL> | |
<DD>Converts a string to an instance of <CODE>Number</CODE> using the | |
specified format and <CODE>Locale</CODE> to parse it. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>value</CODE> - - the string to convert<DD><CODE>format</CODE> - - the format the number is in<DD><CODE>locale</CODE> - - the <CODE>Locale</CODE> | |
<DT><B>Returns:</B><DD>the string as a <CODE>Number</CODE> or <code>null</code> if no | |
conversion is possible<DT><B>See Also:</B><DD><CODE>NumberFormat.parse(java.lang.String, java.text.ParsePosition)</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toNumber(java.lang.Object, java.lang.String, java.util.Locale)"><!-- --></A><H3> | |
toNumber</H3> | |
<PRE> | |
public static java.lang.Number <B>toNumber</B>(java.lang.Object value, | |
java.lang.String format, | |
java.util.Locale locale)</PRE> | |
<DL> | |
<DD>Converts an object to an instance of <CODE>Number</CODE> using the | |
specified format and <CODE>Locale</CODE> to parse it, if necessary. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>value</CODE> - - the object to convert<DD><CODE>format</CODE> - - the format the number is in<DD><CODE>locale</CODE> - - the <CODE>Locale</CODE> | |
<DT><B>Returns:</B><DD>the object as a <CODE>Number</CODE> or <code>null</code> if no | |
conversion is possible<DT><B>See Also:</B><DD><CODE>NumberFormat.parse(java.lang.String, java.text.ParsePosition)</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getDateFormat(java.lang.String, java.util.Locale, java.util.TimeZone)"><!-- --></A><H3> | |
getDateFormat</H3> | |
<PRE> | |
public static java.text.DateFormat <B>getDateFormat</B>(java.lang.String format, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</PRE> | |
<DL> | |
<DD>Returns a <CODE>DateFormat</CODE> instance for the specified | |
format, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE>. If the format | |
specified is a standard style pattern, then a date-time instance | |
will be returned with both the date and time styles set to the | |
specified style. If it is a custom format, then a customized | |
<CODE>SimpleDateFormat</CODE> will be returned. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>format</CODE> - the custom or standard formatting pattern to be used<DD><CODE>locale</CODE> - the <CODE>Locale</CODE> to be used<DD><CODE>timezone</CODE> - the <CODE>TimeZone</CODE> to be used | |
<DT><B>Returns:</B><DD>an instance of <CODE>DateFormat</CODE><DT><B>See Also:</B><DD><CODE>SimpleDateFormat</CODE>, | |
<CODE>DateFormat</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getDateFormat(java.lang.String, java.lang.String, java.util.Locale, java.util.TimeZone)"><!-- --></A><H3> | |
getDateFormat</H3> | |
<PRE> | |
public static java.text.DateFormat <B>getDateFormat</B>(java.lang.String dateStyle, | |
java.lang.String timeStyle, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</PRE> | |
<DL> | |
<DD>Returns a <CODE>DateFormat</CODE> instance for the specified | |
date style, time style, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE>. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>dateStyle</CODE> - the date style<DD><CODE>timeStyle</CODE> - the time style<DD><CODE>locale</CODE> - the <CODE>Locale</CODE> to be used<DD><CODE>timezone</CODE> - the <CODE>TimeZone</CODE> to be used | |
<DT><B>Returns:</B><DD>an instance of <CODE>DateFormat</CODE><DT><B>See Also:</B><DD><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#getDateFormat(int, int, java.util.Locale, java.util.TimeZone)"><CODE>getDateFormat(int timeStyle, int dateStyle, Locale locale, TimeZone timezone)</CODE></A></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getDateFormat(int, int, java.util.Locale, java.util.TimeZone)"><!-- --></A><H3> | |
getDateFormat</H3> | |
<PRE> | |
public static java.text.DateFormat <B>getDateFormat</B>(int dateStyle, | |
int timeStyle, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</PRE> | |
<DL> | |
<DD>Returns a <CODE>DateFormat</CODE> instance for the specified | |
time style, date style, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE>. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>dateStyle</CODE> - the date style (date will be ignored if this is | |
less than zero and the date style is not)<DD><CODE>timeStyle</CODE> - the time style (time will be ignored if this is | |
less than zero and the date style is not)<DD><CODE>locale</CODE> - the <CODE>Locale</CODE> to be used<DD><CODE>timezone</CODE> - the <CODE>TimeZone</CODE> to be used | |
<DT><B>Returns:</B><DD>an instance of <CODE>DateFormat</CODE> or <code>null</code> | |
if an instance cannot be constructed with the given | |
parameters</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="getDateStyleAsInt(java.lang.String)"><!-- --></A><H3> | |
getDateStyleAsInt</H3> | |
<PRE> | |
public static int <B>getDateStyleAsInt</B>(java.lang.String style)</PRE> | |
<DL> | |
<DD>Checks a string to see if it matches one of the standard DateFormat | |
style patterns: full, long, medium, short, or default. If it does, | |
it will return the integer constant for that pattern. If not, it | |
will return -1. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>style</CODE> - the string to be checked | |
<DT><B>Returns:</B><DD>the int identifying the style pattern<DT><B>See Also:</B><DD><CODE>DateFormat</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toDate(java.lang.Object)"><!-- --></A><H3> | |
toDate</H3> | |
<PRE> | |
public static java.util.Date <B>toDate</B>(java.lang.Object obj)</PRE> | |
<DL> | |
<DD>Attempts to convert an unidentified <CODE>Object</CODE> into a <CODE>Date</CODE>, | |
just short of turning it into a string and parsing it. In other words, | |
this will convert to <CODE>Date</CODE> from a <CODE>Date</CODE>, <CODE>Calendar</CODE>, | |
or <CODE>Number</CODE>. If it can't do that, it will return <code>null</code>. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>obj</CODE> - - the object to convert</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toDate(java.lang.Object, java.lang.String, java.util.Locale, java.util.TimeZone)"><!-- --></A><H3> | |
toDate</H3> | |
<PRE> | |
public static java.util.Date <B>toDate</B>(java.lang.Object obj, | |
java.lang.String format, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</PRE> | |
<DL> | |
<DD>Converts an object to an instance of <CODE>Date</CODE> using the | |
specified format, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE> if the | |
object is not already an instance of Date, Calendar, or Long. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>obj</CODE> - - the date to convert<DD><CODE>format</CODE> - - the format the date is in<DD><CODE>locale</CODE> - - the <CODE>Locale</CODE><DD><CODE>timezone</CODE> - - the <CODE>TimeZone</CODE> | |
<DT><B>Returns:</B><DD>the object as a <CODE>Date</CODE> or <code>null</code> if no | |
conversion is possible<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#getDateFormat(java.lang.String, java.util.Locale, java.util.TimeZone)"><CODE>getDateFormat(java.lang.String, java.util.Locale, java.util.TimeZone)</CODE></A>, | |
<CODE>SimpleDateFormat.parse(java.lang.String, java.text.ParsePosition)</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toDate(java.lang.String, java.lang.String, java.util.Locale, java.util.TimeZone)"><!-- --></A><H3> | |
toDate</H3> | |
<PRE> | |
public static java.util.Date <B>toDate</B>(java.lang.String str, | |
java.lang.String format, | |
java.util.Locale locale, | |
java.util.TimeZone timezone)</PRE> | |
<DL> | |
<DD>Converts an object to an instance of <CODE>Date</CODE> using the | |
specified format, <CODE>Locale</CODE>, and <CODE>TimeZone</CODE> if the | |
object is not already an instance of Date, Calendar, or Long. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>str</CODE> - - the string to parse<DD><CODE>format</CODE> - - the format the date is in<DD><CODE>locale</CODE> - - the <CODE>Locale</CODE><DD><CODE>timezone</CODE> - - the <CODE>TimeZone</CODE> | |
<DT><B>Returns:</B><DD>the string as a <CODE>Date</CODE> or <code>null</code> if the | |
parsing fails<DT><B>See Also:</B><DD><A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#getDateFormat(java.lang.String, java.util.Locale, java.util.TimeZone)"><CODE>getDateFormat(java.lang.String, java.util.Locale, java.util.TimeZone)</CODE></A>, | |
<CODE>SimpleDateFormat.parse(java.lang.String, java.text.ParsePosition)</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toCalendar(java.util.Date, java.util.Locale)"><!-- --></A><H3> | |
toCalendar</H3> | |
<PRE> | |
public static java.util.Calendar <B>toCalendar</B>(java.util.Date date, | |
java.util.Locale locale)</PRE> | |
<DL> | |
<DD><DL> | |
</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toString(java.lang.Object)"><!-- --></A><H3> | |
toString</H3> | |
<PRE> | |
public static java.lang.String <B>toString</B>(java.lang.Object value)</PRE> | |
<DL> | |
<DD>Converts objects to String in a more Tools-ish way than | |
String.valueOf(Object), especially with nulls, Arrays and Collections. | |
Null returns null, Arrays and Collections return their first value, | |
or null if they have no values. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>value</CODE> - the object to be turned into a String | |
<DT><B>Returns:</B><DD>the string value of the object or null if the value is null | |
or it is an array whose first value is null</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toString(java.util.Collection)"><!-- --></A><H3> | |
toString</H3> | |
<PRE> | |
public static java.lang.String <B>toString</B>(java.util.Collection values)</PRE> | |
<DL> | |
<DD>Returns the first value as a String, if any; otherwise returns null. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>values</CODE> - the Collection to be turned into a string | |
<DT><B>Returns:</B><DD>the string value of the first object in the collection | |
or null if the collection is empty</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toBoolean(java.lang.Object)"><!-- --></A><H3> | |
toBoolean</H3> | |
<PRE> | |
public static java.lang.Boolean <B>toBoolean</B>(java.lang.Object value)</PRE> | |
<DL> | |
<DD>Converts any Object to a boolean using <A HREF="../../../../org/apache/velocity/tools/ConversionUtils.html#toString(java.lang.Object)"><CODE>toString(Object)</CODE></A> | |
and <CODE>Boolean.valueOf(String)</CODE>. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>value</CODE> - the object to be converted | |
<DT><B>Returns:</B><DD>a <CODE>Boolean</CODE> object for the specified value or | |
<code>null</code> if the value is null or the conversion failed</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toLocale(java.lang.String)"><!-- --></A><H3> | |
toLocale</H3> | |
<PRE> | |
public static java.util.Locale <B>toLocale</B>(java.lang.String value)</PRE> | |
<DL> | |
<DD>Converts a string to a <CODE>Locale</CODE> | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>value</CODE> - - the string to parse | |
<DT><B>Returns:</B><DD>the <CODE>Locale</CODE> or <code>null</code> if the | |
parsing fails</DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toURL(java.lang.String)"><!-- --></A><H3> | |
toURL</H3> | |
<PRE> | |
public static java.net.URL <B>toURL</B>(java.lang.String value)</PRE> | |
<DL> | |
<DD>Converts a string to a <CODE>URL</CODE>. It will first try to | |
treat the string as a File name, then a classpath resource, | |
then finally as a literal URL. If none of these work, then | |
this will return <code>null</code>. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>value</CODE> - - the string to parse | |
<DT><B>Returns:</B><DD>the <CODE>URL</CODE> form of the string or <code>null</code><DT><B>See Also:</B><DD><CODE>File</CODE>, | |
<A HREF="../../../../org/apache/velocity/tools/ClassUtils.html#getResource(java.lang.String, java.lang.Object)"><CODE>ClassUtils.getResource(String,Object)</CODE></A>, | |
<CODE>URL</CODE></DL> | |
</DD> | |
</DL> | |
<HR> | |
<A NAME="toURL(java.lang.String, java.lang.Object)"><!-- --></A><H3> | |
toURL</H3> | |
<PRE> | |
public static java.net.URL <B>toURL</B>(java.lang.String value, | |
java.lang.Object caller)</PRE> | |
<DL> | |
<DD>Converts a string to a <CODE>URL</CODE>. It will first try to | |
treat the string as a File name, then a classpath resource, | |
then finally as a literal URL. If none of these work, then | |
this will return <code>null</code>. | |
<P> | |
<DD><DL> | |
<DT><B>Parameters:</B><DD><CODE>value</CODE> - - the string to parse<DD><CODE>caller</CODE> - - the object or Class seeking the url | |
<DT><B>Returns:</B><DD>the <CODE>URL</CODE> form of the string or <code>null</code><DT><B>See Also:</B><DD><CODE>File</CODE>, | |
<A HREF="../../../../org/apache/velocity/tools/ClassUtils.html#getResource(java.lang.String, java.lang.Object)"><CODE>ClassUtils.getResource(String,Object)</CODE></A>, | |
<CODE>URL</CODE></DL> | |
</DD> | |
</DL> | |
<!-- ========= END OF CLASS DATA ========= --> | |
<HR> | |
<!-- ======= START OF BOTTOM NAVBAR ====== --> | |
<A NAME="navbar_bottom"><!-- --></A> | |
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> | |
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> | |
<TR> | |
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> | |
<A NAME="navbar_bottom_firstrow"><!-- --></A> | |
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> | |
<TR ALIGN="center" VALIGN="top"> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> | |
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> | |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> | |
</TR> | |
</TABLE> | |
</TD> | |
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> | |
</EM> | |
</TD> | |
</TR> | |
<TR> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../../org/apache/velocity/tools/ClassUtils.html" title="class in org.apache.velocity.tools"><B>PREV CLASS</B></A> | |
<A HREF="../../../../org/apache/velocity/tools/OldToolInfo.html" title="class in org.apache.velocity.tools"><B>NEXT CLASS</B></A></FONT></TD> | |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
<A HREF="../../../../index.html?org/apache/velocity/tools/ConversionUtils.html" target="_top"><B>FRAMES</B></A> | |
<A HREF="ConversionUtils.html" target="_top"><B>NO FRAMES</B></A> | |
<SCRIPT type="text/javascript"> | |
<!-- | |
if(window==top) { | |
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); | |
} | |
//--> | |
</SCRIPT> | |
<NOSCRIPT> | |
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> | |
</NOSCRIPT> | |
</FONT></TD> | |
</TR> | |
<TR> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> | |
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> | |
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> | |
</TR> | |
</TABLE> | |
<A NAME="skip-navbar_bottom"></A> | |
<!-- ======== END OF BOTTOM NAVBAR ======= --> | |
<HR> | |
Copyright (c) 2003-2007 Apache Software Foundation | |
</BODY> | |
</HTML> |