public class Method extends Object
A class Method. Date: 24/10/2016
Yaron Yamin
  • Constructor Details

    • Method

      public Method(String methodId, String name, Type returnType, String ownerClassCanonicalType, List<Param> methodParams, String methodExceptionTypes, boolean isPrivate, boolean isProtected, boolean isDefault, boolean isPublic, boolean isAbstract, boolean isNative, boolean isStatic, boolean isSetter, boolean isGetter, boolean constructor, boolean overridden, boolean inherited, boolean isInInterface, boolean isSynthetic, String propertyName, boolean accessible, boolean primaryConstructor, boolean testable)
  • Method Details

    • hasReturn

      public boolean hasReturn()
      true - if method has a return type and not void
    • hasParams

      public boolean hasParams()
      true - if method has parameters
    • getMethodId

      public String getMethodId()
      formatted method id. a string used to uniquely discriminate this method from others
    • getName

      public String getName()
      method name
    • getReturnType

      public Type getReturnType()
      Method's return type
    • getOwnerClassCanonicalType

      public String getOwnerClassCanonicalType()
      method owner type cannonical name
    • getMethodParams

      public List<Param> getMethodParams()
      method arguments
    • getMethodExceptionTypes

      public String getMethodExceptionTypes()
      method exception types
    • isPrivate

      public boolean isPrivate()
      true - if method has private modifier
    • isProtected

      public boolean isProtected()
      true - if method has protected modifier
    • isDefault

      public boolean isDefault()
      true - if method has default (package-private access modifier)
    • isPublic

      public boolean isPublic()
      true - if method has public modifier
    • isAbstract

      public boolean isAbstract()
      true - if method is abstract
    • isNative

      public boolean isNative()
      true - if method defined as native
    • isStatic

      public boolean isStatic()
      true - if this is a static method
    • isSetter

      public boolean isSetter()
      true - if method is a setter
    • isGetter

      public boolean isGetter()
      true - if method is a getter
    • isConstructor

      public boolean isConstructor()
      true - if method is a constructor
    • isOverridden

      public boolean isOverridden()
      true - if method is overridden in child class
    • isInherited

      public boolean isInherited()
      true - if method is inherited from parent class
    • isInInterface

      public boolean isInInterface()
      true - if owner type is an interface
    • isSynthetic

      public boolean isSynthetic()
      true - if method is synthetically generated. common for scala methods
    • getPropertyName

      public String getPropertyName()
      the underlying field property name. relevant for getter/setter
    • isAccessible

      public boolean isAccessible()
      true - when accessible from class under test
    • isPrimaryConstructor

      public boolean isPrimaryConstructor()
      true - is Primary Constructor (relevant for Scala)
    • isTestable

      public boolean isTestable()
      true - method is accessible and can be relevant for unit testing
    • getDirectMethodCalls

      public Set<MethodCall> getDirectMethodCalls()
      methods called directly from this method
    • getMethodCalls

      public Set<MethodCall> getMethodCalls()
      methods called directly from this method or on the call stack from this method via other methods belonging to the same type hierarchy
    • getMethodReferences

      public Set<Method> getMethodReferences()
      methods referenced from this method. i.e. SomeClassName::someMethodName
    • getInternalReferences

      public Set<Reference> getInternalReferences()
      references included in this method's implementation
    • getIndirectlyAffectedFields

      public Set<Field> getIndirectlyAffectedFields()
      Fields affected (assigned to) by methods called from this method. currently calculated only for constructors. i.e. when delegating to other constructors
    • equals

      public boolean equals(Object o)
      equals in class Object
    • hashCode

      public int hashCode()
      hashCode in class Object
    • toString

      public String toString()
      toString in class Object