title: Creating an Array of unknown type
body: <p>I have an object which I must validate values off the problem, some of the attributes of the Objects are arrays of custom objects. Such that it will involve some boring down into the individual elements of the array. Excuting the getters for each element such as:</p>
  
  <pre><code>AttribGrp[] x =  Object.getAttribGrp()
  x[i].getSomeValue()
  </code></pre>
  
  <p>It is this I need to get to. I have been extracted the data using an Enum with the list of 
  the attributes In the following manner.</p>
  
  <pre><code>public String getAttribValueAsString(MethodEnum attribName) 
  {
      String attribValue = null;
      Object value = getAttrib(attribName.toString());
  
      if (value != null)
          attribValue = value.toString();
  
      return attribValue;
  }
  </code></pre>
  
  <p>calling:</p>
  
  <pre><code>    private Object invoke(String methodName, Object newValue)
  {
      Object value = null;
      try
      {
          methodInvoker.setTargetMethod(methodName);
  
          if (newValue != null)
              methodInvoker.setArguments(new Object[]{newValue});
          else
              methodInvoker.setArguments(new Object[]{});             
  
          methodInvoker.prepare();
          value = methodInvoker.invoke();
      }
      catch (ClassNotFoundException e)
      {
          throw new IllegalStateException("Method invocation failed. " + e.getMessage(),e);
      }
      catch (NoSuchMethodException e)
      {
          throw new IllegalStateException("Method invocation failed. " + e.getMessage(),e);
      }
      catch (InvocationTargetException e)
      {
          throw new IllegalStateException("Method invocation failed. " + e.getMessage(),e);
      }
      catch (IllegalAccessException e)
      {
          throw new IllegalStateException("Method invocation failed. " + e.getMessage(),e);
      }
      return value;
  }
  </code></pre>
  
  <p>I will be working with a number of arrays of different types and of different values within the arrays. I want to create a method as follows.</p>
  
  <pre><code>    public Object getAttribArray(RIORepeatingGrpEnum repeatingGrp)
  {
          repeatingGrp[] grp = null;
                Object grpVal = getAttrib(repeatingGrp.toString());
                if(grp != null)
                     grp = (repeatingGrp[]) grpVal;
  
                return grp;
  }
  </code></pre>
  
  <p>This is giving me multiple errors mainly concerned with repeatingGrp[]. The array type should be the same name as enum. Is it possible to create a method like this that will create an array of non defined type?</p>