summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types')
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/AnnotatedListTypeHelper.java71
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/AtomTypeHelper.java39
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/BinaryTypeHelper.java39
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/BooleanTypeHelper.java44
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/ByteTypeHelper.java39
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/CharTypeHelper.java40
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/DoubleTypeHelper.java39
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/FloatTypeHelper.java39
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/IntTypeHelper.java40
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/ListTypeHelper.java65
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/LongTypeHelper.java39
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/ShortTypeHelper.java40
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/StringTypeHelper.java39
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/TupleTypeHelper.java70
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/TypeHelper.java33
-rw-r--r--sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/TypeHelpersProxy.java291
16 files changed, 967 insertions, 0 deletions
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/AnnotatedListTypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/AnnotatedListTypeHelper.java
new file mode 100644
index 0000000000..154f0c27fc
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/AnnotatedListTypeHelper.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.ericsson.otp.erlang.OtpErlangList;
+import com.ericsson.otp.erlang.OtpErlangObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AnnotatedListTypeHelper implements TypeHelper {
+
+ private Annotation[] notes;
+
+ public AnnotatedListTypeHelper(Annotation[] notes) {
+ this.notes = notes;
+ }
+
+ public OtpErlangObject toErlang(Object object) {
+ int i = 0;
+ List<OtpErlangObject> elements = new ArrayList<OtpErlangObject>();
+ while (true) {
+ try {
+ elements.add(TypeHelpersProxy.toErlang(Array.get(object, i),
+ notes));
+ i++;
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // expected
+ break;
+ }
+ }
+ return new OtpErlangList(elements.toArray(new OtpErlangObject[elements
+ .size()]));
+ }
+
+ public Object toJava(OtpErlangObject object, Class<?> forClass)
+ throws Exception {
+ OtpErlangList erlangList = (OtpErlangList) object;
+ Object result = Array.newInstance(forClass.getComponentType(),
+ erlangList.arity());
+ for (int i = 0; i < erlangList.arity(); i++) {
+ Array.set(result, i, TypeHelpersProxy.toJava(erlangList
+ .elementAt(i), forClass.getComponentType(),
+ new Annotation[0]));
+ }
+ return result;
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/AtomTypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/AtomTypeHelper.java
new file mode 100644
index 0000000000..94285c66bf
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/AtomTypeHelper.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import com.ericsson.otp.erlang.OtpErlangAtom;
+import com.ericsson.otp.erlang.OtpErlangObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AtomTypeHelper implements TypeHelper {
+
+ public OtpErlangObject toErlang(Object object) {
+ return new OtpErlangAtom((String) object);
+ }
+
+ public Object toJava(OtpErlangObject object, Class<?> forClass)
+ throws Exception {
+ return ((OtpErlangAtom) object).atomValue();
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/BinaryTypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/BinaryTypeHelper.java
new file mode 100644
index 0000000000..7385fe64e4
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/BinaryTypeHelper.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import com.ericsson.otp.erlang.OtpErlangBinary;
+import com.ericsson.otp.erlang.OtpErlangObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BinaryTypeHelper implements TypeHelper {
+
+ public OtpErlangObject toErlang(Object object) {
+ return new OtpErlangBinary((byte[])object);
+ }
+
+ public Object toJava(OtpErlangObject object, Class<?> forClass)
+ throws Exception {
+ return ((OtpErlangBinary)object).binaryValue();
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/BooleanTypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/BooleanTypeHelper.java
new file mode 100644
index 0000000000..9463b72eb9
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/BooleanTypeHelper.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import com.ericsson.otp.erlang.OtpErlangAtom;
+import com.ericsson.otp.erlang.OtpErlangBoolean;
+import com.ericsson.otp.erlang.OtpErlangObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BooleanTypeHelper implements TypeHelper {
+
+ public OtpErlangObject toErlang(Object object) {
+ return new OtpErlangBoolean((Boolean) object);
+ }
+
+ public Object toJava(OtpErlangObject object, Class<?> forClass)
+ throws Exception {
+ if (object.getClass().equals(OtpErlangAtom.class)) {
+ return ((OtpErlangAtom) object).booleanValue();
+ } else {
+ return ((OtpErlangBoolean) object).booleanValue();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/ByteTypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/ByteTypeHelper.java
new file mode 100644
index 0000000000..c6c8f6690f
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/ByteTypeHelper.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import com.ericsson.otp.erlang.OtpErlangByte;
+import com.ericsson.otp.erlang.OtpErlangLong;
+import com.ericsson.otp.erlang.OtpErlangObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ByteTypeHelper implements TypeHelper {
+
+ public OtpErlangObject toErlang(Object object) {
+ return new OtpErlangByte((Byte) object);
+ }
+
+ public Object toJava(OtpErlangObject object, Class<?> forClass)
+ throws Exception {
+ return (byte) ((OtpErlangLong) object).longValue();
+ }
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/CharTypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/CharTypeHelper.java
new file mode 100644
index 0000000000..b0479c9b0c
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/CharTypeHelper.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import com.ericsson.otp.erlang.OtpErlangChar;
+import com.ericsson.otp.erlang.OtpErlangLong;
+import com.ericsson.otp.erlang.OtpErlangObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CharTypeHelper implements TypeHelper {
+
+ public OtpErlangObject toErlang(Object object) {
+ return new OtpErlangChar((Character) object);
+ }
+
+ public Object toJava(OtpErlangObject object, Class<?> forClass)
+ throws Exception {
+ return (char) ((OtpErlangLong) object).longValue();
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/DoubleTypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/DoubleTypeHelper.java
new file mode 100644
index 0000000000..92dd4749ac
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/DoubleTypeHelper.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import com.ericsson.otp.erlang.OtpErlangDouble;
+import com.ericsson.otp.erlang.OtpErlangObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DoubleTypeHelper implements TypeHelper {
+
+ public OtpErlangObject toErlang(Object object) {
+ return new OtpErlangDouble((Double) object);
+ }
+
+ public Object toJava(OtpErlangObject object, Class<?> forClass)
+ throws Exception {
+ return ((OtpErlangDouble) object).doubleValue();
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/FloatTypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/FloatTypeHelper.java
new file mode 100644
index 0000000000..3ee695c3cc
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/FloatTypeHelper.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import com.ericsson.otp.erlang.OtpErlangDouble;
+import com.ericsson.otp.erlang.OtpErlangObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class FloatTypeHelper implements TypeHelper {
+
+ public OtpErlangObject toErlang(Object object) {
+ return new OtpErlangDouble((Float) object);
+ }
+
+ public Object toJava(OtpErlangObject object, Class<?> forClass)
+ throws Exception {
+ return (float) ((OtpErlangDouble) object).doubleValue();
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/IntTypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/IntTypeHelper.java
new file mode 100644
index 0000000000..3ee8e7d9ac
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/IntTypeHelper.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import com.ericsson.otp.erlang.OtpErlangInt;
+import com.ericsson.otp.erlang.OtpErlangLong;
+import com.ericsson.otp.erlang.OtpErlangObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IntTypeHelper implements TypeHelper {
+
+ public OtpErlangObject toErlang(Object object) {
+ return new OtpErlangInt((Integer) object);
+ }
+
+ public Object toJava(OtpErlangObject object, Class<?> forClass)
+ throws Exception {
+ return (int) ((OtpErlangLong) object).longValue();
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/ListTypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/ListTypeHelper.java
new file mode 100644
index 0000000000..7bb62d4cf8
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/ListTypeHelper.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.ericsson.otp.erlang.OtpErlangList;
+import com.ericsson.otp.erlang.OtpErlangObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ListTypeHelper implements TypeHelper {
+
+ public OtpErlangObject toErlang(Object object) {
+ int i = 0;
+ List<OtpErlangObject> elements = new ArrayList<OtpErlangObject>();
+ while (true) {
+ try {
+ elements.add(TypeHelpersProxy.toErlang(Array.get(object, i),
+ new Annotation[0]));
+ i++;
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // expected
+ break;
+ }
+ }
+ return new OtpErlangList(elements.toArray(new OtpErlangObject[elements
+ .size()]));
+ }
+
+ public Object toJava(OtpErlangObject object, Class<?> forClass)
+ throws Exception {
+ OtpErlangList erlangList = (OtpErlangList) object;
+ Object result = Array.newInstance(forClass.getComponentType(),
+ erlangList.arity());
+ for (int i = 0; i < erlangList.arity(); i++) {
+ Array.set(result, i, TypeHelpersProxy.toJava(erlangList
+ .elementAt(i), forClass.getComponentType(),
+ new Annotation[0]));
+ }
+ return result;
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/LongTypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/LongTypeHelper.java
new file mode 100644
index 0000000000..711057569a
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/LongTypeHelper.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import com.ericsson.otp.erlang.OtpErlangLong;
+import com.ericsson.otp.erlang.OtpErlangObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class LongTypeHelper implements TypeHelper {
+
+ public OtpErlangObject toErlang(Object object) {
+ return new OtpErlangLong((Long) object);
+ }
+
+ public Object toJava(OtpErlangObject object, Class<?> forClass)
+ throws Exception {
+ return ((OtpErlangLong) object).longValue();
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/ShortTypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/ShortTypeHelper.java
new file mode 100644
index 0000000000..73a68691a4
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/ShortTypeHelper.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import com.ericsson.otp.erlang.OtpErlangLong;
+import com.ericsson.otp.erlang.OtpErlangObject;
+import com.ericsson.otp.erlang.OtpErlangShort;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ShortTypeHelper implements TypeHelper {
+
+ public OtpErlangObject toErlang(Object object) {
+ return new OtpErlangShort((Short) object);
+ }
+
+ public Object toJava(OtpErlangObject object, Class<?> forClass)
+ throws Exception {
+ return (short) ((OtpErlangLong) object).longValue();
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/StringTypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/StringTypeHelper.java
new file mode 100644
index 0000000000..001ec47655
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/StringTypeHelper.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import com.ericsson.otp.erlang.OtpErlangObject;
+import com.ericsson.otp.erlang.OtpErlangString;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StringTypeHelper implements TypeHelper {
+
+ public OtpErlangObject toErlang(Object object) {
+ return new OtpErlangString((String) object);
+ }
+
+ public Object toJava(OtpErlangObject object, Class<?> forClass)
+ throws Exception {
+ return ((OtpErlangString) object).stringValue();
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/TupleTypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/TupleTypeHelper.java
new file mode 100644
index 0000000000..64ea57f836
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/TupleTypeHelper.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.ericsson.otp.erlang.OtpErlangObject;
+import com.ericsson.otp.erlang.OtpErlangTuple;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TupleTypeHelper implements TypeHelper {
+
+ public OtpErlangObject toErlang(Object object) {
+ Class<?> forClass = object.getClass();
+ List<OtpErlangObject> tupleMembers = new ArrayList<OtpErlangObject>();
+ Field[] fields = forClass.getFields();
+ for (int i = 0; i < fields.length; i++) {
+ try {
+ OtpErlangObject member = TypeHelpersProxy.toErlang(fields[i]
+ .get(object), fields[i].getAnnotations());
+ tupleMembers.add(member);
+ } catch (IllegalArgumentException e) {
+ // no problem should occur here
+ } catch (IllegalAccessException e) {
+ // and here
+ }
+ }
+ OtpErlangObject result = new OtpErlangTuple(tupleMembers
+ .toArray(new OtpErlangObject[tupleMembers.size()]));
+ return result;
+ }
+
+ public Object toJava(OtpErlangObject object, Class<?> forClass)
+ throws Exception {
+ Object result = null;
+ OtpErlangTuple tuple = (OtpErlangTuple) object;
+ Field[] fields = forClass.getFields();
+ result = forClass.newInstance();
+ for (int i = 0; i < tuple.arity(); i++) {
+ OtpErlangObject tupleMember = tuple.elementAt(i);
+ Object javaMember = TypeHelpersProxy.toJava(tupleMember, fields[i]
+ .getType(), fields[i].getAnnotations());
+ fields[i].setAccessible(true);
+ fields[i].set(result, javaMember);
+ }
+ return result;
+ }
+
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/TypeHelper.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/TypeHelper.java
new file mode 100644
index 0000000000..add885ef6e
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/TypeHelper.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import com.ericsson.otp.erlang.OtpErlangObject;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface TypeHelper {
+
+ Object toJava(OtpErlangObject object, Class<?> forClass) throws Exception;
+
+ OtpErlangObject toErlang(Object object);
+
+}
diff --git a/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/TypeHelpersProxy.java b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/TypeHelpersProxy.java
new file mode 100644
index 0000000000..2ab29490e3
--- /dev/null
+++ b/sca-java-1.x/tags/1.6-TUSCANY-3909/binding-erlang-runtime/src/main/java/org/apache/tuscany/sca/binding/erlang/impl/types/TypeHelpersProxy.java
@@ -0,0 +1,291 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.erlang.impl.types;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.binding.erlang.impl.TypeMismatchException;
+import org.apache.tuscany.sca.binding.erlang.meta.ErlangAtom;
+
+import com.ericsson.otp.erlang.OtpErlangList;
+import com.ericsson.otp.erlang.OtpErlangObject;
+import com.ericsson.otp.erlang.OtpErlangTuple;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TypeHelpersProxy {
+
+ private static Map<Class<?>, TypeHelper> primitiveTypes = null;
+
+ static {
+ // initiate type helpers
+ primitiveTypes = new HashMap<Class<?>, TypeHelper>();
+ primitiveTypes.put(boolean.class, new BooleanTypeHelper());
+ primitiveTypes.put(short.class, new ShortTypeHelper());
+ primitiveTypes.put(byte.class, new ByteTypeHelper());
+ primitiveTypes.put(char.class, new CharTypeHelper());
+ primitiveTypes.put(int.class, new IntTypeHelper());
+ primitiveTypes.put(long.class, new LongTypeHelper());
+ primitiveTypes.put(float.class, new FloatTypeHelper());
+ primitiveTypes.put(double.class, new DoubleTypeHelper());
+ primitiveTypes.put(String.class, new StringTypeHelper());
+ primitiveTypes.put(Boolean.class, primitiveTypes.get(boolean.class));
+ primitiveTypes.put(Character.class, primitiveTypes.get(char.class));
+ primitiveTypes.put(Short.class, primitiveTypes.get(char.class));
+ primitiveTypes.put(Byte.class, primitiveTypes.get(byte.class));
+ primitiveTypes.put(Short.class, primitiveTypes.get(short.class));
+ primitiveTypes.put(Integer.class, primitiveTypes.get(int.class));
+ primitiveTypes.put(Long.class, primitiveTypes.get(long.class));
+ primitiveTypes.put(Float.class, primitiveTypes.get(float.class));
+ primitiveTypes.put(Double.class, primitiveTypes.get(double.class));
+ primitiveTypes.put(byte[].class, new BinaryTypeHelper());
+ primitiveTypes.put(ErlangAtom.class, new AtomTypeHelper());
+ }
+
+ private static TypeHelper getTypeHelper(Class<?> forClass,
+ Annotation[] notes) {
+ TypeHelper typeHelper = null;
+ // check for special types marked by annotations
+ for (int i = 0; i < notes.length; i++) {
+ typeHelper = primitiveTypes.get(notes[i].annotationType());
+ if (typeHelper != null) {
+ // get type which is annotated, reduce array if needed
+ Class<?> annotatedType = forClass;
+ while (annotatedType.isArray()) {
+ annotatedType = annotatedType.getComponentType();
+ }
+ if (notes[i].annotationType().equals(ErlangAtom.class)
+ && !annotatedType.equals(String.class)) {
+ // NOTE: @ErlangAtom atom will be ignored if not annotates
+ // string
+ typeHelper = null;
+ } else {
+ // check if annotation points to array
+ if (forClass.isArray()) {
+ typeHelper = new AnnotatedListTypeHelper(notes);
+ }
+ break;
+ }
+ }
+ }
+ // check for standard types
+ if (typeHelper == null) {
+ typeHelper = primitiveTypes.get(forClass);
+ }
+ // check for arrays
+ if (typeHelper == null && forClass.isArray()) {
+ typeHelper = new ListTypeHelper();
+ }
+ // others would be tuples
+ if (typeHelper == null) {
+ typeHelper = new TupleTypeHelper();
+ }
+ return typeHelper;
+ }
+
+ /**
+ * Converts single Java object into Erlang
+ *
+ * @param object
+ * @param notes
+ * @return
+ */
+ public static OtpErlangObject toErlang(Object object, Annotation[] notes) {
+ TypeHelper helper = getTypeHelper(object.getClass(), notes);
+ return helper.toErlang(object);
+ }
+
+ /**
+ * Converts Java objects arrays to Erlang: 1. single object (if array arity
+ * == 1) or 2. tuple (if array arity > 1)
+ *
+ * @param objects
+ * @return
+ */
+ public static OtpErlangObject toErlang(Object[] objects,
+ Annotation[][] notes) {
+ OtpErlangObject result = null;
+ if (objects != null) {
+ TypeHelper helper = null;
+ switch (objects.length) {
+ case 0:
+ result = new OtpErlangList();
+ break;
+ case 1:
+ helper = getTypeHelper(objects[0].getClass(), notes[0]);
+ result = helper.toErlang(objects[0]);
+ break;
+ default:
+ OtpErlangObject[] erlObjects = new OtpErlangObject[objects.length];
+ for (int i = 0; i < objects.length; i++) {
+ helper = getTypeHelper(objects[i].getClass(), notes[i]);
+ erlObjects[i] = helper.toErlang(objects[i]);
+ }
+ result = new OtpErlangTuple(erlObjects);
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Creates Erlang list basing on unknown Java arrays
+ *
+ * @param array
+ * @param notes
+ * @return
+ */
+ public static OtpErlangList toErlangAsList(Object array,
+ Annotation[][] notes) {
+ return toErlangAsList(array, notes, false);
+ }
+
+ /**
+ * Creates Erlang list of result elements
+ *
+ * @param array
+ * @param notes
+ * @return
+ */
+ public static OtpErlangList toErlangAsResultList(Object array,
+ Annotation[] notes) {
+ return toErlangAsList(array, new Annotation[][] { notes }, true);
+ }
+
+ /**
+ *
+ * @param array
+ * @param notes
+ * @param isArray
+ * @return
+ */
+ private static OtpErlangList toErlangAsList(Object array,
+ Annotation[][] notes, boolean isArray) {
+ OtpErlangList result = null;
+ if (array != null) {
+ List<OtpErlangObject> attrsList = new ArrayList<OtpErlangObject>();
+ int i = 0;
+ while (true) {
+ try {
+ Annotation[] currNotes = isArray ? notes[0] : notes[i];
+ TypeHelper helper = getTypeHelper(Array.get(array, i)
+ .getClass(), currNotes);
+ attrsList.add(helper.toErlang(Array.get(array, i)));
+ i++;
+ } catch (ArrayIndexOutOfBoundsException e) {
+ break;
+ }
+ }
+ result = new OtpErlangList(attrsList
+ .toArray(new OtpErlangObject[attrsList.size()]));
+ } else {
+ result = new OtpErlangList();
+ }
+ return result;
+ }
+
+ /**
+ * Converts single Erlang object to Java
+ *
+ * @param object
+ * @param forClass
+ * @return
+ * @throws Exception
+ */
+ public static Object toJava(OtpErlangObject object, Class<?> forClass,
+ Annotation[] notes) throws Exception {
+ try {
+ TypeHelper helper = getTypeHelper(forClass, notes);
+ return helper.toJava(object, forClass);
+ } catch (ClassCastException e) {
+ throw new TypeMismatchException(forClass, object.getClass());
+ }
+ }
+
+ /**
+ * Creates array of Java objects from Erlang list
+ *
+ * @param objects
+ * @param forClass
+ * @return
+ * @throws Exception
+ */
+ public static Object[] toJavaFromList(OtpErlangList objects,
+ Class<?>[] forClass, Annotation[][] notes) throws Exception {
+ Object[] result = new Object[objects.arity()];
+ try {
+ for (int i = 0; i < objects.arity(); i++) {
+ TypeHelper helper = getTypeHelper(forClass[i], notes[i]);
+ result[i] = helper.toJava(objects.elementAt(i), forClass[i]);
+ }
+ } catch (Exception e) {
+ // type mismatch as mismatch of parameters count or parameters type
+ if (e.getClass().equals(ClassCastException.class)
+ || e.getClass()
+ .equals(ArrayIndexOutOfBoundsException.class))
+ throw new TypeMismatchException();
+ }
+ return result;
+ }
+
+ /**
+ * Converts incoming Erlang message to operation arguments
+ *
+ * @param objects
+ * @param forClass
+ * @return
+ * @throws Exception
+ */
+ public static Object[] toJavaAsArgs(OtpErlangObject objects,
+ Class<?>[] forClass, Annotation[][] notes) throws Exception {
+ OtpErlangObject[] args = null;
+ // normalize input
+ if (objects.getClass().equals(OtpErlangTuple.class)) {
+ args = new OtpErlangObject[((OtpErlangTuple) objects).arity()];
+ for (int i = 0; i < ((OtpErlangTuple) objects).arity(); i++) {
+ args[i] = ((OtpErlangTuple) objects).elementAt(i);
+ }
+ } else {
+ args = new OtpErlangObject[1];
+ args[0] = objects;
+ }
+ Object[] result = new Object[args.length];
+ try {
+ for (int i = 0; i < args.length; i++) {
+ TypeHelper helper = getTypeHelper(forClass[i], notes[i]);
+ result[i] = helper.toJava(args[i], forClass[i]);
+ }
+ } catch (Exception e) {
+ // type mismatch as mismatch of parameters count or parameters type
+ if (e.getClass().equals(ClassCastException.class)
+ || e.getClass()
+ .equals(ArrayIndexOutOfBoundsException.class))
+ throw new TypeMismatchException();
+ }
+ return result;
+ }
+
+}