Class MethodDescriptor


  • public final class MethodDescriptor
    extends java.lang.Object
    A very basic descriptor or getter/setter methods
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String name  
      private java.lang.Class<?> parameterType  
      private java.lang.String prefix  
      private java.lang.String prefixedName  
      private java.lang.Class<?> returnType  
      private java.lang.String string  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private MethodDescriptor​(java.lang.String name, java.lang.Class<?> parameterType, java.lang.Class<?> returnType)  
      private MethodDescriptor​(java.lang.String prefix, java.lang.String name, java.lang.Class<?> parameterType, java.lang.Class<?> returnType)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      private java.lang.String generateString()  
      java.lang.String getName()
      Returns the method name, without the prefix
      java.lang.Class<?> getParameterType()
      Returns the parameter type associated with a method, if available
      java.lang.String getPrefix()
      Returns the prefix: a dot separated string denoting a path of nested object names (e.g.
      java.lang.String getPrefixedName()
      Returns full path to a method, (e.g.
      java.lang.Class<?> getReturnType()
      Returns the return type associated with a method, if available
      static MethodDescriptor getter​(java.lang.String name, java.lang.Class<?> returnType)
      Creates a descriptor for a getter method
      (package private) static MethodDescriptor getter​(java.lang.String prefix, java.lang.reflect.Method method)
      Creates a descriptor for a getter method
      int hashCode()  
      static MethodDescriptor setter​(java.lang.String name, java.lang.Class<?> parameterType)
      Creates a descriptor for a setter method
      (package private) static MethodDescriptor setter​(java.lang.String prefix, java.lang.reflect.Method method)
      Creates a descriptor for a setter method
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • prefixedName

        private final java.lang.String prefixedName
      • name

        private final java.lang.String name
      • prefix

        private final java.lang.String prefix
      • parameterType

        private final java.lang.Class<?> parameterType
      • returnType

        private final java.lang.Class<?> returnType
      • string

        private final java.lang.String string
    • Constructor Detail

      • MethodDescriptor

        private MethodDescriptor​(java.lang.String name,
                                 java.lang.Class<?> parameterType,
                                 java.lang.Class<?> returnType)
      • MethodDescriptor

        private MethodDescriptor​(java.lang.String prefix,
                                 java.lang.String name,
                                 java.lang.Class<?> parameterType,
                                 java.lang.Class<?> returnType)
    • Method Detail

      • generateString

        private java.lang.String generateString()
      • setter

        public static MethodDescriptor setter​(java.lang.String name,
                                              java.lang.Class<?> parameterType)
        Creates a descriptor for a setter method
        Parameters:
        name - name of the setter method
        parameterType - the parameter type accepted by the given setter method
        Returns:
        a "setter" method descriptor
      • getter

        public static MethodDescriptor getter​(java.lang.String name,
                                              java.lang.Class<?> returnType)
        Creates a descriptor for a getter method
        Parameters:
        name - name of the getter method
        returnType - the return type of the given getter method
        Returns:
        a "getter" method descriptor
      • setter

        static MethodDescriptor setter​(java.lang.String prefix,
                                       java.lang.reflect.Method method)
        Creates a descriptor for a setter method
        Parameters:
        prefix - a dot separated string denoting a path of nested object names
        method - a actual class method to be associated with this prefix
        Returns:
        a "setter" method descriptor
      • getter

        static MethodDescriptor getter​(java.lang.String prefix,
                                       java.lang.reflect.Method method)
        Creates a descriptor for a getter method
        Parameters:
        prefix - a dot separated string denoting a path of nested object names
        method - a actual class method to be associated with this prefix
        Returns:
        a "getter" method descriptor
      • getName

        public java.lang.String getName()
        Returns the method name, without the prefix
        Returns:
        the method name
      • getPrefix

        public java.lang.String getPrefix()
        Returns the prefix: a dot separated string denoting a path of nested object names (e.g. customer.contact).
        Returns:
        the object nesting path associated with a method.
      • getParameterType

        public java.lang.Class<?> getParameterType()
        Returns the parameter type associated with a method, if available
        Returns:
        the type of parameter accepted by this method if it is a setter, or null if a getter is being represented.
      • getReturnType

        public java.lang.Class<?> getReturnType()
        Returns the return type associated with a method, if available
        Returns:
        the return type of this method if it is a getter, or null if a setter is being represented.
      • getPrefixedName

        public java.lang.String getPrefixedName()
        Returns full path to a method, (e.g. getName or person.getName
        Returns:
        the path to the given method.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object