java/sql-dk/src/info/globalcode/sql/dk/Functions.java
branchv_0
changeset 220 0bc544b38cfa
parent 218 8e38caf43ca8
--- a/java/sql-dk/src/info/globalcode/sql/dk/Functions.java	Sat Aug 15 16:15:30 2015 +0200
+++ b/java/sql-dk/src/info/globalcode/sql/dk/Functions.java	Sun Aug 16 01:25:01 2015 +0200
@@ -18,6 +18,9 @@
 package info.globalcode.sql.dk;
 
 import info.globalcode.sql.dk.configuration.NameIdentified;
+import info.globalcode.sql.dk.configuration.PropertyDeclaration;
+import info.globalcode.sql.dk.configuration.PropertyDeclarations;
+import info.globalcode.sql.dk.formatting.Formatter;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
@@ -189,6 +192,17 @@
 		return hierarchy;
 	}
 
+	public static PropertyDeclaration[] getPropertyDeclarations(Class<? extends Formatter> formatterClass) {
+		PropertyDeclarations properties = formatterClass.getAnnotation(PropertyDeclarations.class);
+
+		if (properties == null) {
+			PropertyDeclaration p = formatterClass.getAnnotation(PropertyDeclaration.class);
+			return p == null ? new PropertyDeclaration[]{} : new PropertyDeclaration[]{p};
+		} else {
+			return properties.value();
+		}
+	}
+
 	/**
 	 * TODO: support background or styles and move to ColorfulPrintWriter
 	 *