From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9c6e774bffb6a09e X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.129.169 with SMTP id nx9mr7015047pbb.8.1326701442810; Mon, 16 Jan 2012 00:10:42 -0800 (PST) Path: lh20ni187866pbb.0!nntp.google.com!news1.google.com!postnews.google.com!w4g2000vbc.googlegroups.com!not-for-mail From: AdaMagica Newsgroups: comp.lang.ada Subject: Re: : Ada Utility Library 1.4.0 is available Date: Mon, 16 Jan 2012 00:10:38 -0800 (PST) Organization: http://groups.google.com Message-ID: <6c0b74d1-6d8d-4ef8-9132-c4e57b48f323@w4g2000vbc.googlegroups.com> References: <4f13480d$0$5689$ba4acef3@reader.news.orange.fr> NNTP-Posting-Host: 91.7.93.93 Mime-Version: 1.0 X-Trace: posting.google.com 1326701438 20670 127.0.0.1 (16 Jan 2012 08:10:38 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 16 Jan 2012 08:10:38 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w4g2000vbc.googlegroups.com; posting-host=91.7.93.93; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESNKRC X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.0; rv:9.0.1) Gecko/20100101 Firefox/9.0.1,gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-01-16T00:10:38-08:00 List-Id: Hm, I looked at your beans, and I do not see the value of this. What's the advantage of returning components with string names versus returning them as usual? First of all, the components are visible. If they aren't, why not just use function Radius (B: Compute_Bean) return Float; -------------- with Util.Beans.Basic; with Util.Beans.Objects; ... type Compute_Bean is new Util.Beans.Basic.Bean with record Height : My_Float := -1.0; Radius : My_Float := -1.0; end record; -- Get the value identified by the name. overriding function Get_Value (From : Compute_Bean; Name : String) return Util.Beans.Objects.Object; -- Set the value identified by the name. overriding procedure Set_Value (From : in out Compute_Bean; Name : in String; Value : in Util.Beans.Objects.Object); Bean Implementation The getter and setter will identify the property to get or set through a name. The value is represented by an Object type that can hold several data types (boolean, integer, floats, strings, dates, ...). The getter looks for the name and returns the corresponding value in an Object record. Several To_Object functions helps in creating the result value. function Get_Value (From : Compute_Bean; Name : String) return Util.Beans.Objects.Object is begin if Name = "radius" and From.Radius >= 0.0 then return Util.Beans.Objects.To_Object (Float (From.Radius)); elsif Name = "height" and From.Height >= 0.0 then return Util.Beans.Objects.To_Object (Float (From.Height)); else return Util.Beans.Objects.Null_Object; end if; end Get_Value;