According to the incoming Class and Property, the value of the attribute taken

xiaoxiao2021-03-06  40

Package com.wen;

Import java.lang.reflect.Array; import java.lang.reflect.method; import java.util.arrayList;

/ ** *

Title: *

Description: According to the incoming Class and Property, the value of the attribute of the attribute *

Copyright: CopyRight (C) 2004 *

Company: * @Author not attributable * @version 1.0 * /

public class Reflect {public static String get (Object object, String methodname, int i) {Class cls = object.getClass (); Object ret; try {Method method = cls.getMethod (methodname, null); ret = method.invoke (CLS.NEWINSTANCE (), NULL); ArrayList Array = New ArrayList (); if (Ret.getClass (). Isarray ()) {RET = Array.get (RET, I);}} Catch (Exception E) { Ret = null;} if (ret == null) {Return null;} return ret.tostring ();}}

转载请注明原文地址:https://www.9cbs.com/read-54756.html

New Post(0)