func suiteMethod(method reflect.Method) *MethodType {
	mtype := method.Type
	mname := method.Name
	inNum := mtype.NumIn()
	outNum := mtype.NumOut()

	// Method must be exported.
	if method.PkgPath != "" {
		return nil
	}

	var (
		replyType, ctxType reflect.Type
		argsType           []reflect.Type
	)

	// this method is in RPCService
	// we force users must implement RPCService interface in their provider
	// and RPCService has only one method "Reference"
	// In general, this method should not be exported to client
	// so we ignore this method
	// see RPCService
	if mname == "Reference" {
		return nil
	}

	if outNum != 1 && outNum != 2 {
		logger.Warnf("method %s of mtype %v has wrong number of in out parameters %d; needs exactly 1/2",
			mname, mtype.String(), outNum)
		return nil
	}

	// The latest return type of the method must be error.
	if returnType := mtype.Out(outNum - 1); returnType != typeOfError {
		logger.Warnf("the latest return type %s of method %q is not error", returnType, mname)
		return nil
	}

	// replyType
	if outNum == 2 {
		replyType = mtype.Out(0)
		/*if !isExportedOrBuiltinType(replyType) {
			logger.Errorf("reply type of method %s not exported{%v}", mname, replyType)
			return nil
		}*/
	}

	index := 1

	// ctxType
	if inNum > 1 && mtype.In(1).String() == "context.Context" {
		ctxType = mtype.In(1)
		index = 2
	}

	for ; index < inNum; index++ {
		argsType = append(argsType, mtype.In(index))
		/*// need not be a pointer.
		if !isExportedOrBuiltinType(mtype.In(index)) {
			logger.Errorf("argument type of method %q is not exported %v", mname, mtype.In(index))
			return nil
		}*/
	}

	return &MethodType{method: method, argsType: argsType, replyType: replyType, ctxType: ctxType}
}
// suiteMethod returns a suitable Rpc methodType
suiteMethod returns a suitable Rpc methodType
// suiteMethod returns a suitable Rpc methodType
func suiteMethod(method reflect.Method) *MethodType {
	mtype := method.Type
	mname := method.Name
	inNum := mtype.NumIn()
	outNum := mtype.NumOut()
	if method.PkgPath != "" {
		return nil
	}
	var (
		replyType, ctxType reflect.Type
		argsType           []reflect.Type
	)
	if mname == "Reference" {
		return nil
	}
	if outNum != 1 && outNum != 2 {
		logger.Warnf("method %s of mtype %v has wrong number of in out parameters %d; needs exactly 1/2",
			mname, mtype.String(), outNum)
		return nil
	}
	if returnType := mtype.Out(outNum - 1); returnType != typeOfError {
		logger.Warnf("the latest return type %s of method %q is not error", returnType, mname)
		return nil
	}
	if outNum == 2 {
		replyType = mtype.Out(0)
	}
	index := 1
	if inNum > 1 && mtype.In(1).String() == "context.Context" {
		ctxType = mtype.In(1)
		index = 2
	}
	for ; index < inNum; index++ {
		argsType = append(argsType, mtype.In(index))
	}
	return &MethodType{method: method, argsType: argsType, replyType: replyType, ctxType: ctxType}
}
func suiteMethod ( method reflect . Method ) * MethodType { mtype := method . Type mname := method . Name inNum := mtype . NumIn ( ) outNum := mtype . NumOut ( ) if method . PkgPath != " " { return nil } var ( replyType , ctxType reflect . Type argsType [ ] reflect . Type ) if mname == " " { return nil } if outNum != 1 && outNum != 2 { logger . Warnf ( " " , mname , mtype . String ( ) , outNum ) return nil } if returnType := mtype . Out ( outNum - 1 ) ; returnType != typeOfError { logger . Warnf ( " " , returnType , mname ) return nil } if outNum == 2 { replyType = mtype . Out ( 0 ) } index := 1 if inNum > 1 && mtype . In ( 1 ) . String ( ) == " " { ctxType = mtype . In ( 1 ) index = 2 } for ; index < inNum ; index ++ { argsType = append ( argsType , mtype . In ( index ) ) } return & MethodType { method : method , argsType : argsType , replyType : replyType , ctxType : ctxType } }
suiteMethod returns a suitable Rpc methodType
suiteMethod returns a suitable Rpc methodType
// Method must be exported. // this method is in RPCService // we force users must implement RPCService interface in their provider // and RPCService has only one method "Reference" // In general, this method should not be exported to client // so we ignore this method // see RPCService // The latest return type of the method must be error. // replyType /*if !isExportedOrBuiltinType(replyType) {
			logger.Errorf("reply type of method %s not exported{%v}", mname, replyType)
			return nil
		}*/ // ctxType /*// need not be a pointer.
		if !isExportedOrBuiltinType(mtype.In(index)) {
			logger.Errorf("argument type of method %q is not exported %v", mname, mtype.In(index))
			return nil
		}*/