Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.hyades.logging.events.cbe.util
Class EventHelpers

    java.lang.Object
      |
      +--org.eclipse.hyades.logging.events.cbe.util.EventHelpers

public class EventHelpers
extends java.lang.Object

Miscellaneous routines to support functions such as validation, serialization and comparison.

Since:
  1.0.1
Version:
  1.0.1
Author:
  Denilson Nastacio, Jason Cornpropst, Scott Brown

Method Summary
`static boolean` | `compareEObject(java.lang.Object obj1, java.lang.Object obj2)` Deep-comparison for two EMF objects.
`static long` | `dateToLong(java.lang.String inDate)`
`static java.lang.String` | `longToDate(long inDateTime)`
`static void` | `serializableRead(org.eclipse.emf.ecore.EObject o, java.io.ObjectInputStream in)` Generic serialization routine for EMF object.
`static void` | `serializableWrite(org.eclipse.emf.ecore.EObject o, java.io.ObjectOutputStream out)` Generic serialization routine for EMF object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### serializableRead

    public static void serializableRead(org.eclipse.emf.ecore.EObject o,
                                        java.io.ObjectInputStream in)
                                 throws java.lang.ClassNotFoundException,
                                        java.io.IOException

  Generic serialization routine for EMF object.

  Parameters:
    `o` - EMF object to be serialized
    `in` - Java IO input stream contained the serialized strem
  Throws:
    `java.lang.ClassNotFoundException` - if the class of an object inside the stream cannot be found in the classpath
    `java.io.IOException` - if the input stream cannot be read for whatever reason

### serializableWrite

    public static void serializableWrite(org.eclipse.emf.ecore.EObject o,
                                         java.io.ObjectOutputStream out)
                                  throws java.io.IOException

  Generic serialization routine for EMF object.

  Parameters:
    `o` - EMF object to be serialized
    `out` - Java IO stream to where the serialized object will be written.
  Throws:
    `java.io.IOException` - if the object cannot be written to the output stream for whatever reason.

### compareEObject

    public static boolean compareEObject(java.lang.Object obj1,
                                         java.lang.Object obj2)

  Deep-comparison for two EMF objects.

  If the the two EMF objects are of the same type, it traverses their features recursively until a difference is found.

  When comparing lists, this method ignores order.

  This is a helper for implementing the `equals` method on EMF objects, where `obj1` is the object where `equals` was called and `obj2` is the parameter for that call.

  Therefore `obj1` can never be `null` and when `obj2` is `null`, the result is `false`.

  Parameters:
    `obj1` - first element in the comparison
    `obj2` - second element in the comparison
  Returns:
    `true` if the two objects are identical instancesor `false` otherwise.

### dateToLong

    public static long dateToLong(java.lang.String inDate)

  Parameters:
    `inDate` - The date in string format (CCYY-MM-DDThh:mm:ssZ)
  Returns:
    The date in milliseconds since 1970-01-01T00:00:00Z. If the input cannot be converted or the date is older than 1970 then zero will be returned.
  Throws:
    `java.lang.IllegalArgumentException` - if the date paremeters does not follow the xsd:dateTime convention.
  See Also:
    `Converts the creationTime from a string in XML Schema datetime format (CCYY-MM-DDThh:mm:ss) to a long representing the milliseconds since 1970-01-01T00:00:00`

### longToDate

    public static java.lang.String longToDate(long inDateTime)

  Parameters:
    `inDateTime` - The date in milliseconds since 1970-01-01T00:00:00Z
  Returns:
    The date in string format (CCYY-MM-DDThh:mm:ssZ)
  See Also:
    `Converts a long representing UTC in milliseconds to the XML Schema datetime format (CCYY-MM-DDThh:mm:ssZ)`

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD