private static void setPersistenceDelegates(XMLEncoder encoder,
Class<?>[] types) {
if (types != null && types.length > 0) {
PersistenceDelegate persistenceDelegate = new EnumPersistenceDelegate();
for (int i = 0; i < types.length; i++) {
encoder.setPersistenceDelegate(types[i], persistenceDelegate);
}
}
// Handle "BiGDecimal" manually (has no default constructor)
encoder.setPersistenceDelegate(BigDecimal.class,
new BigDecimalPersistenceDelegate());
encoder.setPersistenceDelegate(byte[].class,
new ByteArrayPersistenceDelegate());
encoder.setPersistenceDelegate(UUID.class, new UUIDDelegate());
}
java类java.beans.PersistenceDelegate的实例源码
XMLSerializer.java 文件源码
项目:oscm
阅读 24
收藏 0
点赞 0
评论 0
Test4646747.java 文件源码
项目:jdk8u-jdk
阅读 19
收藏 0
点赞 0
评论 0
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");
}
Test4646747.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
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");
}
Test4646747.java 文件源码
项目:openjdk9
阅读 27
收藏 0
点赞 0
评论 0
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");
}
Test4646747.java 文件源码
项目:jdk8u_jdk
阅读 27
收藏 0
点赞 0
评论 0
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");
}
Test4646747.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 23
收藏 0
点赞 0
评论 0
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");
}
XMLSerializer.java 文件源码
项目:development
阅读 22
收藏 0
点赞 0
评论 0
private static void setPersistenceDelegates(XMLEncoder encoder,
Class<?>[] types) {
if (types != null && types.length > 0) {
PersistenceDelegate persistenceDelegate = new EnumPersistenceDelegate();
for (int i = 0; i < types.length; i++) {
encoder.setPersistenceDelegate(types[i], persistenceDelegate);
}
}
// Handle "BiGDecimal" manually (has no default constructor)
encoder.setPersistenceDelegate(BigDecimal.class,
new BigDecimalPersistenceDelegate());
encoder.setPersistenceDelegate(byte[].class,
new ByteArrayPersistenceDelegate());
encoder.setPersistenceDelegate(UUID.class, new UUIDDelegate());
}
Test4646747.java 文件源码
项目:infobip-open-jdk-8
阅读 27
收藏 0
点赞 0
评论 0
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");
}
Test4646747.java 文件源码
项目:jdk8u-dev-jdk
阅读 24
收藏 0
点赞 0
评论 0
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");
}
Test4646747.java 文件源码
项目:jdk7-jdk
阅读 28
收藏 0
点赞 0
评论 0
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");
}
Test4646747.java 文件源码
项目:openjdk-source-code-learn
阅读 20
收藏 0
点赞 0
评论 0
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");
}
Test4646747.java 文件源码
项目:OLD-OpenJDK8
阅读 21
收藏 0
点赞 0
评论 0
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");
}
DefaultPersistenceDelegateTest.java 文件源码
项目:cn1
阅读 20
收藏 0
点赞 0
评论 0
private void recordCall(Object param) {
StackTraceElement[] eles = (new Throwable()).getStackTrace();
int i = 0;
// skip Throwable.init()
while (eles[i].getClassName().equals("java.lang.Throwable")) {
i++;
}
// skip calls from MockEncoder
while (eles[i].getClassName().equals(MockEncoder.class.getName())) {
i++;
}
// skip calls from DefaultPersistenceDelegate & PersistenceDelegate
while (eles[i].getClassName().equals(
DefaultPersistenceDelegate.class.getName())
|| eles[i].getClassName().equals(
PersistenceDelegate.class.getName())) {
i++;
}
if (i > 2
&& eles[++i].getClassName().equals(
DefaultPersistenceDelegateTest.class.getName())) {
CallVerificationStack.getInstance().push(param);
}
}
EncoderTest.java 文件源码
项目:cn1
阅读 21
收藏 0
点赞 0
评论 0
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);
}
Test4646747.java 文件源码
项目:JAVA_UNIT
阅读 33
收藏 0
点赞 0
评论 0
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");
}
Test4646747.java 文件源码
项目:openjdk-jdk7u-jdk
阅读 24
收藏 0
点赞 0
评论 0
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");
}
DefaultPersistenceDelegateTest.java 文件源码
项目:freeVM
阅读 19
收藏 0
点赞 0
评论 0
private void recordCall(Object param) {
StackTraceElement[] eles = (new Throwable()).getStackTrace();
int i = 0;
// skip Throwable.init()
while (eles[i].getClassName().equals("java.lang.Throwable")) {
i++;
}
// skip calls from MockEncoder
while (eles[i].getClassName().equals(MockEncoder.class.getName())) {
i++;
}
// skip calls from DefaultPersistenceDelegate & PersistenceDelegate
while (eles[i].getClassName().equals(
DefaultPersistenceDelegate.class.getName())
|| eles[i].getClassName().equals(
PersistenceDelegate.class.getName())) {
i++;
}
if (i > 2
&& eles[++i].getClassName().equals(
DefaultPersistenceDelegateTest.class.getName())) {
CallVerificationStack.getInstance().push(param);
}
}
EncoderTest.java 文件源码
项目:freeVM
阅读 24
收藏 0
点赞 0
评论 0
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);
}
DefaultPersistenceDelegateTest.java 文件源码
项目:freeVM
阅读 23
收藏 0
点赞 0
评论 0
private void recordCall(Object param) {
StackTraceElement[] eles = (new Throwable()).getStackTrace();
int i = 0;
// skip Throwable.init()
while (eles[i].getClassName().equals("java.lang.Throwable")) {
i++;
}
// skip calls from MockEncoder
while (eles[i].getClassName().equals(MockEncoder.class.getName())) {
i++;
}
// skip calls from DefaultPersistenceDelegate & PersistenceDelegate
while (eles[i].getClassName().equals(
DefaultPersistenceDelegate.class.getName())
|| eles[i].getClassName().equals(
PersistenceDelegate.class.getName())) {
i++;
}
if (i > 2
&& eles[++i].getClassName().equals(
DefaultPersistenceDelegateTest.class.getName())) {
CallVerificationStack.getInstance().push(param);
}
}
EncoderTest.java 文件源码
项目:freeVM
阅读 23
收藏 0
点赞 0
评论 0
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);
}
Test4646747.java 文件源码
项目:openjdk-icedtea7
阅读 26
收藏 0
点赞 0
评论 0
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");
}
PersistenceDelegateFinder.java 文件源码
项目:OpenJSharp
阅读 21
收藏 0
点赞 0
评论 0
public void register(Class<?> type, PersistenceDelegate delegate) {
synchronized (this.registry) {
if (delegate != null) {
this.registry.put(type, delegate);
}
else {
this.registry.remove(type);
}
}
}
PersistenceDelegateFinder.java 文件源码
项目:OpenJSharp
阅读 22
收藏 0
点赞 0
评论 0
@Override
public PersistenceDelegate find(Class<?> type) {
PersistenceDelegate delegate;
synchronized (this.registry) {
delegate = this.registry.get(type);
}
return (delegate != null) ? delegate : super.find(type);
}
PersistenceDelegateFinder.java 文件源码
项目:jdk8u-jdk
阅读 25
收藏 0
点赞 0
评论 0
public void register(Class<?> type, PersistenceDelegate delegate) {
synchronized (this.registry) {
if (delegate != null) {
this.registry.put(type, delegate);
}
else {
this.registry.remove(type);
}
}
}
PersistenceDelegateFinder.java 文件源码
项目:jdk8u-jdk
阅读 20
收藏 0
点赞 0
评论 0
@Override
public PersistenceDelegate find(Class<?> type) {
PersistenceDelegate delegate;
synchronized (this.registry) {
delegate = this.registry.get(type);
}
return (delegate != null) ? delegate : super.find(type);
}
TestPersistenceDelegate.java 文件源码
项目:jdk8u-jdk
阅读 25
收藏 0
点赞 0
评论 0
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");
}
}
Test5023552.java 文件源码
项目:jdk8u-jdk
阅读 29
收藏 0
点赞 0
评论 0
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});
}
});
}
Test4968523.java 文件源码
项目:jdk8u-jdk
阅读 26
收藏 0
点赞 0
评论 0
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");
}
PersistenceDelegateFinder.java 文件源码
项目:openjdk-jdk10
阅读 20
收藏 0
点赞 0
评论 0
public void register(Class<?> type, PersistenceDelegate delegate) {
synchronized (this.registry) {
if (delegate != null) {
this.registry.put(type, delegate);
}
else {
this.registry.remove(type);
}
}
}
PersistenceDelegateFinder.java 文件源码
项目:openjdk-jdk10
阅读 22
收藏 0
点赞 0
评论 0
@Override
public PersistenceDelegate find(Class<?> type) {
PersistenceDelegate delegate;
synchronized (this.registry) {
delegate = this.registry.get(type);
}
return (delegate != null) ? delegate : super.find(type);
}