Package org.drools.base

Examples of org.drools.base.ShadowProxy


        private void setInstantiator() {
            this.instantiator = OBJENESIS.getInstantiatorOf( this.shadowClass );
        }

        public Object getShadow(final Object fact) throws RuntimeDroolsException {
            ShadowProxy proxy = null;
            if ( isShadowEnabled() ) {
                try {
                    if ( Collection.class.isAssignableFrom( this.shadowClass ) || Map.class.isAssignableFrom( this.shadowClass ) ) {
                        // if it is a collection, try to instantiate using constructor
                        try {
                            proxy = (ShadowProxy) this.shadowClass.getConstructor( new Class[]{cls} ).newInstance( new Object[]{fact} );
                        } catch ( Exception e ) {
                            // not possible to instantiate using constructor
                        }
                    }
                    if ( proxy == null ) {
                        if ( this.instantiator == null ) {
                            this.setInstantiator();
                        }
                        proxy = (ShadowProxy) this.instantiator.newInstance();
                    }
                    proxy.setShadowedObject( fact );
                } catch ( final Exception e ) {
                    throw new RuntimeDroolsException( "Error creating shadow fact for object: " + fact,
                                                      e );
                }
            }
View Full Code Here


        private void setInstantiator() {
            this.instantiator = ruleBase.getObjenesis().getInstantiatorOf( this.shadowClass );
        }

        public Object getShadow(final Object fact) throws RuntimeDroolsException {
            ShadowProxy proxy = null;
            if ( isShadowEnabled() ) {
                try {
                    if ( Collection.class.isAssignableFrom( this.shadowClass ) || Map.class.isAssignableFrom( this.shadowClass ) ) {
                        // if it is a collection, try to instantiate using constructor
                        try {
                            proxy = (ShadowProxy) this.shadowClass.getConstructor( new Class[]{cls} ).newInstance( new Object[]{fact} );
                        } catch ( Exception e ) {
                            // not possible to instantiate using constructor
                        }
                    }
                    if ( proxy == null ) {
                        if ( this.instantiator == null ) {
                            this.setInstantiator();
                        }
                        proxy = (ShadowProxy) this.instantiator.newInstance();
                    }
                    proxy.setShadowedObject( fact );
                } catch ( final Exception e ) {
                    throw new RuntimeDroolsException( "Error creating shadow fact for object: " + fact,
                                                      e );
                }
            }
View Full Code Here

        private void setInstantiator() {
            this.instantiator = ruleBase.getObjenesis().getInstantiatorOf(this.shadowClass);
        }

        public Object getShadow(final Object fact) throws RuntimeDroolsException {
            ShadowProxy proxy = null;
            if ( isShadowEnabled() ) {
                try {
                    if ( Collection.class.isAssignableFrom( this.shadowClass ) || Map.class.isAssignableFrom( this.shadowClass ) ) {
                        // if it is a collection, try to instantiate using constructor
                        try {
                            proxy = (ShadowProxy) this.shadowClass.getConstructor( new Class[]{cls} ).newInstance( new Object[]{fact} );
                        } catch ( Exception e ) {
                            // not possible to instantiate using constructor
                        }
                    }
                    if ( proxy == null ) {
                        if ( this.instantiator == null ) {
                            this.setInstantiator();
                        }
                        proxy = (ShadowProxy) this.instantiator.newInstance();
                    }
                    proxy.setShadowedObject( fact );
                } catch ( final Exception e ) {
                    throw new RuntimeDroolsException( "Error creating shadow fact for object: " + fact,
                                                      e );
                }
            }
View Full Code Here

        private void setInstantiator() {
            this.instantiator = OBJENESIS.getInstantiatorOf( this.shadowClass );
        }

        public Object getShadow(final Object fact) throws RuntimeDroolsException {
            ShadowProxy proxy = null;
            if ( isShadowEnabled() ) {
                try {
                    if ( Collection.class.isAssignableFrom( this.shadowClass ) || Map.class.isAssignableFrom( this.shadowClass ) ) {
                        // if it is a collection, try to instantiate using constructor
                        try {
                            proxy = (ShadowProxy) this.shadowClass.getConstructor( new Class[]{cls} ).newInstance( new Object[]{fact} );
                        } catch ( Exception e ) {
                            // not possible to instantiate using constructor
                        }
                    }
                    if ( proxy == null ) {
                        if ( this.instantiator == null ) {
                            this.setInstantiator();
                        }
                        proxy = (ShadowProxy) this.instantiator.newInstance();
                    }
                    proxy.setShadowedObject( fact );
                } catch ( final Exception e ) {
                    throw new RuntimeDroolsException( "Error creating shadow fact for object: " + fact,
                                                      e );
                }
            }
View Full Code Here

        private void setInstantiator() {
            this.instantiator = ruleBase.getObjenesis().getInstantiatorOf( this.shadowClass );
        }

        public Object getShadow(final Object fact) throws RuntimeDroolsException {
            ShadowProxy proxy = null;
            if ( isShadowEnabled() ) {
                try {
                    if ( Collection.class.isAssignableFrom( this.shadowClass ) || Map.class.isAssignableFrom( this.shadowClass ) ) {
                        // if it is a collection, try to instantiate using constructor
                        try {
                            proxy = (ShadowProxy) this.shadowClass.getConstructor( new Class[]{cls} ).newInstance( new Object[]{fact} );
                        } catch ( Exception e ) {
                            // not possible to instantiate using constructor
                        }
                    }
                    if ( proxy == null ) {
                        if ( this.instantiator == null ) {
                            this.setInstantiator();
                        }
                        proxy = (ShadowProxy) this.instantiator.newInstance();
                    }
                    proxy.setShadowedObject( fact );
                } catch ( final Exception e ) {
                    throw new RuntimeDroolsException( "Error creating shadow fact for object: " + fact,
                                                      e );
                }
            }
View Full Code Here

        private void setInstantiator() {
            this.instantiator = ruleBase.getObjenesis().getInstantiatorOf( this.shadowClass );
        }

        public Object getShadow(final Object fact) throws RuntimeDroolsException {
            ShadowProxy proxy = null;
            if ( isShadowEnabled() ) {
                try {
                    if ( Collection.class.isAssignableFrom( this.shadowClass ) || Map.class.isAssignableFrom( this.shadowClass ) ) {
                        // if it is a collection, try to instantiate using constructor
                        try {
                            proxy = (ShadowProxy) this.shadowClass.getConstructor( new Class[]{cls} ).newInstance( new Object[]{fact} );
                        } catch ( Exception e ) {
                            // not possible to instantiate using constructor
                        }
                    }
                    if ( proxy == null ) {
                        if ( this.instantiator == null ) {
                            this.setInstantiator();
                        }
                        proxy = (ShadowProxy) this.instantiator.newInstance();
                    }
                    proxy.setShadowedObject( fact );
                } catch ( final Exception e ) {
                    throw new RuntimeDroolsException( "Error creating shadow fact for object: " + fact,
                                                      e );
                }
            }
View Full Code Here

TOP

Related Classes of org.drools.base.ShadowProxy

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.