Code example for Field

Methods: set, setAccessible

0
        Field nameF = realObject.getClass().getField("name");
        nameF.setAccessible(true);
        nameF.set(realObject, name);
 
        Field typeF = realObject.getClass().getField("type");
        typeF.setAccessible(true);
        typeF.set(realObject, type);
    } 
 
    @Implementation 
    public boolean equals(Object o) {
        if (o == this) return true;
        if (!(o instanceof Account)) return false;
        final Account other = (Account)o;
        return realObject.name.equals(other.name) && realObject.type.equals(other.type);
    } 
 
    @Implementation 
    public int hashCode() { 
        int result = 17;
        result = 31 * result + realObject.name.hashCode();