java.beans.PersistenceDelegate Java Examples

The following examples show how to use java.beans.PersistenceDelegate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Test4646747.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    XMLEncoder encoder = new XMLEncoder(System.out);
    encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate());
    // WARNING: This can eat up a lot of memory
    Object[] obs = new Object[10000];
    while (obs != null) {
        try {
            obs = new Object[obs.length + obs.length / 3];
        }
        catch (OutOfMemoryError error) {
            obs = null;
        }
    }
    PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class);
    if (!(pd instanceof MyPersistenceDelegate))
        throw new Error("persistence delegate has been lost");
}
 
Example #2
Source File: Test4646747.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    XMLEncoder encoder = new XMLEncoder(System.out);
    encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate());
    // WARNING: This can eat up a lot of memory
    Object[] obs = new Object[10000];
    while (obs != null) {
        try {
            obs = new Object[obs.length + obs.length / 3];
        }
        catch (OutOfMemoryError error) {
            obs = null;
        }
    }
    PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class);
    if (!(pd instanceof MyPersistenceDelegate))
        throw new Error("persistence delegate has been lost");
}
 
Example #3
Source File: Test4646747.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    XMLEncoder encoder = new XMLEncoder(System.out);
    encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate());
    // WARNING: This can eat up a lot of memory
    Object[] obs = new Object[10000];
    while (obs != null) {
        try {
            obs = new Object[obs.length + obs.length / 3];
        }
        catch (OutOfMemoryError error) {
            obs = null;
        }
    }
    PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class);
    if (!(pd instanceof MyPersistenceDelegate))
        throw new Error("persistence delegate has been lost");
}
 
Example #4
Source File: Test4646747.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    XMLEncoder encoder = new XMLEncoder(System.out);
    encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate());
    // WARNING: This can eat up a lot of memory
    Object[] obs = new Object[10000];
    while (obs != null) {
        try {
            obs = new Object[obs.length + obs.length / 3];
        }
        catch (OutOfMemoryError error) {
            obs = null;
        }
    }
    PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class);
    if (!(pd instanceof MyPersistenceDelegate))
        throw new Error("persistence delegate has been lost");
}
 
Example #5
Source File: Test4646747.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    XMLEncoder encoder = new XMLEncoder(System.out);
    encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate());
    // WARNING: This can eat up a lot of memory
    Object[] obs = new Object[10000];
    while (obs != null) {
        try {
            obs = new Object[obs.length + obs.length / 3];
        }
        catch (OutOfMemoryError error) {
            obs = null;
        }
    }
    PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class);
    if (!(pd instanceof MyPersistenceDelegate))
        throw new Error("persistence delegate has been lost");
}
 
Example #6
Source File: Test4646747.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    XMLEncoder encoder = new XMLEncoder(System.out);
    encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate());
    // WARNING: This can eat up a lot of memory
    Object[] obs = new Object[10000];
    while (obs != null) {
        try {
            obs = new Object[obs.length + obs.length / 3];
        }
        catch (OutOfMemoryError error) {
            obs = null;
        }
    }
    PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class);
    if (!(pd instanceof MyPersistenceDelegate))
        throw new Error("persistence delegate has been lost");
}
 
Example #7
Source File: Test4646747.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    XMLEncoder encoder = new XMLEncoder(System.out);
    encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate());
    // WARNING: This can eat up a lot of memory
    Object[] obs = new Object[10000];
    while (obs != null) {
        try {
            obs = new Object[obs.length + obs.length / 3];
        }
        catch (OutOfMemoryError error) {
            obs = null;
        }
    }
    PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class);
    if (!(pd instanceof MyPersistenceDelegate))
        throw new Error("persistence delegate has been lost");
}
 
Example #8
Source File: Test4646747.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    XMLEncoder encoder = new XMLEncoder(System.out);
    encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate());
    // WARNING: This can eat up a lot of memory
    Object[] obs = new Object[10000];
    while (obs != null) {
        try {
            obs = new Object[obs.length + obs.length / 3];
        }
        catch (OutOfMemoryError error) {
            obs = null;
        }
    }
    PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class);
    if (!(pd instanceof MyPersistenceDelegate))
        throw new Error("persistence delegate has been lost");
}
 
Example #9
Source File: Test4646747.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    XMLEncoder encoder = new XMLEncoder(System.out);
    encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate());
    // WARNING: This can eat up a lot of memory
    Object[] obs = new Object[10000];
    while (obs != null) {
        try {
            obs = new Object[obs.length + obs.length / 3];
        }
        catch (OutOfMemoryError error) {
            obs = null;
        }
    }
    PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class);
    if (!(pd instanceof MyPersistenceDelegate))
        throw new Error("persistence delegate has been lost");
}
 
Example #10
Source File: Test4646747.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    XMLEncoder encoder = new XMLEncoder(System.out);
    encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate());
    // WARNING: This can eat up a lot of memory
    Object[] obs = new Object[10000];
    while (obs != null) {
        try {
            obs = new Object[obs.length + obs.length / 3];
        }
        catch (OutOfMemoryError error) {
            obs = null;
        }
    }
    PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class);
    if (!(pd instanceof MyPersistenceDelegate))
        throw new Error("persistence delegate has been lost");
}
 
Example #11
Source File: Test4646747.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) {
    XMLEncoder encoder = new XMLEncoder(System.out);
    encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate());
    // WARNING: This can eat up a lot of memory
    Object[] obs = new Object[10000];
    while (obs != null) {
        try {
            obs = new Object[obs.length + obs.length / 3];
        }
        catch (OutOfMemoryError error) {
            obs = null;
        }
    }
    PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class);
    if (!(pd instanceof MyPersistenceDelegate))
        throw new Error("persistence delegate has been lost");
}
 
Example #12
Source File: Test5023552.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(Container.class, new PersistenceDelegate() {
        protected Expression instantiate(Object oldInstance, Encoder out) {
            Container container = (Container) oldInstance;
            Component component = container.getComponent();
            return new Expression(container, component, "create", new Object[] {component});
        }
    });
}
 
Example #13
Source File: Test4968523.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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");

    if (pd2 != encoder2.getPersistenceDelegate(type))
        throw new Error("second persistence delegate is changed");
}
 
Example #14
Source File: Test4968523.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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");

    if (pd2 != encoder2.getPersistenceDelegate(type))
        throw new Error("second persistence delegate is changed");
}
 
Example #15
Source File: TestPersistenceDelegate.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void test(Class<?> type, Class<? extends PersistenceDelegate> expected) {
    PersistenceDelegate actual = ENCODER.getPersistenceDelegate(type);
    if ((actual == null) && (expected != null)) {
        throw new Error("expected delegate is not found");
    }
    if ((actual != null) && !actual.getClass().equals(expected)) {
        throw new Error("found unexpected delegate");
    }
}
 
Example #16
Source File: PersistenceDelegateFinder.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void register(Class<?> type, PersistenceDelegate delegate) {
    synchronized (this.registry) {
        if (delegate != null) {
            this.registry.put(type, delegate);
        }
        else {
            this.registry.remove(type);
        }
    }
}
 
Example #17
Source File: PersistenceDelegateFinder.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public PersistenceDelegate find(Class<?> type) {
    PersistenceDelegate delegate;
    synchronized (this.registry) {
        delegate = this.registry.get(type);
    }
    return (delegate != null) ? delegate : super.find(type);
}
 
Example #18
Source File: Test5023552.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(Container.class, new PersistenceDelegate() {
        protected Expression instantiate(Object oldInstance, Encoder out) {
            Container container = (Container) oldInstance;
            Component component = container.getComponent();
            return new Expression(container, component, "create", new Object[] {component});
        }
    });
}
 
Example #19
Source File: TestPersistenceDelegate.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void test(Class<?> type, Class<? extends PersistenceDelegate> expected) {
    PersistenceDelegate actual = ENCODER.getPersistenceDelegate(type);
    if ((actual == null) && (expected != null)) {
        throw new Error("expected delegate is not found");
    }
    if ((actual != null) && !actual.getClass().equals(expected)) {
        throw new Error("found unexpected delegate");
    }
}
 
Example #20
Source File: PersistenceDelegateFinder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Override
public PersistenceDelegate find(Class<?> type) {
    PersistenceDelegate delegate;
    synchronized (this.registry) {
        delegate = this.registry.get(type);
    }
    return (delegate != null) ? delegate : super.find(type);
}
 
Example #21
Source File: PersistenceDelegateFinder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public PersistenceDelegate find(Class<?> type) {
    PersistenceDelegate delegate;
    synchronized (this.registry) {
        delegate = this.registry.get(type);
    }
    return (delegate != null) ? delegate : super.find(type);
}
 
Example #22
Source File: PersistenceDelegateFinder.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void register(Class<?> type, PersistenceDelegate delegate) {
    synchronized (this.registry) {
        if (delegate != null) {
            this.registry.put(type, delegate);
        }
        else {
            this.registry.remove(type);
        }
    }
}
 
Example #23
Source File: Test4968523.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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");

    if (pd2 != encoder2.getPersistenceDelegate(type))
        throw new Error("second persistence delegate is changed");
}
 
Example #24
Source File: Test5023552.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(Container.class, new PersistenceDelegate() {
        protected Expression instantiate(Object oldInstance, Encoder out) {
            Container container = (Container) oldInstance;
            Component component = container.getComponent();
            return new Expression(container, component, "create", new Object[] {component});
        }
    });
}
 
Example #25
Source File: TestPersistenceDelegate.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void test(Class<?> type, Class<? extends PersistenceDelegate> expected) {
    PersistenceDelegate actual = ENCODER.getPersistenceDelegate(type);
    if ((actual == null) && (expected != null)) {
        throw new Error("expected delegate is not found");
    }
    if ((actual != null) && !actual.getClass().equals(expected)) {
        throw new Error("found unexpected delegate");
    }
}
 
Example #26
Source File: PersistenceDelegateFinder.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public PersistenceDelegate find(Class<?> type) {
    PersistenceDelegate delegate;
    synchronized (this.registry) {
        delegate = this.registry.get(type);
    }
    return (delegate != null) ? delegate : super.find(type);
}
 
Example #27
Source File: PersistenceDelegateFinder.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void register(Class<?> type, PersistenceDelegate delegate) {
    synchronized (this.registry) {
        if (delegate != null) {
            this.registry.put(type, delegate);
        }
        else {
            this.registry.remove(type);
        }
    }
}
 
Example #28
Source File: Test4968523.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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");

    if (pd2 != encoder2.getPersistenceDelegate(type))
        throw new Error("second persistence delegate is changed");
}
 
Example #29
Source File: Test5023552.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected void initialize(XMLEncoder encoder) {
    encoder.setPersistenceDelegate(Container.class, new PersistenceDelegate() {
        protected Expression instantiate(Object oldInstance, Encoder out) {
            Container container = (Container) oldInstance;
            Component component = container.getComponent();
            return new Expression(container, component, "create", new Object[] {component});
        }
    });
}
 
Example #30
Source File: TestPersistenceDelegate.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void test(Class<?> type, Class<? extends PersistenceDelegate> expected) {
    PersistenceDelegate actual = ENCODER.getPersistenceDelegate(type);
    if ((actual == null) && (expected != null)) {
        throw new Error("expected delegate is not found");
    }
    if ((actual != null) && !actual.getClass().equals(expected)) {
        throw new Error("found unexpected delegate");
    }
}