java/sql-dk/src/info/globalcode/sql/dk/configuration/FormatterDefinition.java
branchv_0
changeset 104 245f1b88a3e6
parent 34 9335cf31c0f2
child 155 eb3676c6929b
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/FormatterDefinition.java	Mon Dec 30 23:46:41 2013 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/configuration/FormatterDefinition.java	Tue Dec 31 17:35:33 2013 +0100
     1.3 @@ -34,6 +34,7 @@
     1.4  
     1.5  	private String name;
     1.6  	private String className;
     1.7 +	private Properties properties = new Properties();
     1.8  
     1.9  	public FormatterDefinition() {
    1.10  	}
    1.11 @@ -43,6 +44,11 @@
    1.12  		this.className = className;
    1.13  	}
    1.14  
    1.15 +	public FormatterDefinition(String name, String className, Properties properties) {
    1.16 +		this(name, className);
    1.17 +		this.properties = properties;
    1.18 +	}
    1.19 +
    1.20  	@XmlElement(name = "name", namespace = CONFIGURATION)
    1.21  	@Override
    1.22  	public String getName() {
    1.23 @@ -72,12 +78,22 @@
    1.24  		this.className = className;
    1.25  	}
    1.26  
    1.27 +	@XmlElement(name = "property", namespace = CONFIGURATION)
    1.28 +	public Properties getProperties() {
    1.29 +		return properties;
    1.30 +	}
    1.31 +
    1.32 +	public void setProperties(Properties properties) {
    1.33 +		this.properties = properties;
    1.34 +	}
    1.35 +
    1.36  	/**
    1.37  	 * @param context
    1.38  	 * @return
    1.39  	 * @throws DKException
    1.40  	 */
    1.41  	public Formatter getInstance(FormatterContext context) throws FormatterException {
    1.42 +		context.getProperties().setDefaults(properties);
    1.43  		try {
    1.44  			Constructor constructor = Class.forName(className).getConstructor(context.getClass());
    1.45