java/sql-dk/src/info/globalcode/sql/dk/InfoLister.java
branchv_0
changeset 220 0bc544b38cfa
parent 216 0eb9aec16bf4
child 229 7699133f5a01
equal deleted inserted replaced
219:3b1733fb3793 220:0bc544b38cfa
   186 		for (String formatterName : options.getFormatterNamesToListProperties()) {
   186 		for (String formatterName : options.getFormatterNamesToListProperties()) {
   187 			listFormatterProperties(formatterName);
   187 			listFormatterProperties(formatterName);
   188 		}
   188 		}
   189 	}
   189 	}
   190 
   190 
   191 	private PropertyDeclaration[] getPropertyDeclarations(Class<? extends Formatter> formatterClass) {
       
   192 		PropertyDeclarations properties = formatterClass.getAnnotation(PropertyDeclarations.class);
       
   193 
       
   194 		if (properties == null) {
       
   195 			PropertyDeclaration p = formatterClass.getAnnotation(PropertyDeclaration.class);
       
   196 			return p == null ? new PropertyDeclaration[]{} : new PropertyDeclaration[]{p};
       
   197 		} else {
       
   198 			return properties.value();
       
   199 		}
       
   200 	}
       
   201 
       
   202 	private void listFormatterProperties(String formatterName) throws FormatterException, ConfigurationException {
   191 	private void listFormatterProperties(String formatterName) throws FormatterException, ConfigurationException {
   203 		FormatterDefinition fd = configurationProvider.getConfiguration().getFormatter(formatterName);
   192 		FormatterDefinition fd = configurationProvider.getConfiguration().getFormatter(formatterName);
   204 		try {
   193 		try {
   205 
   194 
   206 			// currently only for debugging purposes
   195 			// currently only for debugging purposes
   221 			Map<String, Object[]> data = new HashMap<>();
   210 			Map<String, Object[]> data = new HashMap<>();
   222 			Class<Formatter> formatterClass = (Class<Formatter>) Class.forName(fd.getClassName());
   211 			Class<Formatter> formatterClass = (Class<Formatter>) Class.forName(fd.getClassName());
   223 			List<Class<? extends Formatter>> hierarchy = Functions.getClassHierarchy(formatterClass, Formatter.class);
   212 			List<Class<? extends Formatter>> hierarchy = Functions.getClassHierarchy(formatterClass, Formatter.class);
   224 			Collections.reverse(hierarchy);
   213 			Collections.reverse(hierarchy);
   225 			hierarchy.stream().forEach((c) -> {
   214 			hierarchy.stream().forEach((c) -> {
   226 				for (PropertyDeclaration p : getPropertyDeclarations(c)) {
   215 				for (PropertyDeclaration p : Functions.getPropertyDeclarations(c)) {
   227 					data.put(p.name(), propertyDeclarationToRow(p, c, printDeclaredIn));
   216 					data.put(p.name(), propertyDeclarationToRow(p, c, printDeclaredIn));
   228 				}
   217 				}
   229 			});
   218 			});
   230 
   219 
   231 			List<Parameter> parameters = new ArrayList<>();
   220 			List<Parameter> parameters = new ArrayList<>();