Examples of InjectableProperty


Examples of com.avast.syringe.config.internal.InjectableProperty

    }

    @Override
    public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException {
        try {
            InjectableProperty prop = propertyMap.get(attribute);

            if (prop.isArray()) {
                // todo - will return a collection instead of an array
                return null;
            } else if (prop.isCollection()) {
                Collection collection = (Collection) prop.getValue(instance);
                if (ReflectionInjectableProperty.isReference(prop.getArrayOrCollectionComponentType())) {
                    return getRefNames(collection);
                } else {
                    return collection;
                }
            } else if (prop.isMap()) {
                Map map = (Map) prop.getValue(instance);
                return getRefNames(map, prop);
            } else if (prop.isReference()) {
                Object ref = prop.getValue(instance);
                return loader.findRefName(ref);
            } else {
                return prop.getValue(instance);
            }
        } catch (Exception e) {
            LOGGER.error("Cannot get attribute", e);
            throw new IllegalArgumentException(e.getMessage());
        }
View Full Code Here

Examples of com.avast.syringe.config.internal.InjectableProperty

    }

    @Override
    public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException,
            MBeanException, ReflectionException {
        InjectableProperty prop = propertyMap.get(attribute.getName());

        if (prop.isReference()) {
            setReference(attribute, prop);
        } else {
            try {
                prop.setValue(instance, attribute.getValue());
            } catch (Exception e) {
                LOGGER.error("Cannot set attribute", e);
                throw new IllegalArgumentException(e.getMessage());
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.