Package com.volantis.shared.metadata.type.mutable

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


            TYPE_FACTORY.createStructureType();

        // set up the type strucutre
        final Set fieldTypes = structureType.getMutableFields();

        MutableFieldDefinition fieldDefinition =
            TYPE_FACTORY.createFieldDefinition("foo");
        final MutableStringType stringType = TYPE_FACTORY.createStringType();
        fieldDefinition.setType(stringType);
        fieldTypes.add(fieldDefinition);

        fieldDefinition = TYPE_FACTORY.createFieldDefinition("bar");
        final MutableBooleanType booleanType = TYPE_FACTORY.createBooleanType();
        fieldDefinition.setType(booleanType);
        fieldTypes.add(fieldDefinition);

        final MutableFieldDefinition childDefinition =
            TYPE_FACTORY.createFieldDefinition("child");
        final MutableStructureType childStructureType =
            TYPE_FACTORY.createStructureType();

        fieldDefinition = TYPE_FACTORY.createFieldDefinition("baz");
        final MutableNumberType numberType =
            TYPE_FACTORY.createNumberType();
        fieldDefinition.setType(numberType);
        childStructureType.getMutableFields().add(fieldDefinition);

        childDefinition.setType(childStructureType);
        fieldTypes.add(childDefinition);

        // set up the value strucutre
        final MutableStructureValue structureValue =
            VALUE_FACTORY.createStructureValue();
View Full Code Here


            TYPE_FACTORY.createStructureType();

        // set up the type strucutre
        final Set fieldTypes = structureType.getMutableFields();

        MutableFieldDefinition fieldDefinition =
            TYPE_FACTORY.createFieldDefinition("foo");
        final MutableStringType stringType = TYPE_FACTORY.createStringType();
        fieldDefinition.setType(stringType);
        fieldTypes.add(fieldDefinition);

        fieldDefinition = TYPE_FACTORY.createFieldDefinition("bar");
        final MutableBooleanType booleanType = TYPE_FACTORY.createBooleanType();
        fieldDefinition.setType(booleanType);
        fieldTypes.add(fieldDefinition);

        final MutableFieldDefinition childDefinition =
            TYPE_FACTORY.createFieldDefinition("child");
        final MutableStructureType childStructureType =
            TYPE_FACTORY.createStructureType();

        fieldDefinition = TYPE_FACTORY.createFieldDefinition("baz");
        final MutableNumberType numberType =
            TYPE_FACTORY.createNumberType();
        fieldDefinition.setType(numberType);
        childStructureType.getMutableFields().add(fieldDefinition);

        childDefinition.setType(childStructureType);
        fieldTypes.add(childDefinition);

        // set up the value strucutre
        final MutableStructureValue structureValue =
            VALUE_FACTORY.createStructureValue();
View Full Code Here

        return new ImmutableFieldDefinitionImpl();
    }

    // Javadoc inherited.
    public void testEqualsAndHashcodeImplementedCorrectly() {
        MutableFieldDefinition fieldDefinition1 = createFieldDefinitionForTestingEquals();
        MutableFieldDefinition fieldDefinition2 = createFieldDefinitionForTestingEquals();

        // test that both the values are equal and they have the same hash codes
        assertEquals("Object 1 should be equal to object 2", fieldDefinition1, fieldDefinition2);
        MetaDataTestCaseHelper.ensureHashcodesEqual(fieldDefinition1, fieldDefinition2);

        fieldDefinition2.setType(null);
        assertNotEquals(fieldDefinition1, fieldDefinition2);
        MetaDataTestCaseHelper.ensureHashcodesNotEqual(fieldDefinition1, fieldDefinition2);
    }
View Full Code Here

     * Helper method which creates a <code>MutableBooleanType</code> which can be used for
     * testing.
     * @return a mutable number type.
     */
    private MutableFieldDefinition createFieldDefinitionForTestingEquals() {
        MutableFieldDefinition fieldDefinition = new MutableFieldDefinitionImpl("tom");
        MutableBooleanType booleanType = new MutableBooleanTypeImpl();
        MutableEnumeratedConstraint constraint = MetaDataFactory.getDefaultInstance().
                getTypeFactory().getConstraintFactory().createEnumeratedConstraint();
        booleanType.setEnumeratedConstraint(constraint);
        fieldDefinition.setType(booleanType);
        return fieldDefinition;
    }
View Full Code Here

            Map.Entry field = (Map.Entry) i.next();
            String fieldName = (String) field.getKey();
            InternalPolicyType fieldType
                    = (InternalPolicyType) field.getValue();

            MutableFieldDefinition fieldDefinition =
                    TYPE_FACTORY.createFieldDefinition(fieldName);
            fieldDefinition.setType(fieldType.createMetaDataType());
            fields.add(fieldDefinition);
        }

        return (ImmutableMetaDataType) structureType.createImmutable();
    }
View Full Code Here

TOP

Related Classes of com.volantis.shared.metadata.type.mutable.MutableFieldDefinition

Copyright © 2018 www.massapicom. 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.