Package org.jboss.dna.common.util

Examples of org.jboss.dna.common.util.Reflection


            }

            if (config.getProperties() != null) {
                for (Map.Entry<String, Object> entry : config.getProperties().entrySet()) {
                    // Set the JavaBean-style property on the RepositorySource instance ...
                    Reflection reflection = new Reflection(newInstance.getClass());
                    reflection.invokeSetterMethodOnTarget(entry.getKey(), newInstance, entry.getValue());
                }
            }
        } catch (Throwable e) {
            throw new SystemFailureException(e);
        }
View Full Code Here


            }
           
            if (config.getProperties() != null) {
                for (Map.Entry<String, Object> entry : config.getProperties().entrySet()) {
                    // Set the JavaBean-style property on the RepositorySource instance ...
                    Reflection reflection = new Reflection(newInstance.getClass());
                    reflection.invokeSetterMethodOnTarget(entry.getKey(), newInstance, entry.getValue());
                }
            }
        } catch (Throwable e) {
            throw new SystemFailureException(e);
        }
View Full Code Here

                     * dependency, we'll add code to handle the case of unexpected callback handlers with a setObject method.
                     */
                    try {
                        // Assume that a callback chain will ask for the user before the password
                        if (!userSet) {
                            new Reflection(callbacks[i].getClass()).invokeSetterMethodOnTarget("object",
                                                                                               callbacks[i],
                                                                                               this.userId);
                            userSet = true;
                        } else if (!passwordSet) {
                            // Jetty also seems to eschew passing passwords as char arrays
                            new Reflection(callbacks[i].getClass()).invokeSetterMethodOnTarget("object",
                                                                                               callbacks[i],
                                                                                               new String(this.password));
                            passwordSet = true;
                        }
                        // It worked - need to continue processing the callbacks
View Full Code Here

        setBeanPropertyIfExistsAndNotSet(source, "configurationSourceName", getConfigurationSourceName());
        setBeanPropertyIfExistsAndNotSet(source, "configurationWorkspaceName", getConfigurationWorkspaceName());
        setBeanPropertyIfExistsAndNotSet(source, "configurationPath", stringFactory.create(path));

        // Now set all the properties that we can, ignoring any property that doesn't fit the pattern ...
        Reflection reflection = new Reflection(source.getClass());
        for (Map.Entry<Name, Property> entry : properties.entrySet()) {
            Name propertyName = entry.getKey();
            Property property = entry.getValue();
            String javaPropertyName = propertyName.getLocalName();
            if (property.isEmpty()) continue;

            Object value = null;
            Method setter = null;
            try {
                setter = reflection.findFirstMethod("set" + javaPropertyName, false);
                if (setter == null) continue;
                // Determine the type of the one parameter ...
                Class<?>[] parameterTypes = setter.getParameterTypes();
                if (parameterTypes.length != 1) continue; // not a valid JavaBean property
                Class<?> paramType = parameterTypes[0];
View Full Code Here

    }

    protected boolean setBeanPropertyIfExistsAndNotSet( Object target,
                                                        String propertyName,
                                                        Object value ) {
        Reflection reflection = new Reflection(target.getClass());
        try {
            if (reflection.invokeGetterMethodOnTarget(propertyName, target) == null) {
                reflection.invokeSetterMethodOnTarget(propertyName, target, value);
                return true;
            }
            return false;
        } catch (Exception e) {
            // Log that the property was not found ...
View Full Code Here

            }

            if (config.getProperties() != null) {
                for (Map.Entry<String, Object> entry : config.getProperties().entrySet()) {
                    // Set the JavaBean-style property on the RepositorySource instance ...
                    Reflection reflection = new Reflection(newInstance.getClass());
                    reflection.invokeSetterMethodOnTarget(entry.getKey(), newInstance, entry.getValue());
                }
            }
        } catch (Throwable e) {
            throw new SystemFailureException(e);
        }
View Full Code Here

TOP

Related Classes of org.jboss.dna.common.util.Reflection

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.