<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">

<beans>

	<bean class="org.springframework.scripting.support.ScriptFactoryPostProcessor"/>

	<bean id="adder" class="org.springframework.scripting.jruby.JRubyScriptFactory">
		<constructor-arg>
			<value><![CDATA[inline:
require 'java'

class RubyWrapperAdder
	include org.springframework.scripting.jruby.WrapperAdder

	def addInts(x, y)
		x + y
	end

	def addShorts(x, y)
		x + y
	end

	def addLongs(x, y)
		x + y
	end

	def addFloats(x, y)
		x + y
	end

	def addDoubles(x, y)
		x + y
	end

	def resultIsPositive(x, y)
		(x + y) > 0
	end

	def concatenate(c, d)
		return ("" << c) << d;
	end

	def echo(c)
		c
	end

	def concatArrayOfIntegerWrappers(numbers)
		buffer = ""
        numbers.each do |number|
        	buffer << number.to_s
        end
        return buffer
	end

	def populate(x, y)
		[x, y]
	end

	def createListOfLists(x, y, z)
		[[x], [y], [z]]
	end

	def toMap(key, value)
		{key => value}
	end

end
			]]></value>
		</constructor-arg>
		<constructor-arg value="org.springframework.scripting.jruby.WrapperAdder"/>
	</bean>
</beans>
