NewFromSession (PersistentObjectInfo function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
(10 intermediate revisions by 2 users not shown)
Line 6: Line 6:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%persObjInfo</th><td>A <var>PersistentObjectInfo</var> object variable.</td></tr>
<tr><th>%persObjInfo</th><td>A <var>PersistentObjectInfo</var> object variable.</td></tr>
<tr><th><var>(PersistentObjectInfo)</var></th>
<tr><th><var>[(PersistentObjectInfo):]</var></th>
<td>The class name in parentheses denotes a [[Notation conventions for methods#Shared members|shared]] method. <var>NewFromSession</var> can also be invoked via a <var>PersistentObjectInfo</var> object variable, which may be <var>Null</var>.</td></tr>
<td>This optional specification of the class in parentheses denotes a [[Notation conventions for methods#Constructors|virtual constructor]]. See [[#Usage notes|"Usage notes"]], below, for more information about invoking <var>NewFromSession</var>.</td></tr>
<tr><th>string</th>
<tr><th>name</th>
<td>A string that identifies the name of the session variable whose information is returned to <var class="term">%persObjList</var>.</td></tr>
<td>A string that identifies the name of the session variable whose information is returned to <var class="term">%persObjinfo</var>.</td></tr>
</table>
</table>


Line 15: Line 15:
<ul>
<ul>
<li>Invoking <var>NewFromSession</var> if not in a session cancels the request.  
<li>Invoking <var>NewFromSession</var> if not in a session cancels the request.  
<li>As described in [[Object variables#Virtual Constructor methods|"Virtual Constructor methods"]], <var>NewFromSession</var> can be invoked with
no method object, with an explicit class specification, or with an object variable of the class,
even if that object is <var>Null</var>:
<p class="code">%persObjInf = NewFromSession('EXCHG')
%persObjInf = %(PersistentObjectInfo):NewFromSession('EXCHG')
%persObjInf = %persObjInf:NewFromSession('EXCHG')
</p>
</ul>
</ul>


==Examples==
==Examples==
In this example, a <var>PersistentObjectInfo</var> object is defined for a session (which is created within the request):
<p class="code">b                                                                                                   
%rc is float
%rc = [[$Session_Create|$Session_Create]]('TEST', 'JAL') 
%persInfo    is object persistentObjectInfo                                                         
%sl is object stringlist
%s2 is object stringlist
%sls is collection arraylist of object stringlist session('TEST')   
%sl = list('alpha', 'beta', 'ceta')                         
%sl2 = list('one', 'two', 'three')
%sls = list(%sl, %sl2) 
                                                                     
%persInfo = newFromSession('TEST')                                         
printText {~} = {%persInfo:name}
printText {~} = {%persInfo:classDescription}
printText {~} = {%persInfo:setTime}
end
</p>
The result is:
<p class="output">%persInfo:name = TEST
%persInfo:classDescription = System:Arraylist of Object System:Stringlist
%persInfo:setTime = 20110829155737657
</p>
==See also==
==See also==
{{Template:PersistentObjectInfo:NewFromSession footer}}
{{Template:PersistentObjectInfo:NewFromSession footer}}

Latest revision as of 22:05, 19 July 2012

Get info about session object (PersistentObjectInfo class)

[Introduced in Sirius Mods 7.8]


Syntax

%persObjInfo = [%(PersistentObjectInfo):]NewFromSession( name)

Syntax terms

%persObjInfoA PersistentObjectInfo object variable.
[(PersistentObjectInfo):] This optional specification of the class in parentheses denotes a virtual constructor. See "Usage notes", below, for more information about invoking NewFromSession.
name A string that identifies the name of the session variable whose information is returned to %persObjinfo.

Usage notes

  • Invoking NewFromSession if not in a session cancels the request.
  • As described in "Virtual Constructor methods", NewFromSession can be invoked with no method object, with an explicit class specification, or with an object variable of the class, even if that object is Null:

    %persObjInf = NewFromSession('EXCHG') %persObjInf = %(PersistentObjectInfo):NewFromSession('EXCHG') %persObjInf = %persObjInf:NewFromSession('EXCHG')

Examples

In this example, a PersistentObjectInfo object is defined for a session (which is created within the request):

b %rc is float %rc = $Session_Create('TEST', 'JAL') %persInfo is object persistentObjectInfo %sl is object stringlist %s2 is object stringlist %sls is collection arraylist of object stringlist session('TEST') %sl = list('alpha', 'beta', 'ceta') %sl2 = list('one', 'two', 'three') %sls = list(%sl, %sl2) %persInfo = newFromSession('TEST') printText {~} = {%persInfo:name} printText {~} = {%persInfo:classDescription} printText {~} = {%persInfo:setTime} end

The result is:

%persInfo:name = TEST %persInfo:classDescription = System:Arraylist of Object System:Stringlist %persInfo:setTime = 20110829155737657

See also