Package com.iizix.license.history
Class ActivationChange
- java.lang.Object
- com.iizix.license.history.ActivationChange
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ActivationChange>
public final class ActivationChange extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<ActivationChange>
Class handling a single activation change event.- Author:
- Christopher Mindus
- See Also:
- Serialized Form
Field Summary
Fields Modifier and Type Field Description protected LicensingHistoryEvent
event
The history event that caused the change.protected int
hashCode
The hash code cache, zero for none.protected java.lang.String
msg
The message.protected long
time
The creation time in milliseconds since epoch.
Constructor Summary
Constructors Constructor Description ActivationChange(LicensingHistoryEvent event, java.lang.String msg)
Constructor from a history event and a message.ActivationChange(java.lang.String string)
Constructor from a String.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(ActivationChange o)
Compares two entries.boolean
equals(java.lang.Object o)
Checks for equality.LicensingHistoryEvent
getEvent()
Gets the history event.java.lang.String
getMessage()
Gets the message.long
getTime()
Gets the time in milliseconds since the epoch when the change occurred.java.lang.String
getUnparsedString()
Produces an internal string representation of this change in a String that can be parsed by the constructorActivationChange(String)
.int
hashCode()
Gets the hash code.java.lang.String
toString()
Produces a textual entry for the event.
Field Detail
time
protected long time
The creation time in milliseconds since epoch.
event
protected LicensingHistoryEvent event
The history event that caused the change.
msg
protected java.lang.String msg
The message.
hashCode
protected int hashCode
The hash code cache, zero for none.
Constructor Detail
ActivationChange
public ActivationChange(java.lang.String string)
Constructor from a String.- Parameters:
string
- The string of changes.- Throws:
java.lang.NullPointerException
- If string is null.java.lang.NumberFormatException
- If numbers cannot be parsed.java.lang.IllegalArgumentException
- If the string event is wrong.
ActivationChange
public ActivationChange(LicensingHistoryEvent event, java.lang.String msg)
Constructor from a history event and a message.- Parameters:
event
- The history event.msg
- The message.- Throws:
java.lang.NullPointerException
- If event or msg is null.
Method Detail
getTime
public long getTime()
Gets the time in milliseconds since the epoch when the change occurred.- Returns:
- Time in milliseconds since the epoch
getEvent
public LicensingHistoryEvent getEvent()
Gets the history event.- Returns:
- The history event.
getMessage
public java.lang.String getMessage()
Gets the message.- Returns:
- The message string, never null.
getUnparsedString
public java.lang.String getUnparsedString()
Produces an internal string representation of this change in a String that can be parsed by the constructorActivationChange(String)
.- Returns:
- A string formatted as "epochTimeInMillis,eventValue,message".
toString
public java.lang.String toString()
Produces a textual entry for the event.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string formatted as "31 jan 2014 23:59:59.123 [Event] Message".
equals
public boolean equals(java.lang.Object o)
Checks for equality.- Overrides:
equals
in classjava.lang.Object
hashCode
public int hashCode()
Gets the hash code.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code of this entry.
compareTo
public int compareTo(ActivationChange o)
Compares two entries.- Specified by:
compareTo
in interfacejava.lang.Comparable<ActivationChange>
- Parameters:
o
- The other entry.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.