📄 userphaser.java
字号:
/*01*/import java.lang.reflect.*;
/*02*/public class userphaser
/*03*/{
/*04*/ public static void main(String[] args)
/*05*/ {
/*06*/ try
/*07*/ {
/*08*/ Class cls=Class.forName("sortedClass");
/*09*/ Class[] inters=cls.getInterfaces();
/*10*/ boolean isSortImpl=false;
/*11*/ for(Class cl:inters)
/*12*/ {
/*13*/ if("sortedIO".equals(cl.getName()))
/*14*/ {
/*15*/ isSortImpl=true;
/*16*/ break;
/*17*/ }
/*18*/ }
/*19*/ Method[] all_method=getSortMethod();
/*20*/ Object obj= cls.newInstance();
/*21*/ for(Method m:all_method)
/*22*/ {
/*23*/ m.invoke(obj);
/*24*/ }
/*25*/ }
/*26*/ catch(Exception e)
/*27*/ {
/*28*/ System.out.println("hello");
/*29*/ }
/*30*/ }
/*31*/ public static Method[] getSortMethod() throws Exception
/*32*/ {
/*33*/ Class cls=Class.forName("sortedIO");
/*34*/ Method[] all_method=cls.getDeclaredMethods();
/*35*/ int notphased=0;
/*36*/ for(int i=0;i<all_method.length-1;i++)
/*37*/ {
/*38*/ phase myfase1=all_method[i].getAnnotation(phase.class);
/*39*/ phase myfase2=all_method[i+1].getAnnotation(phase.class);
/*40*/ if(myfase1.index()>myfase2.index())
/*41*/ {
/*42*/ Method temp=all_method[i];
/*43*/ all_method[i]=all_method[i+1];
/*44*/ all_method[i+1]=temp;
/*45*/ }
/*46*/ }
/*47*/ return all_method;
/*48*/ }
/*49*/}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -