code: private static MethodInfo getTemplateSubstituteMethod(InputStream in) throws IOException {
  
          ClassFile classFile = ClassFile.readFrom(in);
  
          MethodInfo substituteMethod = null;
          MethodInfo[] all = classFile.getMethods();
  
          // find the execute method on this template
          for (int i = 0; i < all.length; i++) {
  
              if ("substitute".equals(
                  all[i].getName()) &&
                  all[i].getMethodDescriptor().getParameterCount() == 1) {
                  substituteMethod = all[i];
                  break;
              }
          }
          in.close();
          return substituteMethod;
      }
docs: Find the substitute method on the class file input stream.