com.niggle.data
Class DataUtil

java.lang.Object
  |
  +--com.niggle.data.DataUtil

public abstract class DataUtil
extends java.lang.Object

a holder for various useful static routines dealing with niggle data

Author:
Jonathan Revusky

Constructor Summary
DataUtil()
           
 
Method Summary
static void copyFieldsByName(Record source, Record dest)
          convenience routine for transitioning records.
static void fillRecordFromServletRequest(Record record, javax.servlet.ServletRequest request)
          Given a ServletRequest and a record, attempts to fill in the record's fields.
static Record fromString(java.lang.String s)
          convenience routine to convert a string to a Record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataUtil

public DataUtil()
Method Detail

fillRecordFromServletRequest

public static void fillRecordFromServletRequest(Record record,
                                                javax.servlet.ServletRequest request)
                                         throws java.io.IOException
Given a ServletRequest and a record, attempts to fill in the record's fields. requires that the record is mutable Generic heuristics for filling in a data record based on key=value pairs in a ServletRequest object. In practice, this method may not be enough and you may need to write some custom code to fill in your records from a servlet request. Nonetheless, this method provides a good starting point.
Parameters:
record - the record to fill in.
request - the servlet request that provides the param=value pairs.

copyFieldsByName

public static void copyFieldsByName(Record source,
                                    Record dest)
convenience routine for transitioning records. Copies all the fields in source to dest, where dest has a field of the same name.

fromString

public static Record fromString(java.lang.String s)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
convenience routine to convert a string to a Record. Is essentially the reverse operation of: DefaultRecord.toString()