/[Apache-SVN]
ViewVC logotype

Revision 675569


Jump to revision: Previous Next
Author: clement
Date: Thu Jul 10 13:30:25 2008 UTC (16 years, 4 months ago)
Changed paths: 2
Log Message:
Fix the issue Felix-629
Allows an instance configuration to contain complex types.
Now an instance configuration can contain properties like : 
	<instance component="org.apache.felix.ipojo.test.scenarios.component.ComplexConfiguration" name="complex">
		<property name="array" type="array"> <!-- creates an array -->
			<property value="a"/>
			<property value="b"/>
		</property>

		<property name="list" type="list"> <!-- creates a list -->
			<property value="a"/>
			<property value="b"/>
		</property>

		<property name="dict" type="dictionary"> <!-- creates a dictionary (default case) -->
			<property name="a" value="a"/>
			<property name="b" value="b"/>
		</property>
		
		<property name="map" type="map"> <!-- creates a map -->
			<property name="a" value="a"/>
			<property name="b" value="b"/>
		</property>

		<property name="complex-array" type="array"> <!-- creates an array containing lists -->
			<property type="list">
				<property value="a"/>
				<property value="b"/>
			</property>
			<property type="list">
				<property value="c"/>
				<property value="d"/>
			</property>
		</property>

		<property name="complex-list" type="list"> <!-- creates a list containing lists -->
			<property type="list">
				<property value="a"/>
				<property value="b"/>
			</property>
			<property type="list">
				<property value="c"/>
				<property value="d"/>
			</property>
		</property>

		<property name="complex-map" type="map"> <!-- creates a map containing lists -->
			<property name="a" type="list">
				<property value="a"/>
				<property value="b"/>
			</property>
			<property name="b" type="list">
				<property value="c"/>
				<property value="d"/>
			</property>
		</property>
	</instance>
	
As illustrated, any complex type can contain any complex type (and obviously itself). When no sub-property is declared, an empty structure is returned. 

The patch contains also code allowing to use [...] to describe an array instead of {...}. So it is possible to write something like : <property name="foo" type="String[]" value="[a, b, c]"/>. This is equivalent to the existing syntax : <property name="foo" type="String[]" value="{a, b, c}"/>

Changed paths

Path Details
Directoryfelix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java modified , text changed
Directoryfelix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/ParseUtils.java modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26