Defining an enum

If you want to set values over enumeratons, you can define a new enum tag like:

<tag name="rgb" type="net.schst.XJConf.Examples.Rgb" key="__none" />

Now this tag represents this enumeration:

public enum Rgb {

    RED   (255,  0,  0),
    GREEN (0,  255,  0),
    BLUE  (0,    0,255);
    
    Rgb(int rValue, int gValue, int bValue){}    
}

XJConf know now, which constants - RED, GREEN, BLUE - behind the defined tag are.

How to use the defined enumeration

The defined tag points thus the type attribute to the enumeration class which contains some constants.

<xj:configuration 
    xmlns:xj="http://www.schst.net/XJConf">	

	<rgb>RED</rgb>	

</xj:configuration>

The result of this usage is, to set the enumeration constant to RED.

Use enumerations as attribute

If its need to use an enumeration as an attribute of a tag, you have to define the enumeration as attribute at the define.xml-file. The construct behinde the definition works as well as the usage like cdata.

<tag name="color" type="x.y.z.Color" key="__none">
    <attribute name="rgbScheme" type="net.schst.XJConf.Examples.Rgb" />
</tag>

With this definition the enumeration can use as an attribute.

<xj:configuration 
    xmlns:xj="http://www.schst.net/XJConf">

	<color rgbScheme="RED" />
	
</xj:configuration>