Package org.gwtoolbox.commons.generator.rebind

Examples of org.gwtoolbox.commons.generator.rebind.EasyTreeLogger


    }

    //============================================== Helper Methods ====================================================

    protected void logComponentDefinition(EasyTreeLogger logger, ComponentDefinition definition) {
        EasyTreeLogger rootLogger = logger.getRoot();

        if (level == LoggingLevel.BASIC) {
            rootLogger.info("Component '" + definition.getId() + "'");
            return;
        }

        EasyTreeLogger newLogger = rootLogger.branchInfo("Component '" + definition.getId() + "'");
        newLogger.info("Type: " + definition.getComponentType().getQualifiedSourceName());
        newLogger.info("Lazy: " + definition.isLazy());
        newLogger.info("Singleton: " + definition.isSingleton());
        newLogger.info("Generated: " + definition.isGenerated());
        String generatedType = definition.getGeneratedType() != null ? definition.getGeneratedType().getQualifiedSourceName() : "<none>";
        newLogger.info("Generated Type: " + generatedType);
        newLogger.info("Init Method: '" + definition.getInitMethodName() + "'");
        newLogger.info("Dispose Method: '" + definition.getDisposeMethodName() + "'");

        if (level == LoggingLevel.FINEST) {
            if (SimpleComponentDefinition.class.isInstance(definition)) {
                SimpleComponentDefinition simpleDef = (SimpleComponentDefinition) definition;

                // printing the properties settings
                if (simpleDef.getPropertySettings().isEmpty()) {
                    newLogger.info("Properties Settings: <no properties settigns>");
                } else {
                    EasyTreeLogger propLogger = newLogger.branchInfo("Properties Settings:");
                    for (PropertySetting setting : simpleDef.getPropertySettings()) {
                        propLogger.info(setting.getPropertyName() + " = " + setting.getValue());
                    }
                }

                // printing the construtor settings
                ConstructorInjectionDefinition ctorDef = simpleDef.getConstructorInjectionDefinition();
                if (ctorDef == null) {
                    newLogger.info("Construtor Settings: <no constructor arguments settigns>");
                } else {
                    EasyTreeLogger ctorLogger = newLogger.branchInfo("Constructor Arguments Settings:");
                    int i = 0;
                    for (ParameterSetting setting : ctorDef.getParameterSettings()) {
                        StringBuilder builder = new StringBuilder(i++)
                                .append(setting.getParameter().getType() != null ? "[" + setting.getParameter().getType().getQualifiedSourceName() + "]" : "")
                                .append(" -> ")
                                .append(setting.getValue());
                        ctorLogger.info(builder.toString());
                    }
                }
            }

            if (JavaConfigComponentDefinition.class.isInstance(definition)) {
                JavaConfigComponentDefinition javaConfigDef = (JavaConfigComponentDefinition) definition;
                newLogger.info("JavaConfig Method: '" + javaConfigDef.getMethodName() + "'");
            }
        }

        if (level == LoggingLevel.FINER || level == LoggingLevel.FINEST) {
            EasyTreeLogger metaDataLogger = newLogger.branchInfo("Meta Data:");
            metaDataLogger.info("Source: " + definition.getMetaData().getSource());
            Set<String> propertiesNames = definition.getMetaData().getAllPropertyNames();
            if (propertiesNames.isEmpty()) {
                metaDataLogger.info("Properties: <no properties>");
            } else {
                metaDataLogger = metaDataLogger.branchInfo("Properties:");
                for (String propertyName : propertiesNames) {
                    metaDataLogger.info(propertyName + " = '" + definition.getMetaData().getProperty(propertyName) + "'");
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.gwtoolbox.commons.generator.rebind.EasyTreeLogger

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.