order caches rendering

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1425290 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-12-22 14:50:45 +00:00
parent 88674f25b4
commit d712e42888
2 changed files with 37 additions and 3 deletions

View File

@ -25,9 +25,9 @@ import java.io.Serializable;
* @author Olivier Lamy * @author Olivier Lamy
* @since 1.4-M3 * @since 1.4-M3
*/ */
@XmlRootElement( name = "cacheEntry" ) @XmlRootElement(name = "cacheEntry")
public class CacheEntry public class CacheEntry
implements Serializable implements Serializable, Comparable
{ {
private String key; private String key;
@ -108,7 +108,6 @@ public class CacheEntry
} }
/** /**
*
* @return cache size in kb * @return cache size in kb
*/ */
public long getInMemorySize() public long getInMemorySize()
@ -121,6 +120,39 @@ public class CacheEntry
this.inMemorySize = inMemorySize; this.inMemorySize = inMemorySize;
} }
public int compareTo( Object o )
{
return this.key.compareTo( ( (CacheEntry) o ).key );
}
@Override
public boolean equals( Object o )
{
if ( this == o )
{
return true;
}
if ( o == null || getClass() != o.getClass() )
{
return false;
}
CacheEntry that = (CacheEntry) o;
if ( !key.equals( that.key ) )
{
return false;
}
return true;
}
@Override
public int hashCode()
{
return key.hashCode();
}
@Override @Override
public String toString() public String toString()
{ {

View File

@ -134,6 +134,8 @@ public class DefaultSystemStatusService
cacheStatistics.getInMemorySize() ) ); cacheStatistics.getInMemorySize() ) );
} }
Collections.sort( cacheEntries );
return cacheEntries; return cacheEntries;
} }