List of usage examples for java.lang Class isArray
@HotSpotIntrinsicCandidate public native boolean isArray();
From source file:ArrayEnumerationFactory.java
static public Enumeration makeEnumeration(final Object obj) { Class type = obj.getClass(); if (!type.isArray()) { throw new IllegalArgumentException(obj.getClass().toString()); } else {//w w w. j ava2 s. c o m return (new Enumeration() { int size = Array.getLength(obj); int cursor; public boolean hasMoreElements() { return (cursor < size); } public Object nextElement() { return Array.get(obj, cursor++); } }); } }
From source file:Main.java
public static boolean isArray(Class<?> cls) { return cls.isArray(); }
From source file:Main.java
public static boolean isCollectionMapOrArray(Class<?> paramClass) { if (paramClass.isArray()) ;/*from w w w .j a va2 s . c o m*/ while ((Collection.class.isAssignableFrom(paramClass)) || (Map.class.isAssignableFrom(paramClass))) return true; return false; }
From source file:Main.java
public static boolean isArray(Class<?> clazz) { return clazz != null && clazz.isArray(); }
From source file:Main.java
public static boolean isPrimitiveArray(Class<?> aClass) { return aClass.isArray() && aClass.getComponentType().isPrimitive(); }
From source file:Main.java
public static boolean isArray(Class<?> aClass) { return aClass.isArray(); }
From source file:Main.java
public static int getDim(Object array) { int dim = 0;//from w w w.ja va2s . co m Class c = array.getClass(); while (c.isArray()) { c = c.getComponentType(); dim++; } return (dim); }
From source file:Main.java
public static Object copyArray(final Object input) { final Class type = input.getClass(); if (!type.isArray()) { throw new IllegalArgumentException(); }//from w w w .j av a2 s. co m final int length = Array.getLength(input); final Class componentType = type.getComponentType(); final Object result = Array.newInstance(componentType, length); for (int idx = 0; idx < length; idx++) { Array.set(result, idx, Array.get(input, idx)); } return result; }
From source file:Main.java
/** * Same as a readable name but internal class keep the dollar sign in their name * @param elt//from w w w. j a v a 2 s . c o m * @return */ public static String readableSootName(Class<?> elt) { if (elt.isArray()) return readableSootName(elt.getComponentType()) + "[]"; else return elt.getName(); }
From source file:Main.java
public static boolean isArrayType(final Class<?> cls) { return cls.isArray(); }