java/sql-dk/src/info/globalcode/sql/dk/Functions.java
branchv_0
changeset 220 0bc544b38cfa
parent 218 8e38caf43ca8
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/Functions.java	Sat Aug 15 16:15:30 2015 +0200
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/Functions.java	Sun Aug 16 01:25:01 2015 +0200
     1.3 @@ -18,6 +18,9 @@
     1.4  package info.globalcode.sql.dk;
     1.5  
     1.6  import info.globalcode.sql.dk.configuration.NameIdentified;
     1.7 +import info.globalcode.sql.dk.configuration.PropertyDeclaration;
     1.8 +import info.globalcode.sql.dk.configuration.PropertyDeclarations;
     1.9 +import info.globalcode.sql.dk.formatting.Formatter;
    1.10  import java.io.BufferedReader;
    1.11  import java.io.File;
    1.12  import java.io.IOException;
    1.13 @@ -189,6 +192,17 @@
    1.14  		return hierarchy;
    1.15  	}
    1.16  
    1.17 +	public static PropertyDeclaration[] getPropertyDeclarations(Class<? extends Formatter> formatterClass) {
    1.18 +		PropertyDeclarations properties = formatterClass.getAnnotation(PropertyDeclarations.class);
    1.19 +
    1.20 +		if (properties == null) {
    1.21 +			PropertyDeclaration p = formatterClass.getAnnotation(PropertyDeclaration.class);
    1.22 +			return p == null ? new PropertyDeclaration[]{} : new PropertyDeclaration[]{p};
    1.23 +		} else {
    1.24 +			return properties.value();
    1.25 +		}
    1.26 +	}
    1.27 +
    1.28  	/**
    1.29  	 * TODO: support background or styles and move to ColorfulPrintWriter
    1.30  	 *