@@ -0,0 +1,1281 @@
+package org.beanmaker.util;%0A%0Apublic abstract class CacheSortableKeyBase%3CT extends Comparable%3CT%3E%3E implements Comparable%3CCacheSortableKeyBase%3CT%3E%3E %7B%0A%0A    private final long id;%0A    private final T sortOrder;%0A%0A    public CacheSortableKeyBase(final DbBeanInterface bean, final T sortOrder) %7B%0A        this.id = bean.getId();%0A        this.sortOrder = sortOrder;%0A    %7D%0A%0A    public long getId() %7B%0A        return id;%0A    %7D%0A%0A    public T getSortOrder() %7B%0A        return sortOrder;%0A    %7D%0A%0A    @Override%0A    public int compareTo(CacheSortableKeyBase%3CT%3E key) %7B%0A        return sortOrder.compareTo(key.sortOrder);%0A    %7D%0A%0A    // MUST IMPLEMENT EQUALS() HERE%0A    @Override%0A    public boolean equals(final Object key) %7B%0A        throw new UnsupportedOperationException(%22Must implement equals in derived class%22);%0A    %7D%0A%0A    // IMPLEMENTATION MODEL :%0A    /*public boolean equals(final Object key) %7B%0A        if (key == this)%0A            return true;%0A%0A        if (key instanceof %3Cyour key class%3E)%0A            return ((%3Cyour key class%3E) key).getId() == getId();%0A%0A        return false;%0A    %7D*/%0A%0A    @Override%0A    public int hashCode() %7B%0A        int result = 17;%0A%0A        final int idEvaluationHash = (int) (id %5E (id %3E%3E%3E 32));%0A        result = 31 * result + idEvaluationHash;%0A%0A        return result;%0A    %7D%0A%7D%0A

Create base class for ordering keys to use with caching