de.tsl2.nano.bean.def.ValueCompare Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tsl2.nano.descriptor Show documentation
Show all versions of tsl2.nano.descriptor Show documentation
TSL2 Framework Descriptor (currency-handling, generic formatter, descriptors for beans, collections, actions and values)
/*
* File: $HeadURL$
* Id : $Id$
*
* created by: Thomas Schneider
* created on: Mar 9, 2012
*
* Copyright: (c) Thomas Schneider 2012, all rights reserved
*/
package de.tsl2.nano.bean.def;
/**
* usable to compare bean values - perhaps on validation in {@link IAttributeDefinition}
* @author Thomas Schneider
* @version $Revision$
*/
public class ValueCompare> implements Comparable {
BeanValue value;
/**
* constructor
* @param value
*/
public ValueCompare(BeanValue value) {
super();
this.value = value;
}
@Override
public int compareTo(T o) {
if (o == null) {
return 1;
}
T v = value.getValue();
return v != null ? v.compareTo(o) : -1;
}
}