com.acsinet_solutions.cetia4.data
Class DTOUtils

java.lang.Object
  extended by com.acsinet_solutions.cetia4.data.DTOUtils

public final class DTOUtils
extends java.lang.Object

Utilities for DTOs

(c) 2004 ACSINET S.A. de C.V. Derechos Reservados

Author:
Santiago Arriaga

Constructor Summary
DTOUtils()
           
 
Method Summary
static
<T extends IntKeyDTO>
java.util.Map<java.lang.Integer,T>
asSequencedMap(java.util.Collection<T> collection)
          Convert the SimpleKeyDTO list to a sequenced map
static
<T extends IntKeyDTO>
java.util.SortedMap<java.lang.Integer,T>
asSortedMap(java.util.Collection<T> collection)
          Convert the SimpleKeyDTO list to a sorted map
static void checkVersion(long providedVersion, long expectedVersion)
          Simple method that provides version checking
static IntKeyDTO getInstance(java.lang.Class c, java.lang.Integer id)
          Get a SimpleKeyDTO instance for the given class name and key value
static
<T extends IntKeyDTO>
void
removeRepeated(java.util.List<T> list)
          Remove the repeated SimpleKeyDTO elements in the given list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DTOUtils

public DTOUtils()
Method Detail

asSortedMap

public static <T extends IntKeyDTO> java.util.SortedMap<java.lang.Integer,T> asSortedMap(java.util.Collection<T> collection)
Convert the SimpleKeyDTO list to a sorted map

Parameters:
list - A list of not-null AreaDTO instances
Returns:
A not-null not-empty Map of not-null Integer keys and not-null SimpleKeyDTO values.

asSequencedMap

public static <T extends IntKeyDTO> java.util.Map<java.lang.Integer,T> asSequencedMap(java.util.Collection<T> collection)
Convert the SimpleKeyDTO list to a sequenced map

Parameters:
list - A list of not-null SimpleKeyDTO instances
Returns:
A not-null not-empty Map of not-null Integer keys and not-null SimpleKeyDTO values.

removeRepeated

public static <T extends IntKeyDTO> void removeRepeated(java.util.List<T> list)
Remove the repeated SimpleKeyDTO elements in the given list


getInstance

public static IntKeyDTO getInstance(java.lang.Class c,
                                    java.lang.Integer id)
Get a SimpleKeyDTO instance for the given class name and key value

Parameters:
c - A not-null valid Class that implements SimpleKeyDTO
id - An id value that will be assigned to the newly created instance before returning

checkVersion

public static void checkVersion(long providedVersion,
                                long expectedVersion)
                         throws VersionMismatchException
Simple method that provides version checking

Throws:
VersionMismatchException