public final class Array extends Object
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.Copyright © 2024. All rights reserved.