
fr.landel.utils.model.AbstractModelOverComparable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of utils-model Show documentation
Show all versions of utils-model Show documentation
Model utils (Entity, DTO, Query, Native SQL, Dialect)
The newest version!
/*
* #%L
* utils-model
* %%
* Copyright (C) 2016 Gilandel
* %%
* Authors: Gilles Landel
* URL: https://github.com/Gilandel
*
* This file is under Apache License, version 2.0 (2004).
* #L%
*/
package fr.landel.utils.model;
/**
* Abstract class to force implementation of Comparable methods.
*
* @since 14 juil. 2015
* @author Gilles
*
* @param
* The over object type.
*/
public abstract class AbstractModelOverComparable> extends AbstractModelOverObject implements
Comparable {
/**
* Constructor.
*
*/
public AbstractModelOverComparable() {
super(null);
}
/**
* Constructor
*
* @param clazz
* The over class.
*/
public AbstractModelOverComparable(final Class clazz) {
super(clazz);
}
/**
* To force implementation of compareTo.
*
* @param obj
* The object.
* @return The compare to result.
*/
protected abstract int overCompareTo(O obj);
@Override
public int compareTo(O obj) {
if (obj == null) {
return -1;
}
return this.overCompareTo(obj);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy