ewe.sys
Class Long

java.lang.Object
  extended byewe.data.DataObject
      extended byewe.sys.Long
All Implemented Interfaces:
Comparable, Copyable, DataUnit, Stringable, Value

public class Long
extends DataObject
implements Value

The ewe.sys.Long class was originally used to wrap java integral values instead of the standard java wrapper objects (java.lang.Integer, java.lang.Long, java.lang.Short, etc.)


Field Summary
static int HEX
          This is an option for toString().
static Long l1
           
static Long l2
           
static Long l3
           
static int TRUNCATE
          This is an option for toString().
 long value
           
static int ZERO_FILL
          This is an option for toString().
 
Constructor Summary
Long()
           
 
Method Summary
 int compareTo(Object other)
          Compare this object with another.
 void copyFrom(Object other)
          Copy all appropriate data from another object.
 boolean equals(Object other)
          Returns if this object is considered equal to the other object.
 Long fromJavaWrapper(Object javaWrapper)
          Place the value in the standard java Wrapper (e.g.
 void fromString(String str)
           
 int hashCode()
          Returns a hashCode for the object.
 Long set(long value)
           
 Long set(Long value)
           
 String toString()
          Return a String representation of this object.
 String toString(int length, int options)
          Convert to a String.
 
Methods inherited from class ewe.data.DataObject
_getSetField, appendAllFields, copied, getCopy, getDeclaredField, getDeclaredFieldValue, getDeclaredFieldValue, getFieldList, getFieldList, getMyFieldList, getNew
 
Methods inherited from class java.lang.Object
clone, finalize, getClass
 

Field Detail

value

public long value

l1

public static final Long l1

l2

public static final Long l2

l3

public static final Long l3

ZERO_FILL

public static final int ZERO_FILL
This is an option for toString().

See Also:
Constant Field Values

TRUNCATE

public static final int TRUNCATE
This is an option for toString().

See Also:
Constant Field Values

HEX

public static final int HEX
This is an option for toString().

See Also:
Constant Field Values
Constructor Detail

Long

public Long()
Method Detail

set

public Long set(long value)

set

public Long set(Long value)

copyFrom

public void copyFrom(Object other)
Description copied from interface: DataUnit
Copy all appropriate data from another object.

Specified by:
copyFrom in interface DataUnit
Overrides:
copyFrom in class DataObject

toString

public String toString()
Description copied from class: Object
Return a String representation of this object.

Specified by:
toString in interface Stringable
Overrides:
toString in class Object
Returns:
a String representing this object.

compareTo

public int compareTo(Object other)
Description copied from interface: Comparable
Compare this object with another. It should return: less than 0 if this object is considered LESS than the "other" object; greater than 0 if this object is considered GREATER than the "other" object; 0 if this object is considered EQUAL to the "other" object. (i.e. it is an implicit subtraction).

Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class DataObject

toString

public String toString(int length,
                       int options)
Convert to a String.

Parameters:
length - The length of the output String.
options - Can be a combination of HEX (output in hexadecimal), ZERO_FILL (left pad to length with zeros), TRUNCATE (truncate to be no longer than the specified length).
Returns:
The value converted to a String.

fromString

public void fromString(String str)
Specified by:
fromString in interface Stringable

equals

public boolean equals(Object other)
Description copied from class: Object
Returns if this object is considered equal to the other object.

Overrides:
equals in class DataObject

hashCode

public int hashCode()
Description copied from class: Object
Returns a hashCode for the object. The general contract of hashCode is:
  • An object must return the same hash code for its entire existence.
  • If two objects are considered equal by the equals() method, they should return the same hash code. Not all Objects will do this and you should only use hashCode() from Objects which declare an overrided version of hashCode(). The only Objects which provide consistent and correct hash codes under Ewe are Object, String and Class.

    Overrides:
    hashCode in class Object

  • fromJavaWrapper

    public Long fromJavaWrapper(Object javaWrapper)
                         throws IllegalArgumentException
    Place the value in the standard java Wrapper (e.g. java.lang.Integer, java.lang.Long, etc) into this ewe.sys.Long.

    Parameters:
    javaWrapper - one of the java.lang primitive wrapper values representing an integer type.
    Returns:
    this ewe.sys.Long after the value has been placed in it.
    Throws:
    IllegalArgumentException - if the javaWrapper parameter is not an integral or boolean value.