nl.beesting.beangenerator.util
Class ArrayUtil

java.lang.Object
  extended by nl.beesting.beangenerator.util.ArrayUtil

public class ArrayUtil
extends java.lang.Object


Constructor Summary
ArrayUtil()
           
 
Method Summary
static int elementAt(java.lang.Object[] array, java.lang.Object possibleElement)
          Determines at what index an element is in an array.
static java.lang.Object getPropertyValue(java.lang.Object[] array, java.lang.String property)
          Method getPropertyValue; gets the first occurrence.
static java.lang.Object[] getPropertyValues(java.lang.Object[] array, java.lang.String property)
          Method getPropertyValue; gets the first occurrence
static java.lang.String toString(java.lang.Object[] array)
          Method toString.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayUtil

public ArrayUtil()
Method Detail

elementAt

public static int elementAt(java.lang.Object[] array,
                            java.lang.Object possibleElement)
Determines at what index an element is in an array.

Parameters:
array - the array of object to search in
possibleElement - the element for which to search
Returns:
a number n for which 0 <= n <= array.length if the possible element is in the passed array, -1 otherwise.

toString

public static java.lang.String toString(java.lang.Object[] array)
Method toString. Creates a string of an array e.g. [1, 2]. It iteratively calls the toString method of the elements in the array for normal types; and recursively calls this functions for arrays (thus multidimensional arays are printed out correctly e.g. [[1,2], [3]]

Parameters:
array -
Returns:
String

getPropertyValue

public static java.lang.Object getPropertyValue(java.lang.Object[] array,
                                                java.lang.String property)
Method getPropertyValue; gets the first occurrence. Note that exceptions when

Parameters:
array - the array of objects
property - the property to be found in the array
Returns:
Object the found object or null if something went wrong

getPropertyValues

public static java.lang.Object[] getPropertyValues(java.lang.Object[] array,
                                                   java.lang.String property)
Method getPropertyValue; gets the first occurrence

Parameters:
array - the array of objects
property - the property to be found in the array
Returns:
Object[] all found objects or null if something went wrong


Copyright 2008. All Rights Reserved.