java/sql-dk/src/info/globalcode/sql/dk/Functions.java
branchv_0
changeset 220 0bc544b38cfa
parent 218 8e38caf43ca8
equal deleted inserted replaced
219:3b1733fb3793 220:0bc544b38cfa
    16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
    17  */
    17  */
    18 package info.globalcode.sql.dk;
    18 package info.globalcode.sql.dk;
    19 
    19 
    20 import info.globalcode.sql.dk.configuration.NameIdentified;
    20 import info.globalcode.sql.dk.configuration.NameIdentified;
       
    21 import info.globalcode.sql.dk.configuration.PropertyDeclaration;
       
    22 import info.globalcode.sql.dk.configuration.PropertyDeclarations;
       
    23 import info.globalcode.sql.dk.formatting.Formatter;
    21 import java.io.BufferedReader;
    24 import java.io.BufferedReader;
    22 import java.io.File;
    25 import java.io.File;
    23 import java.io.IOException;
    26 import java.io.IOException;
    24 import java.io.InputStream;
    27 import java.io.InputStream;
    25 import java.io.InputStreamReader;
    28 import java.io.InputStreamReader;
   187 		}
   190 		}
   188 
   191 
   189 		return hierarchy;
   192 		return hierarchy;
   190 	}
   193 	}
   191 
   194 
       
   195 	public static PropertyDeclaration[] getPropertyDeclarations(Class<? extends Formatter> formatterClass) {
       
   196 		PropertyDeclarations properties = formatterClass.getAnnotation(PropertyDeclarations.class);
       
   197 
       
   198 		if (properties == null) {
       
   199 			PropertyDeclaration p = formatterClass.getAnnotation(PropertyDeclaration.class);
       
   200 			return p == null ? new PropertyDeclaration[]{} : new PropertyDeclaration[]{p};
       
   201 		} else {
       
   202 			return properties.value();
       
   203 		}
       
   204 	}
       
   205 
   192 	/**
   206 	/**
   193 	 * TODO: support background or styles and move to ColorfulPrintWriter
   207 	 * TODO: support background or styles and move to ColorfulPrintWriter
   194 	 *
   208 	 *
   195 	 * @param out
   209 	 * @param out
   196 	 * @param valueString
   210 	 * @param valueString