Object encapsulation

Different scenarios may requires an object encapsulation the most common is in GUI usage.
The .toString() method is often used to render labels text, but what many reasons apply not to 
modify that method.

 

public class Encapsulater {
  
  public YourType thUser;
  
  public ThreadNode(YourType thUser) {
    this.thUser = thUser;
  }
  
  public String toString() {
    return thUser.yourStringReturned();
  }
  
  public int hashCode() {
    return thUser.hashCode();
  }
  
  public boolean equals(Object obj) {
    boolean result = false;
    if(obj instanceof ThreadNode) {
      ThreadNode tn = (ThreadNode)obj;
      result = thUser.equals(tn.thUser);
    }
    return result;
  }
}