FileDocCategorySizeDatePackage
Resource.javaAPI DocphoneME MR2 API (J2ME)3114Wed May 02 18:00:46 BST 2007com.sun.j2me.global

Resource

public class Resource extends Object
Wrapper around any object to allow store it as resource in ResourceCache. HashCode of the Resource instance has to be replaced with precalculated integer value this is key in the cache. ResourceCache itself is responsible for calculating hash code {@link ResourceCache#getHashCodeForResource}. It is always calculated from basename, locale, and id.

Fields Summary
private int
code
Hashcode identifying instance in cache
private int
size
Size of the object to store
private Object
value
Description of the data to store in cache
Constructors Summary
public Resource(int code, int size, Object value)
Creates Resource initialized.

param
code hashcode identifying instance in cache
param
size size of the object to store
param
value Description of the data to store in cache

        this.code = code;
        this.size = size;
        this.value = value;
    
Methods Summary
public booleanequals(java.lang.Object o)
Resources are compared using code field.

param
o another Resource to compare to current
return
true if objects equals

        if (o instanceof Resource) {
            return ((Resource) o).getCode() == code;
        }
        return false;
    
public intgetCode()
get code of this resource.

return
the code of resource

        return code;
    
public intgetSize()
get size of the resource instance.

return
sie of the instance in bytes

        return size;
    
public java.lang.ObjectgetValue()
Get data stored under this resource.

return
resource data

        return value;
    
public inthashCode()
get hash code of this instance.

return
hash code of the instance

        return code;