View Javadoc

1   package net.sf.josceleton.core.impl.entity.message;
2   
3   import net.sf.josceleton.core.api.entity.Coordinate;
4   import net.sf.josceleton.core.api.entity.User;
5   import net.sf.josceleton.core.api.entity.joint.Joint;
6   import net.sf.josceleton.core.api.entity.message.JointMessage;
7   
8   import com.google.inject.Inject;
9   import com.google.inject.assistedinject.Assisted;
10  
11  class JointMessageImpl extends GenericMessageImpl implements JointMessage {
12  	
13  	private final Joint joint;
14  	
15  	private final Coordinate coordinate;
16  	
17  	
18  	@Inject JointMessageImpl(
19  			@Assisted final User user,
20  			@Assisted final Joint joint,
21  			@Assisted final Coordinate coordinate) {
22  		super(user);
23  		this.joint = joint;
24  		this.coordinate = coordinate;
25  	}
26  
27  
28  	/** {@inheritDoc} from {@link JointMessage} */
29  	@Override public final Joint getJoint() {
30  		return this.joint;
31  	}
32  
33  	/** {@inheritDoc} from {@link JointMessage} */
34  	@Override public final Coordinate getCoordinate() {
35  		return this.coordinate;
36  	}
37  	
38  	@Override public final boolean equals(final Object other) {
39  		if(this == other) { return true; }
40  		if((other instanceof JointMessage) == false) { return false; }
41  		final JointMessage that = (JointMessage) other;
42  		return	this.getUser().equals(that.getUser()) &&
43  				this.getJoint().equals(that.getJoint()) &&
44  				this.getCoordinate().equals(that.getCoordinate());
45  	}
46  
47  	@Override public final int hashCode() {
48  		return this.getUser().hashCode();
49  	}
50  	
51  	@Override public final String toString() {
52  		return "JointMessageImpl[" +
53  					"user=" + this.getUser() + ", " +
54  					"joint=" + this.joint + ", " +
55  					"coordinate=" + this.coordinate +
56  				"]";
57  	}
58  
59  }