Package java.beans

Examples of java.beans.PersistenceDelegate


                .getSystemClassLoader(), new Class[] { List.class }));
    }

    public void testGetPersistenceDelegate_BeanInfo() {
        Encoder enc = new Encoder();
        PersistenceDelegate pd = enc
                .getPersistenceDelegate(MockFooLiYang.class);
        assertTrue(pd instanceof DefaultPersistenceDelegate);
    }
View Full Code Here


    public void testGetPersistenceDelegate_Default() {
        Encoder enc = new Encoder();
        Encoder enc2 = new Encoder();

        PersistenceDelegate pd1 = enc.getPersistenceDelegate(SampleBean.class);
        assertTrue(pd1 instanceof DefaultPersistenceDelegate);

        PersistenceDelegate pd2 = enc.getPersistenceDelegate(SampleBean.class);
        assertTrue(pd2 instanceof DefaultPersistenceDelegate);

        PersistenceDelegate pd3 = enc2
                .getPersistenceDelegate(MockBean4Codec.class);
        assertTrue(pd3 instanceof DefaultPersistenceDelegate);

        assertSame(pd1, pd2);
        assertSame(pd1, pd3);
View Full Code Here

    }

    public void testSetPersistenceDelegate_Null() {
        // Regression for HARMONY-1304
        Encoder enc = new Encoder();
        PersistenceDelegate pd = enc.getPersistenceDelegate(EncoderTest.class);

        try {
            enc.setPersistenceDelegate(null, pd);
            fail("NPE expected");
        } catch (NullPointerException e) {
View Full Code Here

        }
    }

    public void testSetPersistenceDelegate() {
        Encoder enc = new Encoder();
        PersistenceDelegate pd = enc.getPersistenceDelegate(EncoderTest.class);
        assertTrue(pd instanceof DefaultPersistenceDelegate);

        enc.setPersistenceDelegate(EncoderTest.class, new VerbosePD());
        assertTrue(enc.getPersistenceDelegate(EncoderTest.class) instanceof VerbosePD);
View Full Code Here

            return result;
        }

        @Override
        public PersistenceDelegate getPersistenceDelegate(Class type) {
            PersistenceDelegate result = super.getPersistenceDelegate(type);
            return result;
        }
View Full Code Here

    private static PersistenceDelegate createPersistenceDelegate(Class<?> type) {
        if (type == null) {
            return new NullPersistenceDelegate();
        }

        PersistenceDelegate pd = null;
        try {
            String className = createDefaultNameForPersistenceDelegateClass(type);

            pd = (PersistenceDelegate) Class.forName(className, true,
                    type.getClassLoader()).newInstance();
View Full Code Here

        return pd;
    }

    public static PersistenceDelegate getPersistenceDelegate(Class<?> type) {
        String className = (type == null) ? null : type.getName();
        PersistenceDelegate result = persistenceDelegates.get(className);

        if (result == null) {
            if (type != null && type.isArray()) {
                result = org.apache.harmony.beans.ArrayPersistenceDelegate
                        .getInstance();
View Full Code Here

        }

        @SuppressWarnings("unchecked")
        @Override
        public PersistenceDelegate getPersistenceDelegate(Class type) {
            PersistenceDelegate result = super.getPersistenceDelegate(type);
            return result;
        }
View Full Code Here

        }

        @SuppressWarnings("unchecked")
        @Override
        public PersistenceDelegate getPersistenceDelegate(Class type) {
            PersistenceDelegate result = super.getPersistenceDelegate(type);
            return result;
        }
View Full Code Here

            e.setExceptionListener(new ExceptionListener() {
                public void exceptionThrown(Exception e) {
                    throw new EmsException("Could not encode connection settings",e);
                }
            });
            e.setPersistenceDelegate(File.class,new PersistenceDelegate() {
                protected Expression instantiate(Object oldInstance, Encoder out) {
                    File f = (File) oldInstance;
                    return new Expression(oldInstance, oldInstance.getClass(),"new", new Object[]{ f.getAbsolutePath() });
                }
View Full Code Here

TOP

Related Classes of java.beans.PersistenceDelegate

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.