public final class Source
extends java.lang.Object
implements java.io.Serializable
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.
Modifier and Type | Class and Description |
---|---|
static class |
Source.Builder
A builder class for creating immutable
Source objects
e.g. for testing purposes. |
Modifier and Type | Method and Description |
---|---|
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.
|
public Station station()
Station
that this source represents.public Distance distanceFromTarget()
station()
from the target
location that was specified in the original request for data.public boolean equals(java.lang.Object o)
o
is a Source
object with
equal fields to this
.equals
in class java.lang.Object
public int hashCode()
equals
.hashCode
in class java.lang.Object
public java.lang.String toString()
The exact details of the representation are unspecified and subject to change.
toString
in class java.lang.Object
See www.degreedays.net/api/ for more about the Degree Days.net API.
You can sign up for a Degree Days.net API account and read the integration guide that is useful and applicable whether you are using Java or not.