Example usage for org.springframework.asm Type VOID_TYPE

List of usage examples for org.springframework.asm Type VOID_TYPE

Introduction

In this page you can find the example usage for org.springframework.asm Type VOID_TYPE.

Prototype

Type VOID_TYPE

To view the source code for org.springframework.asm Type VOID_TYPE.

Click Source Link

Document

The void type.

Usage

From source file:org.iff.infra.util.spring.script.ScriptFactoryPostProcessor.java

/**
 * Create a config interface for the given bean definition, defining setter
 * methods for the defined property values as well as an init method and
 * a destroy method (if defined).//from w  w  w  .j a v a 2 s  .co  m
 * <p>This implementation creates the interface via CGLIB's InterfaceMaker,
 * determining the property types from the given interfaces (as far as possible).
 * @param bd the bean definition (property values etc) to create a
 * config interface for
 * @param interfaces the interfaces to check against (might define
 * getters corresponding to the setters we're supposed to generate)
 * @return the config interface
 * @see org.springframework.cglib.proxy.InterfaceMaker
 * @see org.springframework.beans.BeanUtils#findPropertyType
 */
protected Class<?> createConfigInterface(BeanDefinition bd, Class<?>[] interfaces) {
    InterfaceMaker maker = new InterfaceMaker();
    PropertyValue[] pvs = bd.getPropertyValues().getPropertyValues();
    for (PropertyValue pv : pvs) {
        String propertyName = pv.getName();
        Class<?> propertyType = BeanUtils.findPropertyType(propertyName, interfaces);
        String setterName = "set" + StringUtils.capitalize(propertyName);
        Signature signature = new Signature(setterName, Type.VOID_TYPE,
                new Type[] { Type.getType(propertyType) });
        maker.add(signature, new Type[0]);
    }
    if (bd instanceof AbstractBeanDefinition) {
        AbstractBeanDefinition abd = (AbstractBeanDefinition) bd;
        if (abd.getInitMethodName() != null) {
            Signature signature = new Signature(abd.getInitMethodName(), Type.VOID_TYPE, new Type[0]);
            maker.add(signature, new Type[0]);
        }
        if (abd.getDestroyMethodName() != null) {
            Signature signature = new Signature(abd.getDestroyMethodName(), Type.VOID_TYPE, new Type[0]);
            maker.add(signature, new Type[0]);
        }
    }
    return maker.create();
}

From source file:org.springframework.scripting.support.ScriptFactoryPostProcessor.java

/**
 * Create a config interface for the given bean definition, defining setter
 * methods for the defined property values as well as an init method and
 * a destroy method (if defined).//w  w w .  j  a va 2 s  .co m
 * <p>This implementation creates the interface via CGLIB's InterfaceMaker,
 * determining the property types from the given interfaces (as far as possible).
 * @param bd the bean definition (property values etc) to create a
 * config interface for
 * @param interfaces the interfaces to check against (might define
 * getters corresponding to the setters we're supposed to generate)
 * @return the config interface
 * @see org.springframework.cglib.proxy.InterfaceMaker
 * @see org.springframework.beans.BeanUtils#findPropertyType
 */
protected Class<?> createConfigInterface(BeanDefinition bd, @Nullable Class<?>[] interfaces) {
    InterfaceMaker maker = new InterfaceMaker();
    PropertyValue[] pvs = bd.getPropertyValues().getPropertyValues();
    for (PropertyValue pv : pvs) {
        String propertyName = pv.getName();
        Class<?> propertyType = BeanUtils.findPropertyType(propertyName, interfaces);
        String setterName = "set" + StringUtils.capitalize(propertyName);
        Signature signature = new Signature(setterName, Type.VOID_TYPE,
                new Type[] { Type.getType(propertyType) });
        maker.add(signature, new Type[0]);
    }
    if (bd instanceof AbstractBeanDefinition) {
        AbstractBeanDefinition abd = (AbstractBeanDefinition) bd;
        if (abd.getInitMethodName() != null) {
            Signature signature = new Signature(abd.getInitMethodName(), Type.VOID_TYPE, new Type[0]);
            maker.add(signature, new Type[0]);
        }
        if (StringUtils.hasText(abd.getDestroyMethodName())) {
            Signature signature = new Signature(abd.getDestroyMethodName(), Type.VOID_TYPE, new Type[0]);
            maker.add(signature, new Type[0]);
        }
    }
    return maker.create();
}