Skip to content

Instantly share code, notes, and snippets.

@ubourdon
Created May 15, 2012 15:49
Show Gist options
  • Save ubourdon/2702802 to your computer and use it in GitHub Desktop.
Save ubourdon/2702802 to your computer and use it in GitHub Desktop.
a real good pojo
public class SingleEvent {
private final Tupple<KeyType, String> basicatId;
private final Tupple<EventType, String> eventId;
private final String xmlData;
private final Boolean acquitted;
private SingleEvent( final Tupple<KeyType, String> basicatId, final Tupple<EventType, String> eventId, final String xmlData, final Boolean acquitted ) {
this.basicatId = basicatId;
this.eventId = eventId;
this.xmlData = xmlData;
this.acquitted = acquitted;
}
public Tupple<KeyType, String> getBasicatId() {
return basicatId;
}
public Tupple<EventType, String> getEventId() {
return eventId;
}
public String getXmlData() {
return xmlData;
}
public Boolean getAcquitted() {
return acquitted;
}
@Override
public boolean equals( Object objectToCompare ) {
if( this == objectToCompare ) return true;
if( !( objectToCompare instanceof SingleEvent ) ) return false;
SingleEvent that = ( SingleEvent ) objectToCompare;
if( !eventId.equals( that.eventId ) ) return false;
return true;
}
@Override
public int hashCode() {
if( eventId == null ) return 0;
return eventId.hashCode();
}
public static class Builder {
private Tupple<KeyType, String> basicatId;
private Tupple<EventType, String> eventId;
private String xmlData;
private Boolean acquitted;
public SingleEvent toSingleEvent() {
return new SingleEvent( basicatId, eventId, xmlData, acquitted );
}
public Builder withBasicatId( Tupple<KeyType, String> basicatId ) {
this.basicatId = basicatId;
return this;
}
public Builder withEventId( Tupple<EventType, String> eventId ) {
this.eventId = eventId;
return this;
}
public Builder withXmlData( String xmlData ) {
this.xmlData = xmlData;
return this;
}
public Builder withAcquitted( Boolean acquitted ) {
this.acquitted = acquitted;
return this;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment