Java 8 DefaultPersistenceDelegate - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DefaultPersistenceDelegate class.

This code example shows how to use the following methods:instantiate
        public TestDPD() { 
            super(new String[] {"boolean", "integer"});
        } 
 
        public Expression instantiate(Object oldInstance, Encoder out) {
            return super.instantiate(oldInstance, out);
        } 
    } 
 
    public static class TestBean implements ExceptionListener {
        private boolean b;
        private int i;
 
        public TestBean(boolean b, int i) {
            this.b = b;
            this.i = i;
        } 
 
        public boolean isBoolean() { 
            return this.b;
4
CodeRank
This code example shows how to use the following methods:instantiate
        public TestDPD() { 
            super(new String[] {"boolean", "integer"});
        } 
 
        public Expression instantiate(Object oldInstance, Encoder out) {
            return super.instantiate(oldInstance, out);
        } 
    } 
 
    public static class TestBean implements ExceptionListener {
        private boolean b;
        private int i;
 
        public TestBean(boolean b, int i) {
            this.b = b;
            this.i = i;
        } 
 
        public boolean isBoolean() { 
            return this.b;
4
CodeRank
This code example shows how to use the following methods:
import java.util.Date;
 
public class Test4968523 { 
    public static void main(String[] args) {
        String[] names = {"time"};
        test(Date.class, new DefaultPersistenceDelegate(names));
        test(null, new DefaultPersistenceDelegate());
    } 
 
    private static void test(Class<?> type, PersistenceDelegate pd) {
        Encoder encoder1 = new Encoder();
        Encoder encoder2 = new XMLEncoder(System.out);
 
        PersistenceDelegate pd1 = encoder1.getPersistenceDelegate(type);
        PersistenceDelegate pd2 = encoder2.getPersistenceDelegate(type);
 
        encoder1.setPersistenceDelegate(type, pd);
 
        if (pd1 == encoder1.getPersistenceDelegate(type))
            throw new Error("first persistence delegate is not changed");
4
CodeRank
This code example shows how to use the following methods:
 
		XMLEncoder enc;
 
		try { 
			enc = new XMLEncoder(new BufferedOutputStream(new FileOutputStream(new File(prefsFile))));
			enc.setPersistenceDelegate(FileObject.class, new DefaultPersistenceDelegate(new String[] { "absolutePath" }));
			enc.writeObject(values);
			enc.close();
 
		} 
		catch (FileNotFoundException e) {
			log.error("could not persist preferences.");
		} 
	} 
} 
3
CodeRank
See Code Examples for Java 8 DefaultPersistenceDelegate Methods: