All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.tsl2.nano.bean.def.ValueCompare Maven / Gradle / Ivy

Go to download

TSL2 Framework Descriptor (currency-handling, generic formatter, descriptors for beans, collections, actions and values)

There is a newer version: 2.5.1
Show newest version
/*
 * 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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy