Class DynUnionImpl

All Implemented Interfaces:
Serializable, Object, IDLEntity, DynAny, DynAnyOperations, DynUnion, DynUnionOperations

public class DynUnionImpl extends DynAnyConstructedImpl implements DynUnion
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • discriminator

      DynAny discriminator
    • currentMember

      DynAny currentMember
    • currentMemberIndex

      int currentMemberIndex
  • Constructor Details

    • DynUnionImpl

      protected DynUnionImpl(ORB orb, Any any, boolean copyValue)
    • DynUnionImpl

      protected DynUnionImpl(ORB orb, TypeCode typeCode)
  • Method Details

    • initializeComponentsFromAny

      protected boolean initializeComponentsFromAny()
      Specified by:
      initializeComponentsFromAny in class DynAnyConstructedImpl
    • initializeComponentsFromTypeCode

      protected boolean initializeComponentsFromTypeCode()
      Specified by:
      initializeComponentsFromTypeCode in class DynAnyConstructedImpl
    • discriminatorType

      private TypeCode discriminatorType()
    • memberCount

      private int memberCount()
    • memberLabel

      private Any memberLabel(int i)
    • memberType

      private TypeCode memberType(int i)
    • memberName

      private String memberName(int i)
    • defaultIndex

      private int defaultIndex()
    • currentUnionMemberIndex

      private int currentUnionMemberIndex(Any discriminatorValue)
    • clearData

      protected void clearData()
      Overrides:
      clearData in class DynAnyConstructedImpl
    • get_discriminator

      public DynAny get_discriminator()
      Returns the current discriminator value.
      Specified by:
      get_discriminator in interface DynUnionOperations
      Returns:
      current discriminator value.
    • set_discriminator

      public void set_discriminator(DynAny newDiscriminator) throws TypeMismatch
      Description copied from interface: DynUnionOperations
      Sets the discriminator of the DynUnion to the specified value. Setting the discriminator to a value that is consistent with the currently active union member does not affect the currently active member. Setting the discriminator to a value that is inconsistent with the currently active member deactivates the member and activates the member that is consistent with the new discriminator value (if there is a member for that value) by initializing the member to its default value. Setting the discriminator of a union sets the current position to 0 if the discriminator value indicates a non-existent union member (has_no_active_member returns true in this case). Otherwise, if the discriminator value indicates a named union member, the current position is set to 1 (has_no_active_member returns false and component_count returns 2 in this case).
      Specified by:
      set_discriminator in interface DynUnionOperations
      Parameters:
      newDiscriminator - the discriminator of the union
      Throws:
      TypeMismatch - if the TypeCode of the parameter is not equivalent to the TypeCode of the union???s discriminator
    • set_to_default_member

      public void set_to_default_member() throws TypeMismatch
      Description copied from interface: DynUnionOperations
      Sets the discriminator to a value that is consistent with the value of the default case of a union. It sets the current position to zero and causes component_count to return 2.
      Specified by:
      set_to_default_member in interface DynUnionOperations
      Throws:
      TypeMismatch - if the union does not have an explicit default case
    • set_to_no_active_member

      public void set_to_no_active_member() throws TypeMismatch
      Description copied from interface: DynUnionOperations
      Sets the discriminator to a value that does not correspond to any of the unions case labels. It sets the current position to zero and causes component_count to return 1.
      Specified by:
      set_to_no_active_member in interface DynUnionOperations
      Throws:
      TypeMismatch - if the union has an explicit default case or if it uses the entire range of discriminator values for explicit case labels
    • has_no_active_member

      public boolean has_no_active_member()
      Description copied from interface: DynUnionOperations
      Returns true if the union has no active member, that is, the unions value consists solely of its discriminator because the discriminator has a value that is not listed as an explicit case label. Calling this operation on a union that has a default case returns false. Calling this operation on a union that uses the entire range of discriminator values for explicit case labels returns false.
      Specified by:
      has_no_active_member in interface DynUnionOperations
      Returns:
      if there is no active member
    • discriminator_kind

      public TCKind discriminator_kind()
      Description copied from interface: DynUnionOperations
      Returns the TCKind value of the discriminator's TypeCode.
      Specified by:
      discriminator_kind in interface DynUnionOperations
      Returns:
      the TCKing of the discriminator
    • member

      public DynAny member() throws InvalidValue
      Description copied from interface: DynUnionOperations
      Returns the currently active member. Note that the returned reference remains valid only for as long as the currently active member does not change. Using the returned reference beyond the life time of the currently active member raises OBJECT_NOT_EXIST.
      Specified by:
      member in interface DynUnionOperations
      Returns:
      the currently active member
      Throws:
      InvalidValue - if the union has no active member
    • member_name

      public String member_name() throws InvalidValue
      Description copied from interface: DynUnionOperations
      Returns the name of the currently active member. If the unions TypeCode does not contain a member name for the currently active member, the operation returns an empty string.
      Specified by:
      member_name in interface DynUnionOperations
      Returns:
      the name of the member
      Throws:
      InvalidValue - if the union has no active member
    • member_kind

      public TCKind member_kind() throws InvalidValue
      Description copied from interface: DynUnionOperations
      Returns the TCKind value of the currently active members TypeCode.
      Specified by:
      member_kind in interface DynUnionOperations
      Returns:
      the TCKind
      Throws:
      InvalidValue - if the union does not have a currently active member