配列のサイズを取得します。
プリミティブ型の配列をを考慮して処理します。
@param object 取得対象の配列
@param componentType 配列の要素のタイプ
@return 配列がnullの場合は、0を返します。
@throws IllegalArgumentException {@literal arrayが配列でない場合。componentTypeがサポートしていないプリミティブ型の場合。}
190281
public static int getArraySize(final Object object, final Class<?> componentType) {

        ArgUtils.notNull(componentType, "componentType");

        if(object == null) {
            return 0;
        }

        if(!object.getClass().isArray()) {
            throw new IllegalArgumentException(String.format("args0 is not arrays : %s.", object.getClass().getName()));
        }

        if(!componentType.isPrimitive()) {
            return ((Object[])object).length;
        }

        if(componentType.equals(boolean.class)) {
            return ((boolean[]) object).length;

        } else if(componentType.equals(char.class)) {
            return ((char[]) object).length;

        } else if(componentType.equals(byte.class)) {
            return ((byte[]) object).length;

        } else if(componentType.equals(short.class)) {
            return ((short[]) object).length;

        } else if(componentType.equals(int.class)) {
            return ((int[]) object).length;

        } else if(componentType.equals(long.class)) {
            return ((long[]) object).length;

        } else if(componentType.equals(float.class)) {
            return ((byte[]) object).length;

        } else if(componentType.equals(double.class)) {
            return ((byte[]) object).length;

        }

        throw new IllegalArgumentException(String.format("not support primitive type : %s.", componentType.getName()));
    }
208999
@SuppressWarnings({ "rawtypes", "unchecked" }) // Using correct types, but wildcards fail to see that.
    private void processType(final Object component, final Context context, final ContextDestroyer contextDestroyer) {
        final com.badlogic.gdx.utils.reflect.Annotation[] annotations = getAnnotations(component.getClass());
        if (annotations == null || annotations.length == 0) {
            return;
        }
        for (final com.badlogic.gdx.utils.reflect.Annotation annotation : annotations) {
            if (typeProcessors.containsKey(annotation.getAnnotationType())) {
                final Array<AnnotationProcessor<?>> typeProcessorsForAnnotation = typeProcessors
                        .get(annotation.getAnnotationType());
                // This might get resized in the process, so we're not using an iterator or assigning size.
                for (int index = 0; index < typeProcessorsForAnnotation.size; index++) {
                    final AnnotationProcessor processor = typeProcessorsForAnnotation.get(index);
                    processor.processType(component.getClass(),
                            annotation.getAnnotation(annotation.getAnnotationType()), component, context, this,
                            contextDestroyer);
                }
            }
        }
    }
56637
public boolean isJavaScriptObject( JType type ) {
        return null != type.isClass() && type.isClass().isAssignableTo( jsoType );
    }
113102
public Component getComponent(int componentIndex)
    {
        if (componentList != null)
            if (componentIndex < componentList.length)
                return componentList[componentIndex];
        return null;
    }
1348900
public static int getSuperComponentCount(TypeElement component) {
    return getSuperComponentType(component)
        .map(superComponent -> getSuperComponentCount(superComponent) + 1)
        .orElse(0);
  }
233705
@GwtIncompatible("incompatible method")
    private static boolean arrayMemberEquals(final Class<?> componentType, final Object o1, final Object o2) {
        if (componentType.isAnnotation()) {
            return annotationArrayMemberEquals((Annotation[]) o1, (Annotation[]) o2);
        }
        if (componentType.equals(Byte.TYPE)) {
            return Arrays.equals((byte[]) o1, (byte[]) o2);
        }
        if (componentType.equals(Short.TYPE)) {
            return Arrays.equals((short[]) o1, (short[]) o2);
        }
        if (componentType.equals(Integer.TYPE)) {
            return Arrays.equals((int[]) o1, (int[]) o2);
        }
        if (componentType.equals(Character.TYPE)) {
            return Arrays.equals((char[]) o1, (char[]) o2);
        }
        if (componentType.equals(Long.TYPE)) {
            return Arrays.equals((long[]) o1, (long[]) o2);
        }
        if (componentType.equals(Float.TYPE)) {
            return Arrays.equals((float[]) o1, (float[]) o2);
        }
        if (componentType.equals(Double.TYPE)) {
            return Arrays.equals((double[]) o1, (double[]) o2);
        }
        if (componentType.equals(Boolean.TYPE)) {
            return Arrays.equals((boolean[]) o1, (boolean[]) o2);
        }
        return Arrays.equals((Object[]) o1, (Object[]) o2);
    }
592683
@Override
    public Class<?> fromComponentNameToClass(final String componentName) { // *important
        if (LdiStringUtil.isEmpty(componentName)) {
            throw new EmptyRuntimeException("componentName");
        }
        final String suffix = fromComponentNameToSuffix(componentName);
        if (suffix == null) {
            return null;
        }
        final String middlePackageName = fromSuffixToPackageName(suffix);
        final String partOfClassName = fromComponentNameToPartOfClassName(componentName);
        final boolean subAppSuffix = isSubAppSuffix(suffix);
        final boolean webAppSufix = isWebAppSuffix(suffix);
        final boolean jobAppSufix = isJobAppSuffix(suffix);
        for (int i = 0; i < rootPackageNames.length; ++i) {
            final String rootPackageName = rootPackageNames[i];
            if (subAppSuffix) { // first search sub application package
                Class<?> clazz = null;
                if (webAppSufix) {
                    clazz = findWebClass(rootPackageName, partOfClassName);
                } else if (jobAppSufix) {
                    clazz = findJobClass(rootPackageName, partOfClassName);
                }
                if (clazz != null) {
                    return clazz;
                }
                clazz = findClass(rootPackageName, middlePackageName, partOfClassName);
                if (clazz != null) {
                    return clazz;
                }
            } else {
                Class<?> clazz = findClass(rootPackageName, middlePackageName, partOfClassName);
                if (clazz != null) {
                    return clazz;
                }
                if (webAppSufix) {
                    clazz = findWebClass(rootPackageName, partOfClassName);
                } else if (jobAppSufix) {
                    clazz = findJobClass(rootPackageName, partOfClassName);
                } else { // e.g. base_login_harborLoginAssist (by "pickup" method)
                    clazz = findWebClass(rootPackageName, partOfClassName); // find as web at first
                    if (clazz == null) {
                        clazz = findJobClass(rootPackageName, partOfClassName); // and job as next
                    }
                }
                if (clazz != null) {
                    return clazz;
                }
            }
        }
        return null;
    }
733953
protected SFSDataWrapper transformNotNullValue(Object object) {
        Object value = serializeObject(object);
        if(value instanceof Parameters)
            return transformParams((Parameters)value);
        if(value instanceof Parameters[])
            return transformParamsArray((Parameters[])value);
        return super.transformNotNullValue(value);
    }
337921
public static <T> T[] toArray(Iterable<T> iterable, Class<T> componentType) {
		return toArray(CollectionUtil.toCollection(iterable), componentType);
	}
859928
public GeocoderAddressComponent getAddressComponent(AddressComponentType addressComponentType) {
        for (GeocoderAddressComponent component : getPlace().getAddressComponents()) {
            for (String type : component.getTypes()) {
                if (addressComponentType.getName().equals(type)) {
                    return component;
                }
            }
        }
        return null;
    }
1187041
public static boolean isTarget( Instance instance ) {
		return instance.getComponent() != null
				&& ComponentHelpers.isTarget( instance.getComponent());
	}
1033560
private String getActualComponentType(String componentType) {

        if (componentType == null) {
            throw new IllegalArgumentException("参数不能为null.");
        }

        int lastIndex = componentType.lastIndexOf(ARRAY_PREFIX);
        if (lastIndex != -1) {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < lastIndex + 1; i++) {
                sb.append(ARRAY_PREFIX);
            }
            sb.append("L");
            sb.append(componentType.substring(lastIndex + 1));
            sb.append(";");
            return sb.toString();
        }

        return componentType;
    }
1324700
public List<InputColumn<?>> getAvailableInputColumns(final ComponentBuilder componentBuilder,
            final Class<?> dataType) {
        List<InputColumn<?>> result = getAvailableInputColumns(dataType);

        final SourceColumnFinder finder = new SourceColumnFinder();
        finder.addSources(this);

        result = CollectionUtils.filter(result, new Predicate<InputColumn<?>>() {
            @Override
            public Boolean eval(InputColumn<?> inputColumn) {
                if (inputColumn.isPhysicalColumn()) {
                    return true;
                }

                final InputColumnSourceJob origin = finder.findInputColumnSource(inputColumn);
                if (origin == null) {
                    return true;
                }

                if (origin == componentBuilder) {
                    // exclude columns from the component itself
                    return false;
                }

                final Set<Object> sourceComponents = finder.findAllSourceJobs(origin);
                if (sourceComponents.contains(componentBuilder)) {
                    // exclude columns that depend
                    return false;
                }

                return true;
            }
        });

        return result;
    }
101811
public static Object toArray(Collection<?> collection, Class<?> componentType) {
    if (componentType.isPrimitive()) {
      Object array = Array.newInstance(componentType, collection.size());
      int index = 0;
      for (Object value : collection) {
        Array.set(array, index++, value);
      }
      return array;
    }
    return collection.toArray((Object[]) Array.newInstance(componentType, collection.size()));
  }
877024
public static Object[] cast(Class<?> type, Object arrayObj) throws NullPointerException, IllegalArgumentException {
		if (null == arrayObj) {
			throw new NullPointerException("Argument [arrayObj] is null !");
		}
		if (false == arrayObj.getClass().isArray()) {
			throw new IllegalArgumentException("Argument [arrayObj] is not array !");
		}
		if (null == type) {
			return (Object[]) arrayObj;
		}

		final Class<?> componentType = type.isArray() ? type.getComponentType() : type;
		final Object[] array = (Object[]) arrayObj;
		final Object[] result = ArrayUtil.newArray(componentType, array.length);
		System.arraycopy(array, 0, result, 0, array.length);
		return result;
	}
273955
private String _serializeComponent(Component component, Map<Object, String> done) throws ConverterException {
	StringBuilder sb = new StringBuilder();
	Component ca;
	component = new ComponentSpecificAccess(Component.ACCESS_PRIVATE, ca = component);
	boolean isPeristent = ca.isPersistent();

	deep++;
	Object member;
	Iterator<Key> it = component.keyIterator();
	Collection.Key key;
	while (it.hasNext()) {
	    key = it.next();
	    member = component.get(key, null);
	    if (member instanceof UDF) continue;
	    sb.append(goIn() + "<var scope=\"this\" name=" + del + key.toString() + del + ">");
	    sb.append(_serialize(member, done));
	    sb.append(goIn() + "</var>");
	}

	Property p;
	Boolean remotingFetch;
	Struct props = ignoreRemotingFetch ? null : ComponentUtil.getPropertiesAsStruct(ca, false);
	ComponentScope scope = ca.getComponentScope();
	it = scope.keyIterator();
	while (it.hasNext()) {
	    key = Caster.toKey(it.next(), null);
	    if (!ignoreRemotingFetch) {
		p = (Property) props.get(key, null);
		if (p != null) {
		    remotingFetch = Caster.toBoolean(p.getDynamicAttributes().get(REMOTING_FETCH, null), null);
		    if (remotingFetch == null) {
			if (isPeristent && ORMUtil.isRelated(p)) continue;
		    }
		    else if (!remotingFetch.booleanValue()) continue;
		}
	    }

	    member = scope.get(key, null);
	    if (member instanceof UDF || key.equals(KeyConstants._this)) continue;
	    sb.append(goIn() + "<var scope=\"variables\" name=" + del + key.toString() + del + ">");
	    sb.append(_serialize(member, done));
	    sb.append(goIn() + "</var>");
	}

	deep--;
	try {
	    // return goIn()+"<struct>"+sb+"</struct>";
	    return goIn() + "<component md5=\"" + ComponentUtil.md5(component) + "\" name=\"" + component.getAbsName() + "\">" + sb + "</component>";
	}
	catch (Exception e) {
	    throw toConverterException(e);
	}
    }
39645
public static Class<?> getType(UIComponent p_component) {
		ValueExpression valueExpression = p_component.getValueExpression("value");
		if (valueExpression != null) {
			return getType(valueExpression.getExpressionString());
		}
		return null;
	}