001 package com.softwarementors.extjs.djn.api; 002 003 import java.lang.reflect.Method; 004 005 import com.softwarementors.extjs.djn.StringUtils; 006 007 import edu.umd.cs.findbugs.annotations.NonNull; 008 009 public abstract class RegisteredMethod { 010 @NonNull private RegisteredAction action; 011 @NonNull private Method method; 012 @NonNull private String name; 013 014 protected RegisteredMethod( RegisteredAction action, Method method, String name ) { 015 assert action != null; 016 assert method != null; 017 assert !StringUtils.isEmpty(name); 018 019 this.action = action; 020 this.method = method; 021 this.name = name; 022 } 023 024 public RegisteredAction getAction() { 025 return this.action; 026 } 027 028 public Method getMethod() { 029 return this.method; 030 } 031 032 public Class<?>[] getParameterTypes() { 033 return this.method.getParameterTypes(); 034 } 035 036 public int getParameterCount() { 037 return getParameterTypes().length; 038 } 039 040 public Class<?> getReturnType() { 041 return this.method.getReturnType(); 042 } 043 044 public Class<?> getActionClass() { 045 return this.action.getActionClass(); 046 } 047 048 public String getName() { 049 return this.name; 050 } 051 052 public String getActionName() { 053 return getAction().getName(); 054 } 055 056 public String getFullName() { 057 return getActionName() + "." + getName(); 058 } 059 060 public String getFullJavaMethodName() { 061 return getAction().getFullJavaClassName() + "." + getMethod().getName(); 062 } 063 064 public abstract RegisteredMethodType getType(); 065 }