Package jodd.methref

Class Methref<C>


  • public class Methref<C>
    extends java.lang.Object
    Super tool for getting method references (names) in compile-time.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static jodd.util.TypeCache<java.lang.Class> cache  
    • Constructor Summary

      Constructors 
      Constructor Description
      Methref​(java.lang.Class<C> target)
      Creates new proxified instance of target.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean isMyProxy​(java.lang.Object instance)
      Returns true if given object is proxified by this Methref.
      <T> java.lang.String lastName()
      Returns name of last method invoked on proxy.
      static java.lang.String lastName​(java.lang.Object instance)
      Returns method name of last invoked method on a proxy.
      void lastName​(java.lang.String name)  
      java.lang.String name​(java.util.function.Consumer<C> consumer)
      Returns name of called method.
      static <T> Methref<T> of​(java.lang.Class<T> target)
      Static factory, for convenient use.
      C proxy()
      Returns proxy instance that is ready to collect the method name of invoked methods.
      • Methods inherited from class java.lang.Object

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

      • cache

        public static jodd.util.TypeCache<java.lang.Class> cache
    • Constructor Detail

      • Methref

        public Methref​(java.lang.Class<C> target)
        Creates new proxified instance of target. Proxy classes are cached. If given target is also proxified, it's real target will be used.
    • Method Detail

      • of

        public static <T> Methref<T> of​(java.lang.Class<T> target)
        Static factory, for convenient use.
      • name

        public java.lang.String name​(java.util.function.Consumer<C> consumer)
        Returns name of called method.
      • proxy

        public C proxy()
        Returns proxy instance that is ready to collect the method name of invoked methods.
      • isMyProxy

        public boolean isMyProxy​(java.lang.Object instance)
        Returns true if given object is proxified by this Methref.
      • lastName

        public static java.lang.String lastName​(java.lang.Object instance)
        Returns method name of last invoked method on a proxy.
      • lastName

        public <T> java.lang.String lastName()
        Returns name of last method invoked on proxy.
      • lastName

        public void lastName​(java.lang.String name)