abstractbasicconverter.java
来自「通过对bufflao改造」· Java 代码 · 共 28 行
JAVA
28 行
package net.buffalo.protocal.converters.basic;
import net.buffalo.protocal.converters.Converter;
import net.buffalo.protocal.io.MarshallingContext;
import net.buffalo.protocal.io.StreamReader;
import net.buffalo.protocal.io.StreamWriter;
import net.buffalo.protocal.io.UnmarshallingContext;
public abstract class AbstractBasicConverter implements Converter {
public void marshal(Object source, MarshallingContext context, StreamWriter streamWriter) {
streamWriter.startNode(getType());
streamWriter.setValue(source.toString());
streamWriter.endNode();
}
protected String getType() {
throw new UnsupportedOperationException();
}
public Object unmarshal(StreamReader reader, UnmarshallingContext unmarshallingContext) {
return fromString(reader.getValue());
}
public abstract Object fromString(String string);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?