com.lonniepryor.blues.xml
Class ValueResolver

java.lang.Object
  |
  +--com.lonniepryor.blues.xml.ValueResolver

public class ValueResolver
extends java.lang.Object

Transforms the values of attributes in an XML document into JavaBean property values. NOTE: this class is NOT thread-safe and instances may only be used on a single thread at a time.

Version:
$Revision: 1.1 $
Author:
Lonnie Pryor

Constructor Summary
ValueResolver(java.lang.ClassLoader classLoader, java.lang.String relativePathBase, java.lang.String imports)
          Creates a new ValueResolver object.
 
Method Summary
 java.lang.Object resolve(java.lang.Class toType, java.lang.String stringValue)
          Transforms the supplied string value into the specified type.
 java.lang.Class resolveClass(java.lang.String name)
          Resolves the supplied class name into a Class instance, searching this resolver's import statements for the approprite fully-qualified name.
 java.lang.String resolvePath(java.lang.String path)
          Resolves the supplied path into an absoulte path, prepending the relative path base if the resource name does not begin with a '/'.
 java.net.URL resolveResource(java.lang.String name)
          Resolves the supplied resource name path and loads the requested resource from the class loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueResolver

public ValueResolver(java.lang.ClassLoader classLoader,
                     java.lang.String relativePathBase,
                     java.lang.String imports)
Creates a new ValueResolver object.

Parameters:
classLoader - The ClassLoader to load classes from.
relativePathBase - The relative path base to resolve Resource paths against.
imports - A whitespace-delimeted sequence of Java import statements (minus the 'import' keyword and line-ending semi-colon).
Method Detail

resolvePath

public java.lang.String resolvePath(java.lang.String path)
Resolves the supplied path into an absoulte path, prepending the relative path base if the resource name does not begin with a '/'.

Parameters:
path - The path to resolve.
Returns:
The supplied path resolved into an absoulte path.

resolveResource

public java.net.URL resolveResource(java.lang.String name)
Resolves the supplied resource name path and loads the requested resource from the class loader.

Parameters:
name - The name of the resource to load.
Returns:
The URL of the resource or null if it is not found.

resolveClass

public java.lang.Class resolveClass(java.lang.String name)
Resolves the supplied class name into a Class instance, searching this resolver's import statements for the approprite fully-qualified name.

Parameters:
name - The name of the class to load.
Returns:
The requested class or null if it is not found.

resolve

public java.lang.Object resolve(java.lang.Class toType,
                                java.lang.String stringValue)
Transforms the supplied string value into the specified type.

Parameters:
toType - The type to transform to.
stringValue - The string value to transform.
Returns:
The transformed property value.


Copyright © 2003 Blues Framework. All Rights Reserved.