class or method alias in java

前端 未结 8 1073
青春惊慌失措
青春惊慌失措 2020-12-10 00:31

I have long java class and method names

LONGGGGGGGGGGGGGGGClass.longggggggggggggggggggggggggMethod();

I want to alias it to g.m();

8条回答
  •  情歌与酒
    2020-12-10 01:09

    I only ran a simple test but I defined an inner class variable. I'm not an expert nor do I know the consequences of doing this but I obtained positive results.

    package a.b;
    
    public class Library {
        public static String str;
    }
    

    Now write a class to access the static variables from Library

    package a.b;
    
    public class Access {
       public class Short extends Library {}
       Short.str;
    }
    

提交回复
热议问题