This commit is contained in:
@@ -20,7 +20,7 @@ import org.redkale.util.*;
|
||||
import org.redkale.util.Creator.Creators;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @see http://www.redkale.org
|
||||
* @author zhangjx
|
||||
* @param <R>
|
||||
@@ -83,6 +83,8 @@ public abstract class Factory<R extends Reader, W extends Writer> {
|
||||
|
||||
this.register(Number.class, NumberSimpledCoder.instance);
|
||||
this.register(String.class, StringSimpledCoder.instance);
|
||||
this.register(CharSequence.class, CharSequenceSimpledCoder.instance);
|
||||
this.register(StringBuilder.class, CharSequenceSimpledCoder.instance);
|
||||
this.register(java.util.Date.class, DateSimpledCoder.instance);
|
||||
this.register(BigInteger.class, BigIntegerSimpledCoder.instance);
|
||||
this.register(InetAddress.class, InetAddressSimpledCoder.instance);
|
||||
|
||||
@@ -8,7 +8,6 @@ package org.redkale.convert;
|
||||
import org.redkale.util.Attribute;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
import org.redkale.util.Attribute.Attributes;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -132,7 +131,7 @@ public final class ObjectEncoder<W extends Writer, T> implements Encodeable<W, T
|
||||
}
|
||||
fieldalias = ref == null || ref.name().isEmpty() ? mfieldname : ref.name();
|
||||
}
|
||||
return Attributes.create(clazz, fieldalias, field, getter, setter);
|
||||
return Attribute.create(clazz, fieldalias, field, getter, setter);
|
||||
}
|
||||
|
||||
public void init(final Factory factory) {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.redkale.convert.ext;
|
||||
|
||||
import org.redkale.convert.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zhangjx
|
||||
* @param <R>
|
||||
* @param <W>
|
||||
*/
|
||||
public class CharSequenceSimpledCoder<R extends Reader, W extends Writer> extends SimpledCoder<R, W, CharSequence> {
|
||||
|
||||
public static final CharSequenceSimpledCoder instance = new CharSequenceSimpledCoder();
|
||||
|
||||
@Override
|
||||
public void convertTo(W out, CharSequence value) {
|
||||
out.writeString(value == null ? null : value.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence convertFrom(R in) {
|
||||
return in.readString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user