com.fasterxml.classmate.members.ResolvedMethod Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of classmate Show documentation
Show all versions of classmate Show documentation
Library for introspecting types with full generic information
including resolving of field and method types.
package com.fasterxml.classmate.members;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import com.fasterxml.classmate.Annotations;
import com.fasterxml.classmate.ResolvedType;
public final class ResolvedMethod extends ResolvedParameterizedMember
implements Comparable
{
public ResolvedMethod(ResolvedType context, Annotations ann, Method method,
ResolvedType returnType, ResolvedType[] argumentTypes)
{
super(context, ann, method, returnType, argumentTypes);
}
/*
/**********************************************************************
/* Simple accessors from base class
/**********************************************************************
*/
public boolean isAbstract() {
return Modifier.isAbstract(getModifiers());
}
public boolean isStrict() {
return Modifier.isStrict(getModifiers());
}
public boolean isNative() {
return Modifier.isNative(getModifiers());
}
public boolean isSynchronized() {
return Modifier.isSynchronized(getModifiers());
}
/*
/**********************************************************************
/* Extended API
/**********************************************************************
*/
public ResolvedType getReturnType() { return getType(); }
/*
/**********************************************************************
/* Standard method override
/**********************************************************************
*/
@Override
public int compareTo(ResolvedMethod other)
{
// primary sort by name (alphabetic); secondary by arg count (ascending)
int diff = getName().compareTo(other.getName());
if (diff == 0) {
// subtract fine, no fear of overflow here
diff = getArgumentCount() - other.getArgumentCount();
}
return diff;
}
}