Package org.qi4j.api.composite

Examples of org.qi4j.api.composite.AmbiguousTypeException


                }
                if( ambiguous != null )
                {
                    // Check if we had any ambiguities
                    ambiguous.add( current );
                    throw new AmbiguousTypeException( "More than one type matches " + type.getName() + ":" + ambiguous );
                }
                // Ambiguity check done, and no ambiguities found. Return results
                return results.iterator();
            }
View Full Code Here


                        clazz = first( iter.next().model().types() );

                        if( iter.hasNext() )
                        {
                            // Ambiguous exception
                            throw new ClassNotFoundException( name, new AmbiguousTypeException(
                                "More than one model matches the classname " + name + ":" + toList( moduleModels ) ) );
                        }
                    }
                }

                // Check layer
                if( clazz == null )
                {
                    Iterable<ModelModule<ModelDescriptor>> flatten = cast( flatten(
                        cast( moduleInstance.layerInstance().visibleObjects( Visibility.layer ) ),
                        cast( moduleInstance.layerInstance().visibleTransients( Visibility.layer ) ),
                        cast( moduleInstance.layerInstance().visibleEntities( Visibility.layer ) ),
                        cast( moduleInstance.layerInstance().visibleValues( Visibility.layer ) ),
                        cast( moduleInstance.layerInstance().visibleObjects( Visibility.application ) ),
                        cast( moduleInstance.layerInstance().visibleTransients( Visibility.application ) ),
                        cast( moduleInstance.layerInstance().visibleEntities( Visibility.application ) ),
                        cast( moduleInstance.layerInstance().visibleValues( Visibility.application ) ) ) );
                    Iterable<ModelModule<ModelDescriptor>> layerModels = filter( translate, flatten );
                    Iterator<ModelModule<ModelDescriptor>> iter = layerModels.iterator();
                    if( iter.hasNext() )
                    {
                        clazz = first( iter.next().model().types() );

                        if( iter.hasNext() )
                        {
                            // Ambiguous exception
                            throw new ClassNotFoundException( name, new AmbiguousTypeException(
                                "More than one model matches the classname " + name + ":" + toList( layerModels ) ) );
                        }
                    }
                }

                // Check used layers
                if( clazz == null )
                {
                    Iterable<ModelModule<ModelDescriptor>> flatten = cast( flatten(
                        cast( moduleInstance.layerInstance().usedLayersInstance().visibleObjects() ),
                        cast( moduleInstance.layerInstance().usedLayersInstance().visibleTransients() ),
                        cast( moduleInstance.layerInstance().usedLayersInstance().visibleEntities() ),
                        cast( moduleInstance.layerInstance().usedLayersInstance().visibleValues() ) ) );
                    Iterable<ModelModule<ModelDescriptor>> usedLayersModels = filter( translate, flatten );
                    Iterator<ModelModule<ModelDescriptor>> iter = usedLayersModels.iterator();
                    if( iter.hasNext() )
                    {
                        clazz = first( iter.next().model().types() );

                        if( iter.hasNext() )
                        {
                            // Ambiguous exception
                            throw new ClassNotFoundException( name, new AmbiguousTypeException(
                                "More than one model matches the classname " + name + ":" + toList( usedLayersModels ) ) );
                        }
                    }
                }
View Full Code Here

TOP

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

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.