class EL_REFLECTIVELY_SETTABLE

(source code)

Client examples: COMMA_SEPARATED_IMPORT_TEST_SETCOUNTRYDUPLICITY_ARGUMENTSJOBJSON_CURRENCYMY_DRY_CLASSPERSONREFLECTION_TEST_SETREPOSITORY_SOURCE_LINK_EXPANDER_TEST_SET

Description

Object with field_table attribute of field getter-setter's. See class EL_REFLECTED_FIELD_TABLE

Notes

When inheriting this class, rename field_included as either is_any_field or is_string_or_expanded_field.

Override use_default_values to return False if the default values set by set_default_values is not required.

Descendants

EL_REFLECTIVELY_SETTABLE*
   MY_DRY_CLASS
   AIA_CREDENTIAL_ID
   JOB
   PP_ADDRESS
   JSON_CURRENCY
   AIA_RESPONSE
      AIA_PURCHASE_RESPONSE
         AIA_REVOKE_RESPONSE
      AIA_GET_USER_ID_RESPONSE
   AIA_REQUEST*
      AIA_GET_USER_ID_REQUEST
      AIA_PURCHASE_REQUEST
         AIA_REVOKE_REQUEST
   PP_TRANSACTION
      PAYPAL_TRANSACTION
   EL_COOKIE_SETTABLE*
      LICENSE_INFO
   PP_ADDRESS
      ADDRESS
   PP_PRODUCT_INFO
   FCGI_HTTP_HEADERS
   EL_REFLECTIVELY_SETTABLE_STORABLE*
      AIA_CREDENTIAL
      EL_UUID
      EL_STORABLE_IMPL
      EL_TRANSLATION_ITEM
      MP3_IDENTIFIER
   PP_BUTTON_DETAIL
   PP_REFLECTIVELY_SETTABLE*
      PP_SETTABLE_FROM_UPPER_CAMEL_CASE
         PP_BUTTON_META_DATA
         PP_HTTP_RESPONSE
            PP_BUTTON_SEARCH_RESULTS
            PP_BUTTON_QUERY_RESULTS
               PP_BUTTON_DETAILS_QUERY_RESULTS
         PP_BUTTON_OPTION
      PP_CONVERTABLE_TO_PARAMETER_LIST
         PP_HOSTED_BUTTON
         PP_API_VERSION
         PP_CREDENTIALS
         PP_DATE_TIME_RANGE
         PP_BUTTON_LOCALE
         PP_BUTTON_METHOD
            PP_CREATE_BUTTON_METHOD
            PP_GET_BUTTON_DETAILS_METHOD
            PP_UPDATE_BUTTON_METHOD
            PP_BUTTON_SEARCH_METHOD
            PP_MANAGE_BUTTON_STATUS_METHOD
   EL_ENUMERATION*
      AIA_RESPONSE_ENUM
      AIA_REASON_ENUM
      EL_CURRENCY_ENUM
      EL_HTTP_STATUS_ENUM
      PP_PAYMENT_PENDING_REASON_ENUM
      PP_PAYMENT_STATUS_ENUM
      PP_L_VARIABLE_ENUM
      PP_TRANSACTION_TYPE_ENUM
   FCGI_REQUEST_PARAMETERS
   FCGI_SETTABLE_FROM_SERVLET_REQUEST*
   EL_CONVERTABLE_TO_HTTP_PARAMETER_LIST*
      PP_CONVERTABLE_TO_PARAMETER_LIST
   EL_DYNAMIC_MODULE_POINTERS
      EL_IMAGE_UTILS_API_POINTERS
      EL_CURL_API_POINTERS
   EL_REFLECTIVE_EIF_OBJ_BUILDER_CONTEXT*
      EL_BOOK_INFO
      RBOX_IRADIO_ENTRY
         RBOX_IGNORED_ENTRY
            RBOX_SONG
               RBOX_CORTINA_SONG
                  RBOX_CORTINA_TEST_SONG
               RBOX_TEST_SONG
                  RBOX_CORTINA_TEST_SONG
note
	description: "[
		Object with `field_table' attribute of field getter-setter's. See class [$source EL_REFLECTED_FIELD_TABLE]
	]"
	notes: "[
		When inheriting this class, rename `field_included' as either `is_any_field' or `is_string_or_expanded_field'.

		Override `use_default_values' to return `False' if the default values set
		by `set_default_values' is not required.
	]"
	descendants: "See end of class"

	author: "Finnian Reilly"
	copyright: "Copyright (c) 2001-2017 Finnian Reilly"
	contact: "finnian at eiffel hyphen loop dot com"

	license: "MIT license (See: en.wikipedia.org/wiki/MIT_License)"
	date: "2018-10-27 10:01:17 GMT (Saturday 27th October 2018)"
	revision: "14"

deferred class
	EL_REFLECTIVELY_SETTABLE

inherit
	EL_REFLECTIVE
		redefine
			Except_fields, is_equal, field_table
		end

feature {NONE} -- Initialization

	make_default
		do
			if not attached field_table then
				field_table := Meta_data_by_type.item (Current).field_table
				if use_default_values then
					initialize_fields
				end
			end
		end

feature -- Access

	comma_separated_names: STRING
		--
		do
			Result := field_name_list.joined (',')
		end

	comma_separated_values: ZSTRING
		--
		local
			table: like field_table; list: EL_ZSTRING_LIST; csv: like CSV_escaper
			value: ZSTRING
		do
			table := field_table; csv := CSV_escaper
			create list.make (table.count)
			create value.make_empty
			from table.start until table.after loop
				value.wipe_out
				value.append_string_general (table.item_for_iteration.to_string (Current))
				list.extend (csv.escaped (value, True))
				table.forth
			end
			Result := list.joined (',')
		end

feature {EL_REFLECTION_HANDLER} -- Access

	field_table: EL_REFLECTED_FIELD_TABLE

feature -- Comparison

	is_equal (other: like Current): BOOLEAN
		do
			Result := all_fields_equal (other)
		end

feature {NONE} -- Implementation

	use_default_values: BOOLEAN
		do
			Result := True
		end

feature {NONE} -- Constants

	Except_fields: STRING
			-- list of comma-separated fields to be excluded
		once
			Result := "field_table"
		end

	CSV_escaper: EL_COMMA_SEPARATED_VALUE_ESCAPER
		once
			create Result.make
		end

note
	descendants: "[
			EL_REFLECTIVELY_SETTABLE*
				[$source MY_DRY_CLASS]
				[$source AIA_CREDENTIAL_ID]
				[$source JOB]
				[$source PP_ADDRESS]
				[$source JSON_CURRENCY]
				[$source AIA_RESPONSE]
					[$source AIA_PURCHASE_RESPONSE]
						[$source AIA_REVOKE_RESPONSE]
					[$source AIA_GET_USER_ID_RESPONSE]
				[$source AIA_REQUEST]*
					[$source AIA_GET_USER_ID_REQUEST]
					[$source AIA_PURCHASE_REQUEST]
						[$source AIA_REVOKE_REQUEST]
				[$source PP_TRANSACTION]
					[$source PAYPAL_TRANSACTION]
				[$source EL_COOKIE_SETTABLE]*
					[$source LICENSE_INFO]
				[$source PP_ADDRESS]
					[$source ADDRESS]
				[$source PP_PRODUCT_INFO]
				[$source FCGI_HTTP_HEADERS]
				[$source EL_REFLECTIVELY_SETTABLE_STORABLE]*
					[$source AIA_CREDENTIAL]
					[$source EL_UUID]
					[$source EL_STORABLE_IMPL]
					[$source EL_TRANSLATION_ITEM]
					[$source MP3_IDENTIFIER]
				[$source PP_BUTTON_DETAIL]
				[$source PP_REFLECTIVELY_SETTABLE]*
					[$source PP_SETTABLE_FROM_UPPER_CAMEL_CASE]
						[$source PP_BUTTON_META_DATA]
						[$source PP_HTTP_RESPONSE]
							[$source PP_BUTTON_SEARCH_RESULTS]
							[$source PP_BUTTON_QUERY_RESULTS]
								[$source PP_BUTTON_DETAILS_QUERY_RESULTS]
						[$source PP_BUTTON_OPTION]
					[$source PP_CONVERTABLE_TO_PARAMETER_LIST]
						[$source PP_HOSTED_BUTTON]
						[$source PP_API_VERSION]
						[$source PP_CREDENTIALS]
						[$source PP_DATE_TIME_RANGE]
						[$source PP_BUTTON_LOCALE]
						[$source PP_BUTTON_METHOD]
							[$source PP_CREATE_BUTTON_METHOD]
							[$source PP_GET_BUTTON_DETAILS_METHOD]
							[$source PP_UPDATE_BUTTON_METHOD]
							[$source PP_BUTTON_SEARCH_METHOD]
							[$source PP_MANAGE_BUTTON_STATUS_METHOD]
				[$source EL_ENUMERATION]*
					[$source AIA_RESPONSE_ENUM]
					[$source AIA_REASON_ENUM]
					[$source EL_CURRENCY_ENUM]
					[$source EL_HTTP_STATUS_ENUM]
					[$source PP_PAYMENT_PENDING_REASON_ENUM]
					[$source PP_PAYMENT_STATUS_ENUM]
					[$source PP_L_VARIABLE_ENUM]
					[$source PP_TRANSACTION_TYPE_ENUM]
				[$source FCGI_REQUEST_PARAMETERS]
				[$source FCGI_SETTABLE_FROM_SERVLET_REQUEST]*
				[$source EL_CONVERTABLE_TO_HTTP_PARAMETER_LIST]*
					[$source PP_CONVERTABLE_TO_PARAMETER_LIST]
				[$source EL_DYNAMIC_MODULE_POINTERS]
					[$source EL_IMAGE_UTILS_API_POINTERS]
					[$source EL_CURL_API_POINTERS]
				[$source EL_REFLECTIVE_EIF_OBJ_BUILDER_CONTEXT]*
					[$source EL_BOOK_INFO]
					[$source RBOX_IRADIO_ENTRY]
						[$source RBOX_IGNORED_ENTRY]
							[$source RBOX_SONG]
								[$source RBOX_CORTINA_SONG]
									[$source RBOX_CORTINA_TEST_SONG]
								[$source RBOX_TEST_SONG]
									[$source RBOX_CORTINA_TEST_SONG]
	]"
end