[doc] misc. fix & improvements
[scilab.git] / scilab / modules / external_objects_java / help / en_US / jsetfield.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3 *
4 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
5 * Copyright (C) 2010 - 2011 - Calixte DENIZET <calixte@contrib.scilab.org>
6 *
7  * Copyright (C) 2012 - 2016 - Scilab Enterprises
8  *
9  * This file is hereby licensed under the terms of the GNU GPL v2.0,
10  * pursuant to article 5.3.4 of the CeCILL v.2.1.
11  * This file was originally licensed under the terms of the CeCILL v2.1,
12  * and continues to be available under such terms.
13  * For more information, see the COPYING file which you should have received
14  * along with this program.
15 *
16 *
17 -->
18 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="jsetfield">
19     <refnamediv>
20         <refname>jsetfield</refname>
21         <refpurpose>Set the field of a Java object</refpurpose>
22     </refnamediv>
23     <refsynopsisdiv>
24         <title>Syntax</title>
25         <synopsis>
26             jsetfield(object, fieldName, value)
27         </synopsis>
28     </refsynopsisdiv>
29     <refsection>
30         <title>Parameters</title>
31         <variablelist>
32             <varlistentry>
33                 <term>object</term>
34                 <listitem>
35                     <para>A mlist typed _JObj or _JClass or a Scilab variable</para>
36                 </listitem>
37             </varlistentry>
38             <varlistentry>
39                 <term>fieldName</term>
40                 <listitem>
41                     <para>A string giving the field name</para>
42                 </listitem>
43             </varlistentry>
44             <varlistentry>
45                 <term>value</term>
46                 <listitem>
47                     <para>A Scilab variable or mlist typed _JObj as new field value</para>
48                 </listitem>
49             </varlistentry>
50         </variablelist>
51     </refsection>
52     <refsection>
53         <title>Description</title>
54         <para>
55             Set the field named fieldName to the given value.
56         </para>
57         <para>
58             This function also works with beans properties which may not be mapped to a public java field.
59         </para>
60     </refsection>
61     <refsection>
62         <title>Examples</title>
63         <programlisting role="example"><![CDATA[
64                c = jcompile("Test", ["public class Test {";
65                                      "public int field;";
66                                      "public Test(int n) {";
67                                      "field = n;";
68                                      "}";
69                                      "}";]);
70                t = c.new(128);
71                t.field
72                jsetfield(t, "field", 256);
73                t.field
74
75                // But it is easier to use...
76                t.field = 512;
77                t.field
78                jremove c t;
79       ]]></programlisting>
80         <programlisting role="example"><![CDATA[
81 jimport java.util.Date;
82
83 d = Date.new();
84 d.minutes = 3; // will call d.setMinutes(3);
85 jsetfield(d, "minutes", 3); // will call d.setMinutes(3);
86
87 jremove Date d;
88       ]]></programlisting>
89     </refsection>
90     <refsection role="see also">
91         <title>See also</title>
92         <simplelist type="inline">
93             <member>
94                 <link linkend="jgetfield">jgetfield</link>
95             </member>
96         </simplelist>
97     </refsection>
98     <refsection>
99         <title>History</title>
100         <revhistory>
101             <revision>
102                 <revnumber>5.5.0</revnumber>
103                 <revremark>
104                     Function introduced. Based on the 'JIMS' module. The main difference in the behavior compared to the JIMS module is that <link linkend="jautoUnwrap">jautoUnwrap</link> is enabled by default.
105                 </revremark>
106             </revision>
107         </revhistory>
108     </refsection>
109 </refentry>
110