在java里面现在可以引入三个apache的类来完成,例如:
1
import org.apache.commons.lang.builder.EqualsBuilder;
2
import org.apache.commons.lang.builder.HashCodeBuilder;
3
import org.apache.commons.lang.builder.ToStringBuilder;
4![None.gif](/Images/OutliningIndicators/None.gif)
5![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
public
String toString()
{
6
return new ToStringBuilder(this)
7
.append("id", getId())
8
.toString();
9
}
10![None.gif](/Images/OutliningIndicators/None.gif)
11![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
public
boolean equals(Object other)
{
12
if ( (this == other ) ) return true;
13
if ( !(other instanceof TransitionInstance) ) return false;
14
TransitionInstance castOther = (TransitionInstance) other;
15
return new EqualsBuilder()
16
.append(this.getId(), castOther.getId())
17
.isEquals();
18
}
19![None.gif](/Images/OutliningIndicators/None.gif)
20![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
public
int
hashCode()
{
21
return new HashCodeBuilder()
22
.append(getId())
23
.toHashCode();
24
}
![None.gif](/Images/OutliningIndicators/None.gif)
2
![None.gif](/Images/OutliningIndicators/None.gif)
3
![None.gif](/Images/OutliningIndicators/None.gif)
4
![None.gif](/Images/OutliningIndicators/None.gif)
5
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
![dot.gif](/Images/dot.gif)
6
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
7
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
8
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
9
![ExpandedBlockEnd.gif](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
10
![None.gif](/Images/OutliningIndicators/None.gif)
11
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
![dot.gif](/Images/dot.gif)
12
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
13
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
14
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
15
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
16
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
17
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
18
![ExpandedBlockEnd.gif](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
19
![None.gif](/Images/OutliningIndicators/None.gif)
20
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
![dot.gif](/Images/dot.gif)
21
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
22
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
23
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
24
![ExpandedBlockEnd.gif](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
那么就问问:.NET里面需要改写么?有没有类似的函数可以辅助完成呢? 谢谢赐教!