indexing description: "[ This is marhaling functions for your custom Eiffel type that already existed before you decided to use the GigaSpaces platform ]" status: "See notice at end of class." legal: "See notice at end of class." date: "$Date$" revision: "$Revision$" class PERSON_MARSHALING inherit MARSHALING_FUNCTIONS feature fields_Count: INTEGER = 8 class_name: STRING = "Person" marshal (source: PERSON; add_type_info: BOOLEAN): EGS_EXTERNAL_ENTRY is -- require source_not_void: source /= Void local names: ARRAY[STRING] types: ARRAY[STRING] values: ARRAY[JAVA_OBJECT] do if add_type_info then -- the first time around, we have to add the typeinfo -- to give the Gigaspaces infrastructure the necessary -- metadata about our Eiffel type create names.make (1, fields_Count); create types.make (1, fields_Count); names.put ("age", 1) names.put ("birth_date", 2) names.put ("height", 3) names.put ("id", 4) names.put ("is_married", 5) names.put ("name", 6) names.put ("phone", 7) names.put ("weight", 8) types.put (integer_32_type_name, 1) types.put (string_type_name, 2) types.put (real_64_type_name, 3) types.put (string_type_name, 4) types.put (boolean_type_name, 5) types.put (string_type_name, 6) types.put (integer_64_type_name, 7) types.put (real_32_type_name, 8) end create values.make (1, fields_Count); values.put (marshal_integer_32 (source.age), 1) values.put (marshal_string (source.birth_date), 2) values.put (marshal_real_64 (source.height), 3) values.put (marshal_string (source.id), 4) values.put (marshal_boolean (source.is_married), 5) values.put (marshal_string (source.name), 6) values.put (marshal_integer_64 (source.phone), 7) values.put (marshal_real_32 (source.weight), 8) if add_type_info then create Result.make_from_classname_values_names_types (class_Name, values, names, types ); else create Result.make_from_classname_values (class_Name, values); end end unmarshal (source: EGS_EXTERNAL_ENTRY; dest: PERSON) is -- require source_not_void: source /= Void dest_not_void: dest /= Void local fields: JAVA_OBJECT_ARRAY do fields := source.get_fields_values if fields /= Void then -- Age dest.set_age (unmarshal_integer_32 (fields.item (0))) --birth_date dest.set_birth_date (unmarshal_string (fields.item (1))) --Height dest.set_height (unmarshal_real_64 (fields.item (2))) -- Id dest.set_id (unmarshal_string (fields.item (3))) --is_married dest.set_married (unmarshal_boolean (fields.item (4))) -- name dest.set_name (unmarshal_string (fields.item (5))) -- phone dest.set_phone (unmarshal_integer_64 (fields.item (6))) --weight dest.set_weight (unmarshal_real_32 (fields.item (7))) end end indexing copyright: "Copyright (c) 2008, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 356 Storke Road, Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end