/src/main/java/de/jbee/lang/Ord.java

http://github.com/jbee/jadamant · Java · 24 lines · 4 code · 2 blank · 18 comment · 0 complexity · 90470925da3458fa3ba17803f2c043fa MD5 · raw file

  1. package de.jbee.lang;
  2. /**
  3. * <p>
  4. * {@link Ord} is not a property of the value instances being ordered itself since there is no
  5. * natural order. This is a common misunderstanding. {@link Order} does depend on the current role
  6. * of the sorted object. Therefore a order is something external that is applied to value objects.
  7. * It results in a {@link Ordering}.
  8. * </p>
  9. * <p>
  10. * If that seams to force you to violate encapsulation principle simply put the concerned
  11. * {@linkplain Ord} implementation as a static inner class of your value object. That helps to hide
  12. * its data and still allows to apply an specific order based on your entity's hidden field(s).
  13. * </p>
  14. * <p>
  15. * There are a bunch of frequently used orderings available in the {@link Order} utility class.
  16. * </p>
  17. *
  18. * @author Jan Bernitt (jan.bernitt@gmx.de)
  19. */
  20. public interface Ord<T> {
  21. Ordering ord( T left, T right );
  22. }