net.degreedays.api.data
Class Source

java.lang.Object
  extended by net.degreedays.api.data.Source
All Implemented Interfaces:
java.io.Serializable

public final class Source
extends java.lang.Object
implements java.io.Serializable

Contains basic information about a source of data that was used to satisfy a request.

On the surface this appears very similar to the Station object that it contains, but there is a key difference: the information contained in a Source is specifically relevant to a particular request for data, whilst the Station is independent of that. For example, the Source contains the distanceFromTarget(), which is the distance of the Station from the target location that was specified in the request.

Instances of this class are immutable. You can safely reuse them and call them from multiple threads at once.


Nested Class Summary
static class Source.Builder
          A builder class for creating immutable Source objects e.g. for testing purposes.
 
Method Summary
 Distance distanceFromTarget()
          Returns the non-null distance of the station() from the target location that was specified in the original request for data.
 boolean equals(java.lang.Object o)
          Returns true if o is a Source object with equal fields to this.
 int hashCode()
          Overridden to ensure consistency with equals.
 Station station()
          Returns the non-null Station that this source represents.
 java.lang.String toString()
          Returns a non-null, non-empty string representation of this object for logging and debugging purposes.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

station

public Station station()
Returns the non-null Station that this source represents.


distanceFromTarget

public Distance distanceFromTarget()
Returns the non-null distance of the station() from the target location that was specified in the original request for data.


equals

public boolean equals(java.lang.Object o)
Returns true if o is a Source object with equal fields to this.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overridden to ensure consistency with equals.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns a non-null, non-empty string representation of this object for logging and debugging purposes.

The exact details of the representation are unspecified and subject to change.

Overrides:
toString in class java.lang.Object


www.degreedays.net/api/