hu.midori.kosmos.model
Class ModelUtils

java.lang.Object
  extended by hu.midori.kosmos.model.ModelUtils

public class ModelUtils
extends java.lang.Object

Utility methods for the domain model classes.

Version:
$Id$
Author:
Aron Gombas

Field Summary
static long MILLIS_PER_DAY
          Millis in one day.
static long MILLIS_PER_HOUR
          Millis in one hour.
static long MILLIS_PER_MONTH
          Millis in one month (31 days).
static long MILLIS_PER_WEEK
          Millis in one week.
 
Constructor Summary
protected ModelUtils()
          This class should never be instantiated.
 
Method Summary
static Identified findInCollection(java.util.Collection<? extends Identified> items, int id)
          Returns the Identified object from a collection by using a simple linear search, or null if not found.
static Identified findInCollection(java.util.Collection<? extends Identified> items, java.lang.String id)
          Returns the Identified object from a collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MILLIS_PER_HOUR

public static final long MILLIS_PER_HOUR
Millis in one hour.

See Also:
Constant Field Values

MILLIS_PER_DAY

public static final long MILLIS_PER_DAY
Millis in one day.

See Also:
Constant Field Values

MILLIS_PER_WEEK

public static final long MILLIS_PER_WEEK
Millis in one week.

See Also:
Constant Field Values

MILLIS_PER_MONTH

public static final long MILLIS_PER_MONTH
Millis in one month (31 days).

See Also:
Constant Field Values
Constructor Detail

ModelUtils

protected ModelUtils()
This class should never be instantiated.

Method Detail

findInCollection

public static Identified findInCollection(java.util.Collection<? extends Identified> items,
                                          int id)
Returns the Identified object from a collection by using a simple linear search, or null if not found.


findInCollection

public static Identified findInCollection(java.util.Collection<? extends Identified> items,
                                          java.lang.String id)
Returns the Identified object from a collection. It receives the ID as String, so can be passed from request params directly.

See Also:
findInCollection(Collection, int)