Package org.springframework.beans

Examples of org.springframework.beans.PropertyEditorRegistrar


    if (registrySupport != null) {
      registrySupport.useConfigValueEditors();
    }
    if (!this.propertyEditorRegistrars.isEmpty()) {
      for (Iterator it = this.propertyEditorRegistrars.iterator(); it.hasNext();) {
        PropertyEditorRegistrar registrar = (PropertyEditorRegistrar) it.next();
        try {
          registrar.registerCustomEditors(registry);
        }
        catch (BeanCreationException ex) {
          Throwable rootCause = ex.getMostSpecificCause();
          if (rootCause instanceof BeanCurrentlyInCreationException) {
            BeanCreationException bce = (BeanCreationException) rootCause;
            if (isCurrentlyInCreation(bce.getBeanName())) {
              if (logger.isDebugEnabled()) {
                logger.debug("PropertyEditorRegistrar [" + registrar.getClass().getName() +
                    "] failed because it tried to obtain currently created bean '" + ex.getBeanName() +
                    "': " + ex.getMessage());
              }
              onSuppressedException(ex);
              continue;
View Full Code Here


        (registry instanceof PropertyEditorRegistrySupport ? (PropertyEditorRegistrySupport) registry : null);
    if (registrySupport != null) {
      registrySupport.useConfigValueEditors();
    }
    for (Iterator it = this.propertyEditorRegistrars.iterator(); it.hasNext();) {
      PropertyEditorRegistrar registrar = (PropertyEditorRegistrar) it.next();
      registrar.registerCustomEditors(registry);
    }
    for (Iterator it = this.customEditors.entrySet().iterator(); it.hasNext();) {
      Map.Entry entry = (Map.Entry) it.next();
      Class clazz = (Class) entry.getKey();
      PropertyEditor editor = (PropertyEditor) entry.getValue();
View Full Code Here

    if (registrySupport != null) {
      registrySupport.useConfigValueEditors();
    }
    if (!this.propertyEditorRegistrars.isEmpty()) {
      for (Iterator it = this.propertyEditorRegistrars.iterator(); it.hasNext();) {
        PropertyEditorRegistrar registrar = (PropertyEditorRegistrar) it.next();
        try {
          registrar.registerCustomEditors(registry);
        }
        catch (BeanCreationException ex) {
          Throwable rootCause = ex.getMostSpecificCause();
          if (rootCause instanceof BeanCurrentlyInCreationException) {
            BeanCreationException bce = (BeanCreationException) rootCause;
            if (isCurrentlyInCreation(bce.getBeanName())) {
              if (logger.isDebugEnabled()) {
                logger.debug("PropertyEditorRegistrar [" + registrar.getClass().getName() +
                    "] failed because it tried to obtain currently created bean '" + ex.getBeanName() +
                    "': " + ex.getMessage());
              }
              onSuppressedException(ex);
              continue;
View Full Code Here

    return reportEngine;
  }

  private static <T extends NamedService> BeanFactory<T> createServiceBuilder(Class<T> type) {
    PropertyEditorRegistrar propertyEditorRegistrar = new KoljaPropertyEditorRegistrar();
    return new BeanBuilder<T>(propertyEditorRegistrar, new ServiceFactory<T>(type));
  }
View Full Code Here

    return reports;
  }

  @SuppressWarnings("unchecked")
  public static BeanFactory<TextReport<?>> createReportBuilder() {
    PropertyEditorRegistrar propertyEditorRegistrar = new KoljaPropertyEditorRegistrar();

    ServiceFactory<TextReport<?>> serviceFactory = new ServiceFactory(TextReport.class);
    ScriptReportFactory factory = new ScriptReportFactory(serviceFactory);
    return new BeanBuilder<TextReport<?>>(propertyEditorRegistrar, factory);
  }
View Full Code Here

    if (registrySupport != null) {
      registrySupport.useConfigValueEditors();
    }
    if (!this.propertyEditorRegistrars.isEmpty()) {
      for (Iterator it = this.propertyEditorRegistrars.iterator(); it.hasNext();) {
        PropertyEditorRegistrar registrar = (PropertyEditorRegistrar) it.next();
        try {
          registrar.registerCustomEditors(registry);
        }
        catch (BeanCreationException ex) {
          Throwable rootCause = ex.getMostSpecificCause();
          if (rootCause instanceof BeanCurrentlyInCreationException) {
            BeanCreationException bce = (BeanCreationException) rootCause;
            if (isCurrentlyInCreation(bce.getBeanName())) {
              if (logger.isDebugEnabled()) {
                logger.debug("PropertyEditorRegistrar [" + registrar.getClass().getName() +
                    "] failed because it tried to obtain currently created bean '" + ex.getBeanName() +
                    "': " + ex.getMessage());
              }
              onSuppressedException(ex);
              continue;
View Full Code Here

  public void testCustomEditorConfigurerWithPropertyEditorRegistrar() throws ParseException {
    DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
    CustomEditorConfigurer cec = new CustomEditorConfigurer();
    final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN);
    cec.setPropertyEditorRegistrars(new PropertyEditorRegistrar[] {
        new PropertyEditorRegistrar() {
          @Override
          public void registerCustomEditors(PropertyEditorRegistry registry) {
            registry.registerCustomEditor(Date.class, new CustomDateEditor(df, true));
          }
        }});
View Full Code Here

  }

  @Test
  public void testCustomEditor() {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    lbf.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
      @Override
      public void registerCustomEditors(PropertyEditorRegistry registry) {
        NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
        registry.registerCustomEditor(Float.class, new CustomNumberEditor(Float.class, nf, true));
      }
View Full Code Here

  }

  @Test
  public void testCustomEditorWithBeanReference() {
    DefaultListableBeanFactory lbf = new DefaultListableBeanFactory();
    lbf.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
      @Override
      public void registerCustomEditors(PropertyEditorRegistry registry) {
        NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
        registry.registerCustomEditor(Float.class, new CustomNumberEditor(Float.class, nf, true));
      }
View Full Code Here

  public void setUp() throws Exception {
    Assume.group(TestGroup.PERFORMANCE);

    DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
    new XmlBeanDefinitionReader(factory).loadBeanDefinitions(CONTEXT);
    factory.addPropertyEditorRegistrar(new PropertyEditorRegistrar() {
      @Override
      public void registerCustomEditors(PropertyEditorRegistry registry) {
        registry.registerCustomEditor(Date.class, new CustomDateEditor((DateFormat) DATE_FORMAT.clone(), false));
      }
    });
View Full Code Here

TOP

Related Classes of org.springframework.beans.PropertyEditorRegistrar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.