Results 1 to 4 of 4

Thread: Intializing members of a slice generated class

  1. #1
    Venkat Seeth is offline Registered User
    Join Date
    Feb 2005
    Posts
    32

    Intializing members of a slice generated class

    Hi there,

    Howdy. I've a question on intializing members of a slice generated class.

    How are sequences intialized. Do we need to check for null everytime before we add something to it or is there any other way of initializing these members.

    Thanks,
    Venkat

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Which language mapping are you referring to? Java?

    Java initializes reference members to null by default, and the Slice mapping for Java doesn't alter that behavior. The Ice run time interprets a null sequence or dictionary member as an empty container, so there is no need to initialize the member before marshaling if you plan to leave it empty.

    Take care,
    - Mark

  3. #3
    Venkat Seeth is offline Registered User
    Join Date
    Feb 2005
    Posts
    32
    Hi Mark,

    Thanks for the reply. Yes, Java is the programming language.

    I've mapped the sequence as:

    ["java:type:java.util.ArrayList"] sequence<Foo> FooList;

    If I'm adding objetcs into FooList, I''ll need to check for NULL in the code before I add into that List. Is there any way to specify defaults or some callback to initialize these types.

    Thanks,
    Venkat

  4. #4
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi,

    I'm afraid there is no way to change the initialization behavior of the generated code.

    Take care,
    - Mark

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. packageless class generated by Slice2java
    By sylvain in forum Help Center
    Replies: 5
    Last Post: 11-05-2010, 10:57 AM
  2. Replies: 1
    Last Post: 01-23-2009, 11:35 AM
  3. Replies: 1
    Last Post: 11-29-2007, 07:26 AM
  4. Slice class data members -> private in Java/C++?
    By sasho2 in forum Help Center
    Replies: 3
    Last Post: 04-09-2007, 03:28 PM
  5. Generated Java Helper class has errors
    By ygarbourg in forum Help Center
    Replies: 2
    Last Post: 05-06-2005, 02:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •