overide InstantiatingComponentAdapter 's newInstance
328145
protected Object newInstance(Constructor constructor, Object[] parameters) throws InstantiationException, IllegalAccessException,
			InvocationTargetException {
		if (allowNonPublicClasses) {
			constructor.setAccessible(true);
		}

		Object o = constructor.newInstance(parameters);
		ComponentAdvsior componentAdvsior = (ComponentAdvsior) configInfo.getContainerWrapper().lookup(ComponentAdvsior.NAME);
		Object proxy = null;
		if (componentAdvsior != null)
			proxy = componentAdvsior.createProxy(o);

		if (!proxy.getClass().isInstance(o)) {
			Map orignals = getContainerOrignals(configInfo.getContainerWrapper());
			orignals.put((String) this.getComponentKey(), o);
		}

		return proxy;
	}
303478
private void initComponents()//GEN-BEGIN:initComponents
    {
        java.awt.GridBagConstraints gridBagConstraints;

        jPanel1 = new javax.swing.JPanel();
        lblEnabled = new javax.swing.JLabel();
        cbEnabled = new javax.swing.JCheckBox();
        lblDisabledByParent = new javax.swing.JLabel();
        cbDisabledByParent = new javax.swing.JCheckBox();
        jLabel4 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        lblColumnName = new javax.swing.JLabel();
        tfColumnName = new javax.swing.JTextField();
        lblJavaFieldName = new javax.swing.JLabel();
        tfJavaFieldName = new javax.swing.JTextField();
        lblSQLTypeName = new javax.swing.JLabel();
        tfSQLTypeName = new javax.swing.JTextField();
        lblSQLType = new javax.swing.JLabel();
        cmbSQLType = new javax.swing.JComboBox();
        lblJavaType = new javax.swing.JLabel();
        cmbJavaType = new javax.swing.JComboBox();

        setLayout(new java.awt.GridBagLayout());

        addComponentListener(new java.awt.event.ComponentAdapter()
        {
            public void componentShown(java.awt.event.ComponentEvent evt)
            {
                formComponentShown(evt);
            }
            public void componentHidden(java.awt.event.ComponentEvent evt)
            {
                formComponentHidden(evt);
            }
        });

        addHierarchyListener(new java.awt.event.HierarchyListener()
        {
            public void hierarchyChanged(java.awt.event.HierarchyEvent evt)
            {
                formHierarchyChanged(evt);
            }
        });

        jPanel1.setLayout(new java.awt.GridLayout(8, 2));

        lblEnabled.setDisplayedMnemonic('e');
        lblEnabled.setText("enabled:");
        jPanel1.add(lblEnabled);

        cbEnabled.setMnemonic('e');
        cbEnabled.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                cbEnabledActionPerformed(evt);
            }
        });

        jPanel1.add(cbEnabled);

        lblDisabledByParent.setText("disabled by Parent:");
        jPanel1.add(lblDisabledByParent);

        cbDisabledByParent.setMnemonic('d');
        cbDisabledByParent.setEnabled(false);
        jPanel1.add(cbDisabledByParent);

        jPanel1.add(jLabel4);

        jPanel1.add(jLabel3);

        lblColumnName.setLabelFor(tfColumnName);
        lblColumnName.setText("Column Name:");
        jPanel1.add(lblColumnName);

        tfColumnName.setEditable(false);
        tfColumnName.setText("jTextField1");
        tfColumnName.setBorder(null);
        tfColumnName.setDisabledTextColor((java.awt.Color) javax.swing.UIManager.getDefaults().get("windowText"));
        tfColumnName.setEnabled(false);
        jPanel1.add(tfColumnName);

        lblJavaFieldName.setLabelFor(tfColumnName);
        lblJavaFieldName.setText("Java Field Name:");
        jPanel1.add(lblJavaFieldName);

        tfJavaFieldName.setText("jTextField1");
        tfJavaFieldName.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                tfJavaFieldNameActionPerformed(evt);
            }
        });

        tfJavaFieldName.addFocusListener(new java.awt.event.FocusAdapter()
        {
            public void focusLost(java.awt.event.FocusEvent evt)
            {
                tfJavaFieldNameFocusLost(evt);
            }
        });

        tfJavaFieldName.addKeyListener(new java.awt.event.KeyAdapter()
        {
            public void keyTyped(java.awt.event.KeyEvent evt)
            {
                tfJavaFieldNameKeyTyped(evt);
            }
        });

        jPanel1.add(tfJavaFieldName);

        lblSQLTypeName.setLabelFor(tfColumnName);
        lblSQLTypeName.setText("SQL Type Name:");
        jPanel1.add(lblSQLTypeName);

        tfSQLTypeName.setEditable(false);
        tfSQLTypeName.setText("jTextField1");
        tfSQLTypeName.setBorder(null);
        tfSQLTypeName.setDisabledTextColor((java.awt.Color) javax.swing.UIManager.getDefaults().get("windowText"));
        tfSQLTypeName.setEnabled(false);
        jPanel1.add(tfSQLTypeName);

        lblSQLType.setText("Java SQL Type:");
        jPanel1.add(lblSQLType);

        cmbSQLType.setModel(new javax.swing.DefaultComboBoxModel(Utilities.vJDBCTypeNames));
        cmbSQLType.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                cmbSQLTypeActionPerformed(evt);
            }
        });

        jPanel1.add(cmbSQLType);

        lblJavaType.setText("Java Type:");
        jPanel1.add(lblJavaType);

        cmbJavaType.setEditable(true);
        cmbJavaType.setModel( new org.apache.ojb.tools.swing.SortingComboBoxModel(Utilities.vJavaTypes)
            /*new javax.swing.DefaultComboBoxModel(at.citec.ojb.schemegenerator.Utilities.vJavaTypes)*/);
        cmbJavaType.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                cmbJavaTypeActionPerformed(evt);
            }
        });

        jPanel1.add(cmbJavaType);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        add(jPanel1, gridBagConstraints);

    }
49593
public void initializeReferenceData() {
        if (_referenceDataActivationManager == null) {
            return;
        }
        final Collection<Object> referenceDataCollection = _referenceDataActivationManager.getAllReferenceData();
        for (Object referenceData : referenceDataCollection) {
            ComponentDescriptor<? extends Object> descriptor = Descriptors.ofComponent(referenceData.getClass());

            assignProvidedProperties(descriptor, referenceData);
            initialize(descriptor, referenceData);
        }
    }
226629
private void initComponents()//GEN-BEGIN:initComponents
    {
        java.awt.GridBagConstraints gridBagConstraints;

        jPanel1 = new javax.swing.JPanel();
        lblEnabled = new javax.swing.JLabel();
        cbEnabled = new javax.swing.JCheckBox();
        lblDisabledByParent = new javax.swing.JLabel();
        cbDisabledByParent = new javax.swing.JCheckBox();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        lblTableName = new javax.swing.JLabel();
        tfTableName = new javax.swing.JTextField();
        lblClassName = new javax.swing.JLabel();
        tfClassName = new javax.swing.JTextField();
        lblPackageName = new javax.swing.JLabel();
        tfPackageName = new javax.swing.JTextField();
        lblDynamicProxy = new javax.swing.JLabel();
        cbDynamicProxy = new javax.swing.JCheckBox();
        lblConversionStrategyClass = new javax.swing.JLabel();
        tfConversionStrategyClass = new javax.swing.JTextField();

        setLayout(new java.awt.GridBagLayout());

        addComponentListener(new java.awt.event.ComponentAdapter()
        {
            public void componentShown(java.awt.event.ComponentEvent evt)
            {
                formComponentShown(evt);
            }
            public void componentHidden(java.awt.event.ComponentEvent evt)
            {
                formComponentHidden(evt);
            }
        });

        addHierarchyListener(new java.awt.event.HierarchyListener()
        {
            public void hierarchyChanged(java.awt.event.HierarchyEvent evt)
            {
                formHierarchyChanged(evt);
            }
        });

        jPanel1.setLayout(new java.awt.GridLayout(8, 2));

        lblEnabled.setDisplayedMnemonic('e');
        lblEnabled.setText("enabled");
        jPanel1.add(lblEnabled);

        cbEnabled.setMnemonic('e');
        cbEnabled.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                cbEnabledActionPerformed(evt);
            }
        });

        jPanel1.add(cbEnabled);

        lblDisabledByParent.setText("disabled by Parent:");
        jPanel1.add(lblDisabledByParent);

        cbDisabledByParent.setEnabled(false);
        jPanel1.add(cbDisabledByParent);

        jPanel1.add(jLabel3);

        jPanel1.add(jLabel4);

        lblTableName.setLabelFor(tfTableName);
        lblTableName.setText("Table Name:");
        jPanel1.add(lblTableName);

        tfTableName.setEditable(false);
        tfTableName.setText("jTextField1");
        tfTableName.setBorder(null);
        tfTableName.setDisabledTextColor(new java.awt.Color(0, 51, 51));
        tfTableName.setEnabled(false);
        jPanel1.add(tfTableName);

        lblClassName.setDisplayedMnemonic('c');
        lblClassName.setLabelFor(tfClassName);
        lblClassName.setText("Class Name:");
        jPanel1.add(lblClassName);

        tfClassName.setText("jTextField1");
        tfClassName.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                tfClassNameActionPerformed(evt);
            }
        });

        tfClassName.addFocusListener(new java.awt.event.FocusAdapter()
        {
            public void focusLost(java.awt.event.FocusEvent evt)
            {
                tfClassNameFocusLost(evt);
            }
        });

        tfClassName.addKeyListener(new java.awt.event.KeyAdapter()
        {
            public void keyTyped(java.awt.event.KeyEvent evt)
            {
                tfClassNameKeyTyped(evt);
            }
        });

        jPanel1.add(tfClassName);

        lblPackageName.setDisplayedMnemonic('p');
        lblPackageName.setLabelFor(tfPackageName);
        lblPackageName.setText("Package:");
        jPanel1.add(lblPackageName);

        tfPackageName.setText("jTextField2");
        tfPackageName.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                tfPackageNameActionPerformed(evt);
            }
        });

        tfPackageName.addFocusListener(new java.awt.event.FocusAdapter()
        {
            public void focusLost(java.awt.event.FocusEvent evt)
            {
                tfPackageNameFocusLost(evt);
            }
        });

        tfPackageName.addKeyListener(new java.awt.event.KeyAdapter()
        {
            public void keyTyped(java.awt.event.KeyEvent evt)
            {
                tfPackageNameKeyTyped(evt);
            }
        });

        jPanel1.add(tfPackageName);

        lblDynamicProxy.setDisplayedMnemonic('u');
        lblDynamicProxy.setText("Use Dynamic Proxy:");
        jPanel1.add(lblDynamicProxy);

        cbDynamicProxy.setMnemonic('u');
        cbDynamicProxy.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                cbDynamicProxyActionPerformed(evt);
            }
        });

        jPanel1.add(cbDynamicProxy);

        lblConversionStrategyClass.setDisplayedMnemonic('s');
        lblConversionStrategyClass.setLabelFor(tfConversionStrategyClass);
        lblConversionStrategyClass.setText("Conversion Strategy Class:");
        jPanel1.add(lblConversionStrategyClass);

        tfConversionStrategyClass.setText("jTextField1");
        tfConversionStrategyClass.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                tfConversionStrategyClassActionPerformed(evt);
            }
        });

        tfConversionStrategyClass.addFocusListener(new java.awt.event.FocusAdapter()
        {
            public void focusLost(java.awt.event.FocusEvent evt)
            {
                tfConversionStrategyClassFocusLost(evt);
            }
        });

        tfConversionStrategyClass.addKeyListener(new java.awt.event.KeyAdapter()
        {
            public void keyTyped(java.awt.event.KeyEvent evt)
            {
                tfConversionStrategyClassKeyTyped(evt);
            }
        });

        jPanel1.add(tfConversionStrategyClass);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        add(jPanel1, gridBagConstraints);

    }
108248
<E extends BaseClient> Observable<E> initialise(@NonNull final Application application, @NonNull final E instance, @NonNull final CallbackAdapter adapter) {

        if (state.compareAndSet(GlobalState.NOT_INITIALISED, GlobalState.INITIALISING)) {

            return init(application, adapter)
                    .concatMap(new Func1<Boolean, Observable<SessionData>>() {
                        @Override
                        public Observable<SessionData> call(Boolean state) {
                            return loadSession(state);
                        }
                    })
                    .doOnNext(session -> log.d(session != null ? "Comapi initialised with session profile id : " + session.getProfileId() : "Comapi initialisation with no session."))
                    .doOnError(e -> {
                        if (log != null) {
                            log.f("Error initialising ComapiImpl SDK. " + e.getMessage(), new ComapiException("Error initialising ComapiImpl SDK.", e));
                        }
                    })
                    .flatMap(session -> {
                        if (state.get() == GlobalState.SESSION_ACTIVE && config.isFcmEnabled()) {
                            return instance.service.updatePushToken()
                                    .doOnNext(sessionComapiResultPair -> log.d("Push token updated"))
                                    .doOnError(throwable -> log.f("Error updating push token", throwable))
                                    .map((Func1<Pair<SessionData, ComapiResult<Void>>, Object>) resultPair -> resultPair.first)
                                    .onErrorReturn(new Func1<Throwable, SessionData>() {
                                        @Override
                                        public SessionData call(Throwable throwable) {
                                            return session;
                                        }
                                    });
                        }
                        return Observable.fromCallable(() -> session);
                    })
                    .map(result -> instance);

        } else if (state.get() >= GlobalState.INITIALISED) {
            return Observable.fromCallable(() -> instance);
        } else {
            return Observable.error(new ComapiException("Initialise in progress. Shouldn't be called twice. Ignoring."));
        }
    }
939144
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        final InfiniteViewPager viewPager = (InfiniteViewPager) findViewById(R.id.infinite_viewpager);
        viewPager.setAdapter(new MyInfinitePagerAdapter(0));
        viewPager.setPageMargin(20);
        viewPager.setOnInfinitePageChangeListener(new InfiniteViewPager.OnInfinitePageChangeListener() {
            @Override
            public void onPageScrolled(final Object indicator, final float positionOffset,
                                       final int positionOffsetPixels) {
                Log.d("InfiniteViewPager", "onPageScrolled ".concat(String.valueOf(indicator)));
            }

            @Override
            public void onPageSelected(final Object indicator) {
                Log.d("InfiniteViewPager", "onPageSelected " + indicator.toString());
            }

            @Override
            public void onPageScrollStateChanged(final int state) {
                Log.d("InfiniteViewPager", "state " + String.valueOf(state));
            }
        });

        final Button btn = (Button) findViewById(R.id.current_item_btn);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(final View v) {
                viewPager.setCurrentIndicator(6);
            }
        });
    }
1187292
@Override
    public Dsp newProcessor() throws InstantiationException, ClassNotFoundException, IllegalAccessException {
        int numClasses = this.classes.size();
    	Codec[] codecs = new Codec[numClasses];
        
        for(int i = 0; i < numClasses; i++) {
        	String fqn = this.classes.get(i);
        	Class<?> codecClass = DspFactoryImpl.class.getClassLoader().loadClass(fqn);
        	codecs[i] = (Codec) codecClass.newInstance();
        }
        return new Dsp(codecs);
    }
9997
@Override
    public final Object instantiateItem(final ViewGroup container, final int position) {
        if (Constants.DEBUG) {
            Log.i("InfiniteViewPager", String.format("instantiating position %s", position));
        }
        final PageModel<T> model = createPageModel(position);
        mPageModels[position] = model;
        container.addView(model.getParentView());
        return model;
    }
1238316
protected UIComponent createComponent(FacesContext context, String newId) {
        UIComponent component;
        Application application = context.getApplication();
        if (binding != null) {
            ValueBinding vb = application.createValueBinding(binding);
            component = application.createComponent(vb, context,
                                                    getComponentType());
	    component.setValueBinding("binding", vb);
        } else {
            component = application.createComponent(getComponentType());
        }

        component.setId(newId);
        setProperties(component);

        return component;
    }
486901
private void createInstance() throws InvocationTargetException {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "createInstance");

        ManagedObjectFactory<?> ejbManagedObjectFactory = home.beanMetaData.ivEnterpriseBeanFactory;
        if (ejbManagedObjectFactory != null) {
            createInstanceUsingMOF(ejbManagedObjectFactory);
        } else {
            createInstanceUsingConstructor();
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "createInstance");
    }
113200
@Override
    protected void onCreate(Bundle savedInstanceState) {
        final RoboInjector injector = RoboGuice.getInjector(this);
        eventManager = injector.getInstance(EventManager.class);
        preferenceListener = injector.getInstance(PreferenceListener.class);
        injector.injectMembersWithoutViews(this);
        super.onCreate(savedInstanceState);
        eventManager.fire(new OnCreateEvent(savedInstanceState));
    }
36820
private void initAdapter() {
    RandomVideoCollectionGenerator randomVideoCollectionGenerator =
        new RandomVideoCollectionGenerator();
    final AdapteeCollection<Video> videoCollection =
        randomVideoCollectionGenerator.generateListAdapteeVideoCollection(VIDEO_COUNT);
    RendererBuilder<Video> rendererBuilder = new RendererBuilder<Video>().withPrototype(
        new RemovableVideoRenderer(new RemovableVideoRenderer.Listener() {
          @Override public void onRemoveButtonTapped(Video video) {
            ArrayList<Video> clonedList =
                new ArrayList<>((Collection<? extends Video>) videoCollection);
            clonedList.remove(video);
            adapter.diffUpdate(clonedList);
          }
        })).bind(Video.class, RemovableVideoRenderer.class);

    adapter = new RVRendererAdapter<>(rendererBuilder, videoCollection);
  }
773614
public static void initialize(SingletonProvider instance) {
        synchronized (SingletonProvider.class) {
            if (INSTANCE == null) {
                INSTANCE = instance;
            } else {
                throw new RuntimeException("SingletonProvider is already initialized with " + INSTANCE);
            }
        }
    }
301392
@Override
    public void createControlAdapter()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "createControlAdapter");
        controlAdapter = new LocalQueuePoint(destinationHandler.getMessageProcessor(), this);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "createControlAdapter");
    }
208359
@Override
    public Object newInstance(Object[] args) throws BeanConstructorNotFoundException {
        Constructor<?> constructor = getSuitableConstructor(args);
        return LdiConstructorUtil.newInstance(constructor, args);
    }
612
protected void initialize(Class<?> type, Object oldInstance, Object newInstance, Encoder out)
    {
        //
        // Get the bean and associated beanInfo for the source instance
        //
        ControlBean control = (ControlBean)oldInstance;
        BeanInfo beanInfo;
        try
        {
            beanInfo = Introspector.getBeanInfo(control.getClass());
        }
        catch (IntrospectionException ie)
        {
            throw new ControlException("Unable to locate BeanInfo", ie);
        }

        //
        // Cast the encoding stream to an XMLEncoder (only encoding supported) and then set
        // the stream owner to the bean being persisted
        //
        XMLEncoder xmlOut = (XMLEncoder)out;
        Object owner = xmlOut.getOwner();
        xmlOut.setOwner(control);
        try
        {

            //
            // The default implementation of property persistence will use BeanInfo to 
            // incrementally compare oldInstance property values to newInstance property values.   
            // Because the bean instance PropertyMap holds only the values that have been 
            // modified, this process can be optimized by directly writing out only the properties 
            // found in the map.
            //
            BeanPropertyMap beanMap = control.getPropertyMap();
            PropertyDescriptor [] propDescriptors = beanInfo.getPropertyDescriptors();
            for (PropertyKey pk : beanMap.getPropertyKeys())
            {
                //
                // Locate the PropertyDescriptor for the modified property, and use it to write
                // the property value to the encoder stream
                //
                String propName = pk.getPropertyName();
                boolean found = false;
                for (int i = 0; i < propDescriptors.length; i++)
                {
                    if (propName.equals(propDescriptors[i].getName()))
                    {
                        found = true;

                        // Only write the property if it is not flagged as transient
                        Object transientVal = propDescriptors[i].getValue("transient");
                        if (transientVal == null || transientVal.equals(Boolean.FALSE))
                        {
                            xmlOut.writeStatement(
                                new Statement(oldInstance, 
                                      propDescriptors[i].getWriteMethod().getName(),
                                      new Object [] {beanMap.getProperty(pk)}));
                        }
                    }
                }
                if (found == false)
                {
                    throw new ControlException("Unknown property in bean PropertyMap: " + pk);
                }
            }

            //
            // Get the bean context associated with the bean, and persist any nested controls
            //
            ControlBeanContext cbc = control.getControlBeanContext();
            if (cbc.size() != 0)
            {
                xmlOut.setPersistenceDelegate(ControlBeanContext.class, 
                                              new ContextPersistenceDelegate());

                Iterator nestedIter = cbc.iterator();
                while (nestedIter.hasNext())
                {
                    Object bean = nestedIter.next();
                    if (bean instanceof ControlBean)
                    {
                        xmlOut.writeStatement(
                            new Statement(cbc, "add", new Object [] { bean } ));
                    }
                }
            }

            //
            // Restore any listeners associated with the control
            //
            EventSetDescriptor [] eventSetDescriptors = beanInfo.getEventSetDescriptors();
            for (int i = 0; i < eventSetDescriptors.length; i++)
            {
                EventSetDescriptor esd = eventSetDescriptors[i];
                Method listenersMethod = esd.getGetListenerMethod();
                String addListenerName = esd.getAddListenerMethod().getName();
                if (listenersMethod != null)
                {
                    //
                    // Get the list of listeners, and then add statements to incrementally
                    // add them in the same order
                    //
                    try
                    {
                        Object [] lstnrs = (Object [])listenersMethod.invoke(control, 
                                                                             new Object []{});
                        for (int j = 0; j < lstnrs.length; j++)
                        {
                            //
                            // If this is a generated EventAdaptor class, then set the delegate
                            // explicitly
                            //
                            if (lstnrs[j] instanceof EventAdaptor)
                                xmlOut.setPersistenceDelegate(lstnrs[j].getClass(), 
                                                              new AdaptorPersistenceDelegate());
                            xmlOut.writeStatement(
                                new Statement(control, addListenerName, new Object [] {lstnrs[j]}));
                        }
                    }
                    catch (Exception iae)
                    {
                        throw new ControlException("Unable to initialize listeners", iae);
                    } 
                }
            }

            //
            // See if the control holds an implementation instance, if so, we need to include
            // it (and any nested controls or state) in the encoding stream
            //
            Object impl = control.getImplementation();
            if (impl != null)
            {

                //
                // Set the persistence delegate for the impl class to the Impl delegate,
                // set the current stream owner to the bean, and then write the implementation
                //
                Class implClass = impl.getClass(); 
                if (xmlOut.getPersistenceDelegate(implClass) instanceof DefaultPersistenceDelegate) 
                    xmlOut.setPersistenceDelegate(implClass, new ImplPersistenceDelegate());

                //
                // HACK: This bit of hackery pushes the impl into the persistence stream
                // w/out actually requiring it be used as an argument elsewhere, since there
                // is no public API on the bean that takes an impl instance as an argument.
                //
                xmlOut.writeStatement(
                    new Statement(impl, "toString", null));
            }
        }
        finally
        {
            // Restore the previous encoding stream owner
            xmlOut.setOwner(owner);
        }
    }
738255
@Override
    public <T> T createSpyComponent(final T instance) {
        checkArgument(instance != null, "instance must not be null!");
        if (isFinalOrPrimitive(instance.getClass())) {
            LOG.warn("Skipping creation of a spy : {} as it is final or primitive type.", instance.getClass()
                    .getSimpleName());
            return null;
        }
        return Mockito.spy(instance);
    }