org.apache.mina.integration.xbean.MinaPropertyEditorRegistrar Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mina-integration-xbean Show documentation
Show all versions of mina-integration-xbean Show documentation
This module generates an XML scheme file for the MINA Spring configuration
namespace. This XSD is referenced by Spring configuration files using MINA
components to have a much less verbose configuration. When used with the
XBean application context loader the same old Spring ApplictionContext is
generated from this more intuitive and terse configuration file.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.mina.integration.xbean;
import java.beans.PropertyEditor;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import org.apache.mina.integration.beans.InetAddressEditor;
import org.apache.mina.integration.beans.InetSocketAddressEditor;
import org.apache.mina.integration.beans.VmPipeAddressEditor;
import org.apache.mina.transport.vmpipe.VmPipeAddress;
import org.springframework.beans.PropertyEditorRegistrar;
import org.springframework.beans.PropertyEditorRegistry;
/**
* A custom Spring {@link PropertyEditorRegistrar} implementation which
* registers by default all the {@link PropertyEditor} implementations in the
* MINA Integration Beans module.
*
* @author Apache MINA Project
*/
public class MinaPropertyEditorRegistrar implements PropertyEditorRegistrar {
/**
* Registers custom {@link PropertyEditor}s in the MINA Integration Beans
* module.
*
* Note: I did not know just how useful the rest of the property editors
* were or if they were redundant and replicated existing functionality of
* default editors packaged into Spring. So presently we're only
* registering editors for the following classes which are not found in
* Spring:
*
*
* - java.net.InetAddress
* - java.net.InetSocketAddress
* - org.apache.mina.core.session.TrafficMask
* - org.apache.mina.integration.beans.VmPipeAddressEditor
*
*
* @see org.springframework.beans.PropertyEditorRegistrar#
* registerCustomEditors(org.springframework.beans.PropertyEditorRegistry)
*/
public void registerCustomEditors(PropertyEditorRegistry registry) {
// it is expected that new PropertyEditor instances are created
registry.registerCustomEditor(InetAddress.class, new InetAddressEditor());
registry.registerCustomEditor(InetSocketAddress.class, new InetSocketAddressEditor());
registry.registerCustomEditor(SocketAddress.class, new InetSocketAddressEditor());
registry.registerCustomEditor(VmPipeAddress.class, new VmPipeAddressEditor());
// registry.registerCustomEditor( Boolean.class, new BooleanEditor() );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy