Class ProxyUtils

  • All Implemented Interfaces:
    Utils

    public abstract class ProxyUtils
    extends java.lang.Object
    implements Utils
    The utilities class for Proxy
    Since:
    1.0.0
    Author:
    Mercy
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isProxyable​(java.lang.Class<?> type)
      Determines whether the specified class is proxyable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isProxyable

        public static boolean isProxyable​(java.lang.Class<?> type)
        Determines whether the specified class is proxyable.

        A class is considered proxyable if:

        • It has a non-private constructor with no parameters
        • It is not declared final
        • It does not have non-static, final methods with public, protected, or default visibility
        • It is not a primitive type
        • It is not an array type

        Example Usage

        
         public class ExampleClass {
             public void exampleMethod() {}
         }
        
         boolean result = ProxyUtils.isProxyable(ExampleClass.class);
         // result will be true as ExampleClass meets all proxyable conditions.
        
         public final class FinalClass {
             public void method() {}
         }
        
         result = ProxyUtils.isProxyable(FinalClass.class);
         // result will be false as FinalClass is declared final.
         
        Parameters:
        type - the class to check for proxyability
        Returns:
        true if the class is proxyable, otherwise false