Package org.qi4j.api.property

Examples of org.qi4j.api.property.PropertyDescriptor


            {
                return null;
            }
            else
            {
                PropertyDescriptor descriptor = entityDescriptor.state().findPropertyModelByQualifiedName( stateName );
                if( descriptor == null )
                {
                    return null;
                }
                return valueSerialization.deserialize( descriptor.valueType(), json.toString() );
            }
        }
        catch( ValueSerializationException | JSONException e )
        {
            throw new EntityStoreException( e );
View Full Code Here


                {
                    EntityComposite configuration = uow.get( EntityComposite.class, identity );
                    AssociationStateHolder state = spi.stateOf( (EntityComposite) configuration );
                    AccessibleObject accessor = propertyNames.get( attribute.getName() );
                    Property<Object> property = state.propertyFor( accessor );
                    PropertyDescriptor propertyDescriptor = spi.propertyDescriptorFor( property );
                    if( EnumType.isEnum( propertyDescriptor.type() ) )
                    {
                        property.set( Enum.valueOf( (Class<Enum>) propertyDescriptor.type(), attribute.getValue()
                            .toString() ) );
                    }
                    else
                    {
                        property.set( attribute.getValue() );
View Full Code Here

        while( that instanceof PropertyWrapper )
        {
            that = ( (PropertyWrapper) that ).next();
        }
        // Descriptor equality
        PropertyDescriptor thatDescriptor = (PropertyDescriptor) ( (PropertyInstance) that ).propertyInfo();
        if( !model.equals( thatDescriptor ) )
        {
            return false;
        }
        // State equality
View Full Code Here

    @Test
    public void givenValuesOfDifferentTypesWhenTestingPropertyDescriptorEqualityExpectNotEquals()
    {
        Some some = buildSomeValue( module );
        ValueDescriptor someDescriptor = qi4j.api().valueDescriptorFor( some );
        PropertyDescriptor someCharPropDesc = someDescriptor.state().findPropertyModelByName( "characterProperty" );

        Other other = buildOtherValue( module );
        ValueDescriptor otherDescriptor = qi4j.api().valueDescriptorFor( other );
        PropertyDescriptor otherCharPropDesc = otherDescriptor.state().findPropertyModelByName( "characterProperty" );

        assertThat( "PropertyDescriptors not equal",
                    someCharPropDesc,
                    not( equalTo( otherCharPropDesc ) ) );
        assertThat( "PropertyDescriptors hashcode not equal",
                    someCharPropDesc.hashCode(),
                    not( equalTo( otherCharPropDesc.hashCode() ) ) );
    }
View Full Code Here

        {
            MessageReader childReader = reader.getNextElementReader();
            QName childName = childReader.getName();
            QualifiedName childQualifiedName = QualifiedName.fromClass( (Class) typeClass,
                                                                        childName.getLocalPart() );
            PropertyDescriptor propertyDescriptor = stateDescriptor.findPropertyModelByQualifiedName(
                childQualifiedName );
            Type propertyType = propertyDescriptor.type();
            AegisType type = getTypeMapping().getType( propertyType );
            Object value = type.readObject( childReader, context );
            values.put( childQualifiedName, value );
        }
View Full Code Here

                    {
                        AssociationStateDescriptor entityState = entityDescriptor.state();
                        String propertyName = descriptor.qualifiedName().name();
                        try
                        {
                            PropertyDescriptor propertyDescriptor = entityState.findPropertyModelByName( propertyName );
                            return associationState.propertyFor( propertyDescriptor.accessor() ).get();
                        }
                        catch( IllegalArgumentException e )
                        {
                            if( descriptor.valueType().mainType().equals( String.class ) )
                            {
View Full Code Here

    @Test
    public void givenValuesOfTheSameTypeWhenTestingPropertyDescriptorEqualityExpectEquals()
    {
        Some some = buildSomeValue( module );
        ValueDescriptor someDescriptor = qi4j.api().valueDescriptorFor( some );
        PropertyDescriptor someCharPropDesc = someDescriptor.state().findPropertyModelByName( "characterProperty" );

        Some other = buildSomeValue( module );
        ValueDescriptor otherDescriptor = qi4j.api().valueDescriptorFor( other );
        PropertyDescriptor otherCharPropDesc = otherDescriptor.state().findPropertyModelByName( "characterProperty" );

        assertThat( "PropertyDescriptors equal",
                    someCharPropDesc,
                    equalTo( otherCharPropDesc ) );
        assertThat( "PropertyDescriptors hashcode equal",
                    someCharPropDesc.hashCode(),
                    equalTo( otherCharPropDesc.hashCode() ) );
    }
View Full Code Here

    @Test
    public void givenValuesOfCommonTypesWhenTestingPropertyDescriptorEqualityExpectEquals()
    {
        Some some = buildSomeValue( module );
        ValueDescriptor someDescriptor = qi4j.api().valueDescriptorFor( some );
        PropertyDescriptor someCharPropDesc = someDescriptor.state().findPropertyModelByName( "characterProperty" );

        PrimitivesValue primitive = buildPrimitivesValue( module );
        ValueDescriptor primitiveDescriptor = qi4j.api().valueDescriptorFor( primitive );
        PropertyDescriptor primitiveCharPropDesc = primitiveDescriptor.state().findPropertyModelByName( "characterProperty" );

        assertThat( "PropertyDescriptors equal",
                    someCharPropDesc,
                    equalTo( primitiveCharPropDesc ) );
        assertThat( "PropertyDescriptors hashcode equal",
                    someCharPropDesc.hashCode(),
                    equalTo( primitiveCharPropDesc.hashCode() ) );
    }
View Full Code Here

TOP

Related Classes of org.qi4j.api.property.PropertyDescriptor

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.