FileDocCategorySizeDatePackage
DynAnyCollectionImpl.javaAPI DocJava SE 5 API6125Fri Aug 26 14:54:20 BST 2005com.sun.corba.se.impl.dynamicany

DynAnyCollectionImpl

public abstract class DynAnyCollectionImpl extends DynAnyConstructedImpl

Fields Summary
org.omg.CORBA.Any[]
anys
Constructors Summary
private DynAnyCollectionImpl()


    //
    // Constructors
    //

      
        this(null, (Any)null, false);
    
protected DynAnyCollectionImpl(com.sun.corba.se.spi.orb.ORB orb, org.omg.CORBA.Any any, boolean copyValue)

        super(orb, any, copyValue);
    
protected DynAnyCollectionImpl(com.sun.corba.se.spi.orb.ORB orb, org.omg.CORBA.TypeCode typeCode)

        super(orb, typeCode);
    
Methods Summary
protected abstract voidcheckValue(java.lang.Object[] value)

protected voidcreateDefaultComponentAt(int i, org.omg.CORBA.TypeCode contentType)

        try {
            components[i] = DynAnyUtil.createMostDerivedDynAny(contentType, orb);
        } catch (InconsistentTypeCode itc) { // impossible
        }
        // get a hold of the default initialized Any without copying
        anys[i] = getAny(components[i]);
    
protected intgetBound()

        try {
            return any.type().length();
        } catch (BadKind badKind) { // impossible
            return 0;
        }
    
protected org.omg.CORBA.TypeCodegetContentType()

        try {
            return any.type().content_type();
        } catch (BadKind badKind) { // impossible
            return null;
        }
    
public org.omg.CORBA.Any[]get_elements()

        if (status == STATUS_DESTROYED) {
	    throw wrapper.dynAnyDestroyed() ;
        }
        return (checkInitComponents() ? anys : null);
    
public org.omg.DynamicAny.DynAny[]get_elements_as_dyn_any()

        if (status == STATUS_DESTROYED) {
	    throw wrapper.dynAnyDestroyed() ;
        }
        return (checkInitComponents() ? components : null);
    
public voidset_elements(org.omg.CORBA.Any[] value)

        if (status == STATUS_DESTROYED) {
	    throw wrapper.dynAnyDestroyed() ;
        }
        checkValue(value);

        components = new DynAny[value.length];
        anys = value;

        // We know that this is of kind tk_sequence or tk_array
        TypeCode expectedTypeCode = getContentType();
        for (int i=0; i<value.length; i++) {
            if (value[i] != null) {
                if (! value[i].type().equal(expectedTypeCode)) {
                    clearData();
                    // _REVISIT_ More info
                    throw new TypeMismatch();
                }
                try {
                    // Creates the appropriate subtype without copying the Any
                    components[i] = DynAnyUtil.createMostDerivedDynAny(value[i], orb, false);
                    //System.out.println(this + " created component " + components[i]);
                } catch (InconsistentTypeCode itc) {
                    throw new InvalidValue();
                }
            } else {
                clearData();
                // _REVISIT_ More info
                throw new InvalidValue();
            }
        }
        index = (value.length == 0 ? NO_INDEX : 0);
        // Other representations are invalidated by this operation
        representations = REPRESENTATION_COMPONENTS;
    
public voidset_elements_as_dyn_any(org.omg.DynamicAny.DynAny[] value)

        if (status == STATUS_DESTROYED) {
	    throw wrapper.dynAnyDestroyed() ;
        }
        checkValue(value);

        components = (value == null ? emptyComponents : value);
        anys = new Any[value.length];

        // We know that this is of kind tk_sequence or tk_array
        TypeCode expectedTypeCode = getContentType();
        for (int i=0; i<value.length; i++) {
            if (value[i] != null) {
                if (! value[i].type().equal(expectedTypeCode)) {
                    clearData();
                    // _REVISIT_ More info
                    throw new TypeMismatch();
                }
                anys[i] = getAny(value[i]);
            } else {
                clearData();
                // _REVISIT_ More info
                throw new InvalidValue();
            }
        }
        index = (value.length == 0 ? NO_INDEX : 0);
        // Other representations are invalidated by this operation
        representations = REPRESENTATION_COMPONENTS;