com.prosysopc.ua
Class StructureUtils

java.lang.Object
  extended by com.prosysopc.ua.StructureUtils

public class StructureUtils
extends Object

This class contains utils for codegenerated Structures.


Method Summary
static
<T> T
clone(T object)
          Clone given object if it can be, otherwise the given object is returned.
static int hashCode(Object... objects)
          Calculates a hash code for given objects.
static boolean scalarOrArrayEquals(Object first, Object second)
          Compares the two given objects for equals.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

clone

public static <T> T clone(T object)
Clone given object if it can be, otherwise the given object is returned. Given inputs shall be structure fields. If for some reason the clone operation fails, the given object is returned instead. Array inputs are deep-cloned (elements are cloned, if they do implement Cloneable, otherwise same reference is used).

Type Parameters:
T - this is in order to avoid casts after calls
Parameters:
object - object to clone (null is allowed and returned if given)
Returns:
cloned object, if needed/possible

hashCode

public static int hashCode(Object... objects)
Calculates a hash code for given objects. The input objects shall be scalar or one dimensional arrays. Object.hashCode is used for scalars and Arrays.hashCode for arrays. Current behaviour for multidim arrays is undefined.

Parameters:
objects - the objects
Returns:
hash code for given objects

scalarOrArrayEquals

public static boolean scalarOrArrayEquals(Object first,
                                          Object second)
Compares the two given objects for equals. The given objects shall be scalars or one dimensional arrays. Null is only equal to null. Assuming both arguments are non-null, scalars are compared using first.equals(second) and arrays are compared using Arrays.equals. Current behaviour for multidim arrays is undefined.

Parameters:
first - null, scalar or one dim array (non-primitive)
second - null, scalar or one dim array (non-primitive)
Returns:
true if first equals second


Copyright © 2018. All rights reserved.