Class Array


  • public final class Array
    extends Object
    Container for Java array type extensions. An extension class that extends this class effectively extends all Java array types such as: Object[], String[], int[], int[][], etc. Note the @This parameter must be declared as type Object since both reference and primitive component types apply.
    
       package myproject.extensions.manifold.rt.api.Array;
    
       import java.lang.reflect.Array;
       import manifold.ext.rt.api.Extension;
       import manifold.ext.rt.api.This;
    
      @Extension
       public class MyArrayExtension {
         public static final String myMethod(@This Object array) {
           return "Size of array: " + Array.getLength(array);
         }
       }
    
       // usage
       String[] strings = new String[] {"a", "b", "c"};
       strings.myMethod();
     
    See manifold.ext.rt.extensions.manifold.rt.api.Array.ManArrayExt for implementations of builtin Array extension methods.