Announcement Announcement Module
Collapse
No announcement yet.
group order of bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • group order of bean

    Hi

    I have a situtation and I can't find solution. Below I try to describe what I want to create.

    I have two been-classes "Byte" and "Command".

    ---- simple.xml ---

    <bean id="byte1" class="...Byte" />
    <bean id="byte2" class="...Byte" />
    <bean id="byte3" class="...Byte" />
    <bean id="byte4" class="...Byte" />
    <bean id="byte5" class="...Byte" />


    <bean id="command" >
    <property name="bytelist">
    <list>
    <ref been="byte1"/>
    ....
    ....
    ...
    <ref been="byteX"/>
    </list>
    </property>

    </bean>


    ---- end of file -----

    I would like to create some contruction where I don't need everytime change list-references while I add or remove some Byte - beens ? And also I would like to keep ordering , when I write been as first I have to be sure that this been goes at postition first in my list ? You know what I mean ?
    I have read about autowire depends but I affraid that this is not enough.

  • #2
    You can explicitly control the type of List that will be instantiated;
    use of the 'list-class' attribute; configure a ordered collection implementation as list-class

    <bean id="command" >
    <util:list id="bytelist" list-class="java.util.XXXXX">
    <bean ref="byte1"/>
    <bean ref="byte2"/>
    ...
    <bean ref="byten"/>
    </util:list>
    </property>

    Comment


    • #3
      Originally posted by vvairam View Post
      You can explicitly control the type of List that will be instantiated;
      use of the 'list-class' attribute; configure a ordered collection implementation as list-class

      <bean id="command" >
      <util:list id="bytelist" list-class="java.util.XXXXX">
      <bean ref="byte1"/>
      <bean ref="byte2"/>
      ...
      <bean ref="byten"/>
      </util:list>
      </property>

      Hi vvairam .

      But how auto assign many the same been-object (with order of creation) to some list of type those beens.
      I don't want use <ref been="instacenX"/> and duplicate again this markups.
      I don't want touch "command" been (set property etc), only add or remove
      <been id="byteX" class="..Byte"> from file, it is possible to create ?

      ------ for example ----
      <bean 1/>
      <bean 2/>
      .
      .
      <bean N/>


      <bean command>
      <list>
      <auto assign all bean (we don't know how many objects are defined in this file) , but we know only type /> I would like put here all object 1..N
      <list>
      </bean>
      ----------------

      Now I think is more clarify

      Regards

      Comment

      Working...
      X