// NewFooJSONBuilder make new FooJSONBuilder.
768446
func NewFooJSONBuilder() *FooJSONBuilder {
	jb := &FooJSONBuilder{
		_properties:        map[string]*FooPropertyInfo{},
		_jsonPropertyMap:   map[string]*FooPropertyInfo{},
		_structPropertyMap: map[string]*FooPropertyInfo{},
		Test: &FooPropertyInfo{
			fieldName: "Test",
			jsonName:  "test",
			Encoder: func(src *Foo, dest *FooJSON) error {
				if src == nil {
					return nil
				}
				dest.Test = src.Test
				return nil
			},
			Decoder: func(src *FooJSON, dest *Foo) error {
				if src == nil {
					return nil
				}
				dest.Test = src.Test
				return nil
			},
		},
	}
	jb._structPropertyMap["Test"] = jb.Test
	jb._jsonPropertyMap["test"] = jb.Test
	return jb
}
271505
func (o *ResourceBuilderFlags) ToBuilder(restClientGetter RESTClientGetter, resources []string) ResourceFinder {
	namespace, enforceNamespace, namespaceErr := restClientGetter.ToRawKubeConfigLoader().Namespace()

	builder := resource.NewBuilder(restClientGetter).
		NamespaceParam(namespace).DefaultNamespace()

	if o.Scheme != nil {
		builder.WithScheme(o.Scheme, o.Scheme.PrioritizedVersionsAllGroups()...)
	} else {
		builder.Unstructured()
	}

	if o.FileNameFlags != nil {
		opts := o.FileNameFlags.ToOptions()
		builder.FilenameParam(enforceNamespace, &opts)
	}

	if o.Local == nil || !*o.Local {
		// resource type/name tuples only work non-local
		if o.All != nil {
			builder.ResourceTypeOrNameArgs(*o.All, resources...)
		} else {
			builder.ResourceTypeOrNameArgs(false, resources...)
		}
		// label selectors only work non-local (for now)
		if o.LabelSelector != nil {
			builder.LabelSelectorParam(*o.LabelSelector)
		}
		// field selectors only work non-local (forever)
		if o.FieldSelector != nil {
			builder.FieldSelectorParam(*o.FieldSelector)
		}
		// latest only works non-local (forever)
		if o.Latest {
			builder.Latest()
		}

	} else {
		builder.Local()

		if len(resources) > 0 {
			builder.AddError(resource.LocalResourceError)
		}
	}

	if !o.StopOnFirstError {
		builder.ContinueOnError()
	}

	return &ResourceFindBuilderWrapper{
		builder: builder.
			Flatten(). // I think we're going to recommend this everywhere
			AddError(namespaceErr),
	}
}
1168560
func NewCoffeeCompiler() *CoffeeCompiler {
	ret := &CoffeeCompiler{
		jsvm: duktape.New(),
	}
	ret.jsvm.EvalString(getLibCoffee())
	ret.jsvm.EvalString("CompiledError = '';")
	return ret
}
608366
func ServeWithBuilder(spec *loads.Document, api *untyped.API, builder Builder) http.Handler {
	context := NewContext(spec, api, nil)
	return context.APIHandler(builder)
}
510108
func (mr *MockBuilderFactoryMockRecorder) NewBuilder(arg0, arg1 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewBuilder", reflect.TypeOf((*MockBuilderFactory)(nil).NewBuilder), arg0, arg1)
}
1124030
func (j *JSONBuiltin) NewDecoder(r io.Reader) Decoder {
	return json.NewDecoder(r)
}
885636
func NewBarJSONBuilder() *BarJSONBuilder {
	jb := &BarJSONBuilder{
		_properties:        map[string]*BarPropertyInfo{},
		_jsonPropertyMap:   map[string]*BarPropertyInfo{},
		_structPropertyMap: map[string]*BarPropertyInfo{},
		Tests: &BarPropertyInfo{
			fieldName: "Tests",
			jsonName:  "tests",
			Encoder: func(src *Bar, dest *BarJSON) error {
				if src == nil {
					return nil
				}
				dest.Tests = src.Tests
				return nil
			},
			Decoder: func(src *BarJSON, dest *Bar) error {
				if src == nil {
					return nil
				}
				dest.Tests = src.Tests
				return nil
			},
		},
	}
	jb._structPropertyMap["Tests"] = jb.Tests
	jb._jsonPropertyMap["tests"] = jb.Tests
	return jb
}
379738
func NewManifestBuilder(bs distribution.BlobService, configMediaType string, configJSON []byte) distribution.ManifestBuilder {
	mb := &builder{
		bs:              bs,
		configMediaType: configMediaType,
		configJSON:      make([]byte, len(configJSON)),
	}
	copy(mb.configJSON, configJSON)

	return mb
}
5661
func newBuilder() balancer.Builder {
	return base.NewBalancerBuilderWithConfig(Name, &rrPickerBuilder{}, base.Config{HealthCheck: true})
}
1147550
func New(w io.Writer, opts *BuilderOpts) (*Builder, error) {
	return newBuilder(w, opts)
}
1331292
func NewBuildManager(b builder.Backend, sg SessionGetter, fsCache *fscache.FSCache, identityMapping *idtools.IdentityMapping) (*BuildManager, error) {
	bm := &BuildManager{
		backend:   b,
		pathCache: &syncmap.Map{},
		sg:        sg,
		idMapping: identityMapping,
		fsCache:   fsCache,
	}
	if err := fsCache.RegisterTransport(remotecontext.ClientSessionRemote, NewClientSessionTransport()); err != nil {
		return nil, err
	}
	return bm, nil
}
997516
func NewRepoBuilder(gun data.GUN, cs signed.CryptoService, trustpin trustpinning.TrustPinConfig) RepoBuilder {
	return NewBuilderFromRepo(gun, NewRepo(cs), trustpin)
}
61850
func newBuilder(backupDir string, filesToBackUp []string, db DBDumper) (b *builder, err error) {
	// Create the backups workspace root directory.
	rootDir, err := ioutil.TempDir(backupDir, tempPrefix)
	if err != nil {
		return nil, errors.Annotate(err, "while making backups workspace")
	}

	// Populate the builder.
	b = &builder{
		rootDir:       rootDir,
		archivePaths:  NewNonCanonicalArchivePaths(rootDir),
		filename:      filepath.Join(rootDir, TempFilename),
		filesToBackUp: filesToBackUp,
		db:            db,
	}
	defer func() {
		if err != nil {
			if cerr := b.cleanUp(true); cerr != nil {
				cerr.Log(logger)
			}
		}
	}()

	// Create all the direcories we need.  We go with user-only
	// permissions on principle; the directories are short-lived so in
	// practice it shouldn't matter much.
	err = os.MkdirAll(b.archivePaths.DBDumpDir, 0700)
	if err != nil {
		return nil, errors.Annotate(err, "while creating temp directories")
	}

	// Create the archive files.  We do so here to fail as early as
	// possible.
	b.archiveFile, err = os.Create(b.filename)
	if err != nil {
		return nil, errors.Annotate(err, "while creating archive file")
	}

	b.bundleFile, err = os.Create(b.archivePaths.FilesBundle)
	if err != nil {
		return nil, errors.Annotate(err, `while creating bundle file`)
	}

	return b, nil
}
307327
func NewUpdateHllCommandBuilder() *UpdateHllCommandBuilder {
	return &UpdateHllCommandBuilder{
		protobuf: &rpbRiakDT.DtUpdateReq{
			Op: &rpbRiakDT.DtOp{
				HllOp: &rpbRiakDT.HllOp{},
			},
		},
	}
}
1064893
func NewPgsqlBuilder(db *DB, executor Executor) Builder {
	return &PgsqlBuilder{
		NewBaseBuilder(db, executor),
		NewBaseQueryBuilder(db),
	}
}
587177
func NewParser(r io.Reader, builder *Builder, options ...ParserOptions) *Parser {
	d := json.NewDecoder(r)
	d.UseNumber()
	p := &Parser{
		decoder: d,
		builder: builder,
	}
	if len(options) > 0 {
		p.options = options[0]
	}
	return p
}
239354
func newBuildListener(streamNamePrefix string, onErr func(error)) *buildListener {
	if onErr == nil {
		panic("onErr is nil")
	}

	streamNamePrefix = strings.TrimSuffix(streamNamePrefix, "/") + "/"
	return &buildListener{
		streamNamePrefix: streamNamePrefix,
		buildStreamName:  streamNamePrefix + BuildStreamName,
		onErr:            onErr,
	}
}