// TypeNameForStub returns a capitalized name to use for a generated type.
970806
func (domain *Domain) TypeNameForStub(stub string) string {


	return domain.Prefix + strings.ToUpper(stub[0:1]) + stub[1:len(stub)]
}
1093846
func (typeProperty *TypeProperty) FieldName() string {
	propertyName := typeProperty.Name
	if propertyName == "$ref" {
		return "XRef"
	}
	return strings.Title(snakeCaseToCamelCase(propertyName))
}
788762
func genCustomTypeName(tstr string) string {
	len2 := genBase64enc.EncodedLen(len(tstr))
	bufx := make([]byte, len2)
	genBase64enc.Encode(bufx, []byte(tstr))
	for i := len2 - 1; i >= 0; i-- {
		if bufx[i] == '=' {
			len2--
		} else {
			break
		}
	}
	return string(bufx[:len2])
}
97662
func (e *engineImpl) genTopicAndSubNames(c context.Context, manager, publisher string) (topic string, sub string) {
	// Avoid accidental override of the topic when running on dev server.
	prefix := "scheduler"
	if info.IsDevAppServer(c) {
		prefix = "dev-scheduler"
	}

	// Each publisher gets its own topic (and subscription), so it's clearer from
	// logs and PubSub console who's calling what. PubSub topics can't have "@" in
	// them, so replace "@" with "~". URL encoding could have been used too, but
	// Cloud Console confuses %40 with its own URL encoding and doesn't display
	// all pages correctly.
	id := fmt.Sprintf("%s.%s.%s",
		prefix,
		manager,
		strings.Replace(publisher, "@", "~", -1))

	appID := info.AppID(c)
	topic = fmt.Sprintf("projects/%s/topics/%s", appID, id)
	sub = fmt.Sprintf("projects/%s/subscriptions/%s", appID, id)
	return
}
874336
func getDefaultModelSpecName(typ reflect.Type) string {
	// Strip any dereference operators
	for typ.Kind() == reflect.Ptr {
		typ = typ.Elem()
	}
	nameWithPackage := typ.String()
	// Strip the package name
	return strings.Join(strings.Split(nameWithPackage, ".")[1:], "")
}
543451
func TypeByName(typeName string) Type {
	initOnce.Do(discoverTypes)
	return Type2(types[typeName])
}
1337746
func getTypeName(e interface{}) string {
	if err, ok := e.(error); ok {
		e = errors.Cause(err)
	}
	return fmt.Sprintf("%T", e)
}
1195686
func typeFor(k reflect.Kind) reflect.Type {
	if k > 0 && int(k) < len(kindToType) {
		return kindToType[k]
	}
	return nil
}
341008
func BuildNameForConfigVersion(name string, version int) string {
	return fmt.Sprintf("%s-%d", name, version)
}
440849
func FriendlyTypeName(s *spec.Schema) string {
	refType := RefType(s)
	if refType == "" { // a base type, e.g. "string"
		return s.Type[0]
	}

	// convert, e.g. "io.k8s.kubernetes.pkg.api.v1.Pod" -> "v1.Pod"
	parts := strings.Split(refType, ".")
	return strings.Join(parts[len(parts)-2:], ".")
}
509273
func (s *InventoryItem) SetTypeName(v string) *InventoryItem {
	s.TypeName = &v
	return s
}
682473
func extractTypeName(tip string) string {
	// trim all spaces
	tip = strings.TrimSpace(tip)

	// detect array
	if strings.Index(tip, "]") < 0 {
		return tip
	}

	// find type inside square bracket
	inBracket := reSquareBracket.FindString(tip)
	if inBracket == "" {
		return tip
	}
	last := strings.LastIndex(inBracket, "[")
	inBracket = inBracket[last+1:]
	return strings.TrimSuffix(inBracket, "]")
}
722396
func (s *ColumnMetadata) SetTypeName(v string) *ColumnMetadata {
	s.TypeName = &v
	return s
}
266004
func (l VirtualDeviceList) TypeName(device types.BaseVirtualDevice) string {
	dtype := reflect.TypeOf(device)
	if dtype == nil {
		return ""
	}
	return dtype.Elem().Name()
}
834017
func PascalCaseTypeName(tip TypeInBody) string {
	methodName := commons.SnackCaseServerMethodName(tip.Endpoint.Method.DisplayName, tip.Endpoint.Verb, tip.Endpoint.Resource)
	suffix := commons.ReqBodySuffix
	if tip.ReqResp == HTTPResponse {
		suffix = commons.RespBodySuffix
	}
	return casee.ToPascalCase(methodName + suffix)
}
505488
func mergeTypeName(name, rtName string, apiDef *APIDefinition) string {
	if apiDef == nil {
		log.Warning("passing nil API definition to mergeTypeName")
		return name
	}

	// check if this resource type is in library
	splt := strings.Split(rtName, ".")
	if len(splt) < 2 {
		// if not in library, we need to do nothing
		return name
	}

	// get the library object from API definition root object
	libName := splt[0]
	lib, ok := apiDef.Libraries[libName]
	if !ok {
		return name
	}

	// type not exist in the library
	if _, ok := lib.Types[name]; !ok {
		return name
	}

	return strings.Join([]string{libName, name}, ".")
}
205902
func (n *lowercaseSingularNamer) Name(t *types.Type) string {
	return strings.ToLower(t.Name.Name)
}