]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/doc/ConsoleContextDescriber.java
Clean up execution runtime
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / execution / doc / ConsoleContextDescriber.java
1 package org.argeo.slc.core.execution.doc;
2
3 import org.springframework.beans.MutablePropertyValues;
4 import org.springframework.beans.PropertyValue;
5 import org.springframework.beans.factory.config.BeanDefinition;
6 import org.springframework.beans.factory.support.BeanDefinitionRegistry;
7
8 public class ConsoleContextDescriber implements ContextDescriber {
9 public void describeContext(BeanDefinitionRegistry registry) {
10 String[] beanNames = registry.getBeanDefinitionNames();
11 for (String beanName : beanNames) {
12 log("\n## BEAN: " + beanName);
13 describeBean(registry.getBeanDefinition(beanName));
14 }
15 }
16
17 public void describeBean(BeanDefinition beanDefinition) {
18 log("BeanDefinition class: "+beanDefinition.getClass());
19 log("# ATTRIBUTES");
20 for(String attr:beanDefinition.attributeNames()){
21 log(attr+"="+beanDefinition.getAttribute(attr));
22 }
23 log("# PROPERTIES");
24 MutablePropertyValues pValues = beanDefinition.getPropertyValues();
25 for (PropertyValue pv : pValues.getPropertyValues()) {
26 log(pv.getName() + "= (" + pv.getValue().getClass() + ") "
27 + pv.getValue());
28 }
29 }
30
31 protected void log(Object obj){
32 System.out.println(obj);
33 }
34 }