// PropertyWithName returns the selected element.
481758
func (s *Schema) PropertyWithName(name string) *Schema {
	return namedSchemaArrayElementWithName(s.Properties, name)
}
463716
func getPropertyName(expr ast.Expr, parser *Parser) propertyName {
	if astTypeSelectorExpr, ok := expr.(*ast.SelectorExpr); ok {
		return parseFieldSelectorExpr(astTypeSelectorExpr, parser, newProperty)
	}

	// check if it is a custom type
	typeName := fmt.Sprintf("%v", expr)
	if actualPrimitiveType, isCustomType := parser.CustomPrimitiveTypes[typeName]; isCustomType {
		return propertyName{SchemaType: actualPrimitiveType, ArrayType: actualPrimitiveType}
	}

	if astTypeIdent, ok := expr.(*ast.Ident); ok {
		name := astTypeIdent.Name
		schemeType := TransToValidSchemeType(name)
		return propertyName{SchemaType: schemeType, ArrayType: schemeType}
	}

	if ptr, ok := expr.(*ast.StarExpr); ok {
		return getPropertyName(ptr.X, parser)
	}

	if astTypeArray, ok := expr.(*ast.ArrayType); ok { // if array
		return getArrayPropertyName(astTypeArray, parser)
	}

	if _, ok := expr.(*ast.MapType); ok { // if map
		//TODO: support map
		return propertyName{SchemaType: "object", ArrayType: "object"}
	}

	if _, ok := expr.(*ast.StructType); ok { // if struct
		return propertyName{SchemaType: "object", ArrayType: "object"}
	}

	if _, ok := expr.(*ast.InterfaceType); ok { // if interface{}
		return propertyName{SchemaType: "object", ArrayType: "object"}
	}

	panic("not supported" + fmt.Sprint(expr))
}
186954
func (ac *AnimationComponent) SelectAnimationByName(name string) {
	ac.CurrentAnimation = ac.Animations[name]
	ac.index = 0
}
722643
func WithName(name string) (Named, error) {
	if len(name) > NameTotalLengthMax {
		return nil, ErrNameTooLong
	}
	if !anchoredNameRegexp.MatchString(name) {
		return nil, ErrReferenceInvalidFormat
	}
	return repository(name), nil
}
1064612
func (b *Build) PropertyValue(name string) interface{} {
	for _, prop := range b.Properties {
		if prop.Name == name {
			return prop.Value
		}
	}

	// Not returning (nil, false) here because it would complicate all
	// practical usage of this function, which simply try to cast the
	// returned value.
	return PropertyNotFound
}
643043
func (s *Schema) DefinitionWithName(name string) *Schema {
	return namedSchemaArrayElementWithName(s.Definitions, name)
}
276595
func (t *Template) GetAWSEC2VPCPeeringConnectionWithName(name string) (*resources.AWSEC2VPCPeeringConnection, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSEC2VPCPeeringConnection:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSEC2VPCPeeringConnection not found", name)
}
647780
func (builder *UpdateHllCommandBuilder) WithKey(key string) *UpdateHllCommandBuilder {
	builder.protobuf.Key = []byte(key)
	return builder
}
1373187
func (t *Object) Select(name interface{}) Type {
	for _, p := range t.static {
		if util.Compare(p.Key, name) == 0 {
			return p.Value
		}
	}
	if t.dynamic != nil {
		if Contains(t.dynamic.Key, TypeOf(name)) {
			return t.dynamic.Value
		}
	}
	return nil
}
1290534
func namedSchemaArrayElementWithName(array *[]*NamedSchema, name string) *Schema {
	if array == nil {
		return nil
	}
	for _, pair := range *array {
		if pair.Name == name {
			return pair.Value
		}
	}
	return nil
}
646030
func ToVarName(name string) string {
	res := ToGoName(name)
	if isInitialism(res) {
		return lower(res)
	}
	if len(res) <= 1 {
		return lower(res)
	}
	return lower(res[:1]) + res[1:]
}
1362429
func (feature *Feature) PropertyStringSlice(propertyName string) []string {
	var result []string
	if property, ok := feature.Properties[propertyName]; ok {
		switch ptype := property.(type) {
		case []string:
			result = ptype
		case []interface{}:
			for _, curr := range ptype {
				if currString, ok := curr.(string); ok {
					result = append(result, currString)
				}
			}
		}
	}
	return result
}
33891
func (e Enum) ValuesWithOption(optionName string) []*EnumValue {
	values := make([]*EnumValue, 0, len(e.Values))
	for _, value := range e.Values {
		if _, ok := value.Options[optionName]; ok {
			values = append(values, value)
		}
	}
	if len(values) > 0 {
		return values
	}
	return nil
}
875723
func (s *PropertyNameSuggestion) SetPropertyName(v string) *PropertyNameSuggestion {
	s.PropertyName = &v
	return s
}
1121554
func packageWithName(name string) (pkg *build.Package, err error) {
	pkg, err = build.Default.Import(name, ".", build.ImportMode(0))
	if err == nil {
		return
	}

	pkg, err = build.Default.Import(name, ".", build.ImportMode(1))
	return
}
1289346
func (e EventBuilder) Name() string {
	strs := make([]string, len(e.fields))
	for i, field := range e.fields {
		strs[i] = field.value
	}

	return strings.Join(strs, "")
}
971256
func (b *HogeJSONBuilder) AddByNames(names ...string) *HogeJSONBuilder {
	for _, name := range names {
		info := b._structPropertyMap[name]
		if info == nil {
			continue
		}
		b._properties[info.fieldName] = info
	}
	return b
}