<commit_before>/*
 * Copyright 2002-2006 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.beans.factory.support;


/**
 * Programmatic builder-style object to make it easier to construct bean definitions.
 * Intended for use primarily when authoring Spring 2.0 NamespaceHandlers.
 * 
 * @since 2.0
 * @author <NAME>
 * @see org.springframework.beans.factory.support.RootBeanDefinition
 * @see org.springframework.beans.factory.support.ChildBeanDefinition
 */
public class BeanDefinitionRegistryBuilder {
	
	private final BeanDefinitionRegistry registry;
	
	public BeanDefinitionRegistryBuilder(BeanDefinitionRegistry registry) {
		this.registry = registry;
	}
	
	/**
	 * Registered a named bean
	 * @param name bean name
	 * @param builder BeanDefinitionBuilder that is source of bean definition
	 * @return the builder parameter, allowing further configuration
	 */
	public BeanDefinitionBuilder register(String name, BeanDefinitionBuilder builder) {
		builder.assignBeanName(name);
		registry.registerBeanDefinition(name, builder.getBeanDefinition());
		return builder;
	}
	
	/**
	 * Register an anonymous bean. A unique bean name will be generated, based on the owning
	 * BeanDefinitionRegistry
	 * @param builder BeanDefinitionBuilder that is source of bean definition
	*  @return the builder parameter, allowing further configuration
	 */
	public BeanDefinitionBuilder register(BeanDefinitionBuilder builder) {
		String generatedBeanName = BeanDefinitionReaderUtils.generateBeanName(builder.getBeanDefinition(), registry, false);
		return register(generatedBeanName, builder);
	}
	
	// TODO aliases
	

}<commit_msg>Javadoc correction<commit_after>/*
 * Copyright 2002-2006 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.beans.factory.support;


/**
 * Programmatic builder-style object to make it easier to construct bean definitions.
 * Intended for use primarily when authoring Spring 2.0 NamespaceHandlers.
 * 
 * @since 2.0
 * @author <NAME>
 * @see org.springframework.beans.factory.support.BeanDefinitionBuilder
 * @see org.springframework.beans.factory.support.BeanDefinitionReaderUtils
 */
public class BeanDefinitionRegistryBuilder {
	
	private final BeanDefinitionRegistry registry;
	
	/**
	 * Construct a new BeanDefinitionBuilder that will register beans with this
	 * registry
	 * @param registry registry to register beans with
	 */
	public BeanDefinitionRegistryBuilder(BeanDefinitionRegistry registry) {
		this.registry = registry;
	}
	
	/**
	 * Registered a named bean
	 * @param name bean name
	 * @param builder BeanDefinitionBuilder that is source of bean definition
	 * @return the builder parameter, allowing further configuration
	 */
	public BeanDefinitionBuilder register(String name, BeanDefinitionBuilder builder) {
		builder.assignBeanName(name);
		registry.registerBeanDefinition(name, builder.getBeanDefinition());
		return builder;
	}
	
	/**
	 * Register a bean without specifying a name. A unique bean name will be generated, based on the owning
	 * BeanDefinitionRegistry. The bean will still be a top level bean, not a nested
	 * bean.
	 * @param builder BeanDefinitionBuilder that is source of bean definition
	*  @return the builder parameter, allowing further configuration
	 */
	public BeanDefinitionBuilder register(BeanDefinitionBuilder builder) {
		String generatedBeanName = BeanDefinitionReaderUtils.generateBeanName(builder.getBeanDefinition(), registry, false);
		return register(generatedBeanName, builder);
	}
	
	// TODO aliases
	

}
{'fraction_non_alphanumeric': 0.07136696852091419, 'fraction_numerical': 0.0068995256576110395, 'mean_word_length': 4.542413381123058, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4827090', 'n_tokens_mistral': 1194, 'n_tokens_neox': 1084, 'n_words': 453}