Package org.qi4j.api.composite

Examples of org.qi4j.api.composite.TransientDescriptor


    public final void testCompositeDescriptorWithComposite()
        throws Throwable
    {
        // Test with Standard composite
        AddressComposite address = module.newTransient( AddressComposite.class );
        TransientDescriptor addressDescriptor = spi.getTransientDescriptor( address );

        assertNotNull( addressDescriptor );
        assertEquals( AddressComposite.class, addressDescriptor.type() );
        assertTrue( TransientDescriptor.class.isAssignableFrom( addressDescriptor.getClass() ) );
    }
View Full Code Here


    @Test
    public final void testCompositeDescriptorWithMixin()
    {
        // Test with composite
        TransientDescriptor addressDesc = module.transientDescriptor( AddressComposite.class.getName() );
        assertNotNull( addressDesc );

        assertEquals( AddressComposite.class, addressDesc.type() );
    }
View Full Code Here

                        current.push( module );
                    }
                    else if( visited instanceof TransientDescriptor )
                    {
                        TransientDescriptor descriptor = (TransientDescriptor) visited;
                        Node node = document.createElement( "transient" );

                        addAttribute( "type", first(descriptor.types()).getName(), node );
                        addAttribute( "visibility", descriptor.visibility().name(), node );

                        current.push( node );
                    }
                    else if( visited instanceof MethodDescriptor )
                    {
                        MethodDescriptor descriptor = (MethodDescriptor) visited;
                        Node node = document.createElement( "method" );

                        addAttribute( "name", descriptor.method().getName(), node );

                        current.push( node );
                    }
                    else if( visited instanceof MixinDescriptor )
                    {
                        MixinDescriptor descriptor = (MixinDescriptor) visited;
                        Node node = document.createElement( "mixin" );

                        addAttribute( "class", descriptor.mixinClass().getName(), node );

                        current.push( node );
                    }
                    else if( visited instanceof DependencyDescriptor )
                    {
                        DependencyDescriptor descriptor = (DependencyDescriptor) visited;
                        Node node = document.createElement( "dependency" );

                        addAttribute( "annotation", descriptor.injectionAnnotation().toString(), node );
                        addAttribute( "injection", descriptor.injectionType().toString(), node );
                        addAttribute( "optional", Boolean.toString( descriptor.optional() ), node );

                        current.push( node );
                    }
                    else
                    {
                        Element element = document.createElement( visited.getClass().getSimpleName() );
                        current.push( element );
                    }

                    return true;
                }

                @Override
                public boolean visitLeave( Object visited )
                    throws DOMException
                {
                    Node node = current.pop();

                    if( node.getChildNodes().getLength() == 0 && node.getAttributes().getLength() == 0 )
                    {
                        return true;
                    }

                    current.peek().appendChild( node );
                    return true;
                }

                @Override
                public boolean visit( Object visited )
                    throws DOMException
                {
                    Element element;
                    if( visited instanceof DependencyDescriptor )
                    {
                        DependencyDescriptor descriptor = (DependencyDescriptor) visited;
                        element = document.createElement( "dependency" );

                        addAttribute( "annotation", descriptor.injectionAnnotation().toString(), element );
                        addAttribute( "injection", descriptor.injectionType().toString(), element );
                        addAttribute( "optional", Boolean.toString( descriptor.optional() ), element );
                    }
                    else
                    {
                        element = document.createElement( visited.getClass().getSimpleName() );
                    }
View Full Code Here

            context.addRelationship( layerUri, Qi4jRdf.RELATIONSHIP_MODULE, moduleUri );
        }

        if( visited instanceof TransientDescriptor )
        {
            TransientDescriptor transientDescriptor = (TransientDescriptor) visited;
            compositeUri = context.createCompositeUri( moduleUri, first( transientDescriptor.types() ) );
            context.addType( compositeUri, Qi4jRdf.TYPE_COMPOSITE );
            context.addRelationship( moduleUri, Qi4jRdf.RELATIONSHIP_COMPOSITE, compositeUri );
        }

        if( visited instanceof EntityDescriptor )
View Full Code Here

    public final void testCompositeDescriptorWithComposite()
        throws Throwable
    {
        // Test with Standard composite
        AddressComposite address = module.newTransient( AddressComposite.class );
        TransientDescriptor addressDescriptor = spi.transientDescriptorFor( address );

        assertNotNull( addressDescriptor );
        assertEquals( AddressComposite.class, first( addressDescriptor.types() ) );
        assertTrue( TransientDescriptor.class.isAssignableFrom( addressDescriptor.getClass() ) );
    }
View Full Code Here

    @Test
    public final void testCompositeDescriptorWithMixin()
    {
        // Test with composite
        TransientDescriptor addressDesc = module.transientDescriptor( AddressComposite.class.getName() );
        assertNotNull( addressDesc );

        assertEquals( AddressComposite.class, first( addressDesc.types() ) );
    }
View Full Code Here

TOP

Related Classes of org.qi4j.api.composite.TransientDescriptor

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.