Examples of MutableListType


Examples of com.volantis.shared.metadata.type.mutable.MutableListType

        return VALUE_FACTORY.createListValue();
    }

    public void testVerifyUniqueMemberConstraint() {

        final MutableListType listType = TYPE_FACTORY.createListType();

        final ImmutableUniqueMemberConstraint uniqueMemberConstraint =
            CONSTRAINT_FACTORY.getUniqueMemberConstraint();
        listType.setUniqueMemberConstraint(uniqueMemberConstraint);

        // check constraint with right value
        MutableListValue listValue =
            (MutableListValue) createCollectionValue(new String[]{"one", "two"});
        Collection errors = listType.verify(listValue);
        assertEquals(0, errors.size());

        // check constraint violation
        listValue =
            (MutableListValue) createCollectionValue(new String[]{"one", "one"});
        errors = listType.verify(listValue);
        assertEquals(1, errors.size());
        final MutableStringValue stringValue = VALUE_FACTORY.createStringValue();
        stringValue.setValue("one");
        final VerificationError error =
            (VerificationError) errors.iterator().next();
View Full Code Here

Examples of com.volantis.shared.metadata.type.mutable.MutableListType

        super(memberType);
    }

    // Javadoc inherited.
    public ImmutableMetaDataType createMetaDataType() {
        MutableListType mutableListType = TYPE_FACTORY.createListType();

        // Set unique member constraint.
        ImmutableUniqueMemberConstraint uniqueMemberConstraint =
                CONSTRAINT_FACTORY.getUniqueMemberConstraint();
        mutableListType.setUniqueMemberConstraint(uniqueMemberConstraint);

        // Set member type constraint.
        MutableMemberTypeConstraint memberTypeConstraint =
                CONSTRAINT_FACTORY.createMemberTypeConstraint();
        InternalPolicyType memberType =
                (InternalPolicyType) getMemberPolicyType();
        memberTypeConstraint.setMemberType(memberType.createMetaDataType());
        mutableListType.setMemberTypeConstraint(memberTypeConstraint);

        return (ImmutableMetaDataType) mutableListType.createImmutable();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.