com.twelvemonkeys.util
Interface DuplicateHandler<T>


public interface DuplicateHandler<T>

DuplicateHandler

Version:
$Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/util/DuplicateHandler.java#2 $
Author:
Harald Kuhr

Field Summary
static DuplicateHandler<?> DUPLICATES_AS_ARRAY
          Converts duplicats to an Object array.
static DuplicateHandler<String> DUPLICATES_AS_CSV
          Converts duplicates to a comma-separated String.
static DuplicateHandler<?> USE_FIRST_VALUE
          Will use the first (old) value.
static DuplicateHandler<?> USE_LAST_VALUE
          Will use the last (new) value.
 
Method Summary
 T resolve(T pOld, T pNew)
          Resolves duplicates according to a certain strategy.
 

Field Detail

USE_FIRST_VALUE

static final DuplicateHandler<?> USE_FIRST_VALUE
Will use the first (old) value. Any new values will be discarded.

See Also:
CollectionUtil.invert(java.util.Map, java.util.Map, DuplicateHandler)

USE_LAST_VALUE

static final DuplicateHandler<?> USE_LAST_VALUE
Will use the last (new) value. Any old values will be discarded (overwritten).

See Also:
CollectionUtil.invert(java.util.Map, java.util.Map, DuplicateHandler)

DUPLICATES_AS_ARRAY

static final DuplicateHandler<?> DUPLICATES_AS_ARRAY
Converts duplicats to an Object array.

See Also:
CollectionUtil.invert(java.util.Map, java.util.Map, DuplicateHandler)

DUPLICATES_AS_CSV

static final DuplicateHandler<String> DUPLICATES_AS_CSV
Converts duplicates to a comma-separated String. Note that all values should allready be Strings if using this handler.

See Also:
CollectionUtil.invert(java.util.Map, java.util.Map, DuplicateHandler)
Method Detail

resolve

T resolve(T pOld,
          T pNew)
Resolves duplicates according to a certain strategy.

Parameters:
pOld - the old value
pNew - the new value
Returns:
the resolved value.
Throws:
IllegalArgumentException - is the arguments cannot be resolved for some reason.


Copyright © 2015. All Rights Reserved.