Package org.springframework.beans

Examples of org.springframework.beans.PropertyEditorRegistrySupport


  public GetAsTextStringEditor(final PropertyEditorRegistry aEditorRegistry) {
    editorRegistry = aEditorRegistry;
    if (aEditorRegistry instanceof PropertyEditorRegistrySupport) {
      editorRegistrySupport = (PropertyEditorRegistrySupport) aEditorRegistry;
    } else {
      editorRegistrySupport = new PropertyEditorRegistrySupport();
    }
  }
View Full Code Here


   * instances, and for SimpleTypeConverter used for constructor argument
   * and factory method type conversion.
   * @param registry the PropertyEditorRegistry to initialize
   */
  protected void registerCustomEditors(PropertyEditorRegistry registry) {
    PropertyEditorRegistrySupport registrySupport =
        (registry instanceof PropertyEditorRegistrySupport ? (PropertyEditorRegistrySupport) registry : null);
    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;
            }
          }
          throw ex;
        }
      }
    }
    if (!this.customEditors.isEmpty()) {
      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();
        // Register the editor as shared instance, if possible,
        // to make it clear that it might be used concurrently.
        if (registrySupport != null) {
          registrySupport.registerSharedEditor(clazz, editor);
        }
        else {
          registry.registerCustomEditor(clazz, editor);
        }
      }
View Full Code Here

   * instances, and for SimpleTypeConverter used for constructor argument
   * and factory method type conversion.
   * @param registry the PropertyEditorRegistry to initialize
   */
  protected void registerCustomEditors(PropertyEditorRegistry registry) {
    PropertyEditorRegistrySupport registrySupport =
        (registry instanceof PropertyEditorRegistrySupport ? (PropertyEditorRegistrySupport) registry : null);
    if (registrySupport != null) {
      registrySupport.useConfigValueEditors();
    }
    if (!this.propertyEditorRegistrars.isEmpty()) {
      for (PropertyEditorRegistrar registrar : this.propertyEditorRegistrars) {
        try {
          registrar.registerCustomEditors(registry);
View Full Code Here

   * instances, and for SimpleTypeConverter used for constructor argument
   * and factory method type conversion.
   * @param registry the PropertyEditorRegistry to initialize
   */
  protected void registerCustomEditors(PropertyEditorRegistry registry) {
    PropertyEditorRegistrySupport registrySupport =
        (registry instanceof PropertyEditorRegistrySupport ? (PropertyEditorRegistrySupport) registry : null);
    if (registrySupport != null) {
      registrySupport.useConfigValueEditors();
    }
    if (!this.propertyEditorRegistrars.isEmpty()) {
      for (PropertyEditorRegistrar registrar : this.propertyEditorRegistrars) {
        try {
          registrar.registerCustomEditors(registry);
View Full Code Here

   * instances, and for SimpleTypeConverter used for constructor argument
   * and factory method type conversion.
   * @param registry the PropertyEditorRegistry to initialize
   */
  protected void registerCustomEditors(PropertyEditorRegistry registry) {
    PropertyEditorRegistrySupport registrySupport =
        (registry instanceof PropertyEditorRegistrySupport ? (PropertyEditorRegistrySupport) registry : null);
    if (registrySupport != null) {
      registrySupport.useConfigValueEditors();
    }
    if (!this.propertyEditorRegistrars.isEmpty()) {
      for (PropertyEditorRegistrar registrar : this.propertyEditorRegistrars) {
        try {
          registrar.registerCustomEditors(registry);
View Full Code Here

   * instances, and for SimpleTypeConverter used for constructor argument
   * and factory method type conversion.
   * @param registry the PropertyEditorRegistry to initialize
   */
  protected void registerCustomEditors(PropertyEditorRegistry registry) {
    PropertyEditorRegistrySupport registrySupport =
        (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();
      // Register the editor as shared instance, if possible,
      // to make it clear that it might be used concurrently.
      if (registrySupport != null) {
        registrySupport.registerSharedEditor(clazz, editor);
      }
      else {
        registry.registerCustomEditor(clazz, editor);
      }
    }
View Full Code Here

   * instances, and for SimpleTypeConverter used for constructor argument
   * and factory method type conversion.
   * @param registry the PropertyEditorRegistry to initialize
   */
  protected void registerCustomEditors(PropertyEditorRegistry registry) {
    PropertyEditorRegistrySupport registrySupport =
        (registry instanceof PropertyEditorRegistrySupport ? (PropertyEditorRegistrySupport) registry : null);
    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;
            }
          }
          throw ex;
        }
      }
    }
    if (!this.customEditors.isEmpty()) {
      for (Iterator it = this.customEditors.entrySet().iterator(); it.hasNext();) {
        Map.Entry entry = (Map.Entry) it.next();
        Class requiredType = (Class) entry.getKey();
        Object value = entry.getValue();
        if (value instanceof PropertyEditor) {
          PropertyEditor editor = (PropertyEditor) value;
          // Register the editor as shared instance, if possible,
          // to make it clear that it might be used concurrently.
          if (registrySupport != null) {
            registrySupport.registerSharedEditor(requiredType, editor);
          }
          else {
            registry.registerCustomEditor(requiredType, editor);
          }
        }
View Full Code Here

   * instances, and for SimpleTypeConverter used for constructor argument
   * and factory method type conversion.
   * @param registry the PropertyEditorRegistry to initialize
   */
  protected void registerCustomEditors(PropertyEditorRegistry registry) {
    PropertyEditorRegistrySupport registrySupport =
        (registry instanceof PropertyEditorRegistrySupport ? (PropertyEditorRegistrySupport) registry : null);
    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;
            }
          }
          throw ex;
        }
      }
    }
    if (!this.customEditors.isEmpty()) {
      for (Iterator it = this.customEditors.entrySet().iterator(); it.hasNext();) {
        Map.Entry entry = (Map.Entry) it.next();
        Class requiredType = (Class) entry.getKey();
        Object value = entry.getValue();
        if (value instanceof PropertyEditor) {
          PropertyEditor editor = (PropertyEditor) value;
          // Register the editor as shared instance, if possible,
          // to make it clear that it might be used concurrently.
          if (registrySupport != null) {
            registrySupport.registerSharedEditor(requiredType, editor);
          }
          else {
            registry.registerCustomEditor(requiredType, editor);
          }
        }
View Full Code Here

     */
    public PropertyEditorRegistry getPropertyEditorRegistry() {
        final HttpServletRequest servletRequest = getCurrentRequest();
        PropertyEditorRegistry registry = (PropertyEditorRegistry) servletRequest.getAttribute(GrailsApplicationAttributes.PROPERTY_REGISTRY);
        if (registry == null) {
            registry = new PropertyEditorRegistrySupport();
            PropertyEditorRegistryUtils.registerCustomEditors(this, registry, RequestContextUtils.getLocale(servletRequest));
            servletRequest.setAttribute(GrailsApplicationAttributes.PROPERTY_REGISTRY, registry);
        }
        return registry;
    }
View Full Code Here

   * instances, and for SimpleTypeConverter used for constructor argument
   * and factory method type conversion.
   * @param registry the PropertyEditorRegistry to initialize
   */
  protected void registerCustomEditors(PropertyEditorRegistry registry) {
    PropertyEditorRegistrySupport registrySupport =
        (registry instanceof PropertyEditorRegistrySupport ? (PropertyEditorRegistrySupport) registry : null);
    if (registrySupport != null) {
      registrySupport.useConfigValueEditors();
    }
    if (!this.propertyEditorRegistrars.isEmpty()) {
      for (PropertyEditorRegistrar registrar : this.propertyEditorRegistrars) {
        try {
          registrar.registerCustomEditors(registry);
View Full Code Here

TOP

Related Classes of org.springframework.beans.PropertyEditorRegistrySupport

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.