<commit_before>/*
 * Created on 7 Aug 2006
 */
package uk.org.ponder.springutil;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import uk.org.ponder.stringutil.StringList;

/** A TargetListAggregatingBean that will acquire all beans of a particular
 * type (excluding Factory products) and automatically make them 
 *  request-addressible.
 * @author <NAME> (<EMAIL>)
 *
 */

public class ByClassTLAB extends StaticTLAB implements ApplicationContextAware {
  private Class targetClass;

  public void setTargetClass(Class targetClass) {
    this.targetClass = targetClass;
  }
  
  public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    String[] beannames = applicationContext.getBeanNamesForType(
        targetClass, false, false);
    setValue(new StringList(beannames));
  }

}<commit_msg>StaticTemplateResolverStrategy introduced Old apps working once more<commit_after>/*
 * Created on 7 Aug 2006
 */
package uk.org.ponder.springutil;

import java.util.ArrayList;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import uk.org.ponder.stringutil.StringList;

/**
 * A TargetListAggregatingBean that will acquire all beans of a particular type
 * (excluding Factory products) and register their *names* as the TLAB target.
 * 
 * @author <NAME> (<EMAIL>)
 * 
 */

public class ByClassTLAB extends StaticTLAB implements ApplicationContextAware {
  private Class targetClass;
  private boolean deliverBeans;

  public void setTargetClass(Class targetClass) {
    this.targetClass = targetClass;
  }

  /**
   * If set to <code>true</code> (the default is <code>false</code> this
   * will deliver a list the actual beans as the TLAB value rather than just a
   * list of their names.
   */
  public void setDeliverBeans(boolean deliverBeans) {
    this.deliverBeans = deliverBeans;
  }

  public void setApplicationContext(ApplicationContext applicationContext)
      throws BeansException {
    String[] beannames = applicationContext.getBeanNamesForType(targetClass,
        false, false);
    if (deliverBeans) {
      ArrayList beans = new ArrayList();
      for (int i = 0; i < beannames.length; ++i) {
        beans.add(applicationContext.getBean(beannames[i]));
      }
      setValue(beans);
    }
    else {
      setValue(new StringList(beannames));
    }
  }

}
{'fraction_non_alphanumeric': 0.08607198748043818, 'fraction_numerical': 0.004303599374021909, 'mean_word_length': 4.2939958592132506, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '678746', 'n_tokens_mistral': 726, 'n_tokens_neox': 702, 'n_words': 199}