mirror of
https://github.com/valitydev/geck.git
synced 2024-11-06 09:45:24 +00:00
BJ-76: Rename grammar to format
This commit is contained in:
parent
23e70868ec
commit
a8d3f6c2d9
@ -1,14 +1,11 @@
|
||||
package com.rbkmoney.kebab;
|
||||
|
||||
import com.rbkmoney.kebab.thrift.ThriftElement;
|
||||
import org.apache.thrift.TBase;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by tolkonepiu on 24/01/2017.
|
||||
*/
|
||||
public class Kebab <T extends TBase> {
|
||||
public class Kebab<T extends TBase> {
|
||||
|
||||
public String toJson(T src) {
|
||||
throw new UnsupportedOperationException("under contruction");
|
||||
|
@ -12,11 +12,11 @@ public interface StructWriter extends Closeable {
|
||||
|
||||
StructWriter endStruct() throws IOException;
|
||||
|
||||
StructWriter beginList() throws IOException;
|
||||
StructWriter beginList(int size) throws IOException;
|
||||
|
||||
StructWriter endList() throws IOException;
|
||||
|
||||
StructWriter beginMap() throws IOException;
|
||||
StructWriter beginMap(int size) throws IOException;
|
||||
|
||||
StructWriter endMap() throws IOException;
|
||||
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.rbkmoney.kebab.exception;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by tolkonepiu on 31/01/2017.
|
||||
*/
|
||||
public class BadFormatException extends IOException {
|
||||
|
||||
public BadFormatException() {
|
||||
}
|
||||
|
||||
public BadFormatException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public BadFormatException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public BadFormatException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package com.rbkmoney.kebab.exception;
|
||||
|
||||
/**
|
||||
* Created by tolkonepiu on 31/01/2017.
|
||||
*/
|
||||
public class BadGrammarException {
|
||||
}
|
@ -43,7 +43,7 @@ public class TBaseSerializer implements Serializer<TBase> {
|
||||
boolean isBinary = fieldValueMetaData.isBinary();
|
||||
|
||||
if (isBinary) {
|
||||
out.binaryValue((byte[]) object);
|
||||
out.value((byte[]) object);
|
||||
} else {
|
||||
switch (type) {
|
||||
case BOOLEAN:
|
||||
@ -83,7 +83,7 @@ public class TBaseSerializer implements Serializer<TBase> {
|
||||
}
|
||||
|
||||
private void write(StructWriter out, Set objectSet, SetMetaData metaData) throws IOException {
|
||||
out.beginList();
|
||||
out.beginList(objectSet.size());
|
||||
for (Object object : objectSet) {
|
||||
write(out, object, metaData.getElementMetaData());
|
||||
}
|
||||
@ -91,7 +91,7 @@ public class TBaseSerializer implements Serializer<TBase> {
|
||||
}
|
||||
|
||||
private void write(StructWriter out, List objectList, ListMetaData metaData) throws IOException {
|
||||
out.beginList();
|
||||
out.beginList(objectList.size());
|
||||
for (Object object : objectList) {
|
||||
write(out, object, metaData.getElementMetaData());
|
||||
}
|
||||
@ -100,7 +100,7 @@ public class TBaseSerializer implements Serializer<TBase> {
|
||||
|
||||
|
||||
private void write(StructWriter out, Map objectMap, MapMetaData metaData) throws IOException {
|
||||
out.beginMap();
|
||||
out.beginMap(objectMap.size());
|
||||
for (Map.Entry entry : (Set<Map.Entry>) objectMap.entrySet()) {
|
||||
out.beginKey();
|
||||
write(out, entry.getKey(), metaData.getKeyMetaData());
|
||||
|
@ -19,7 +19,7 @@ public class JsonStructWriter implements StructWriter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructWriter beginList() throws IOException {
|
||||
public StructWriter beginList(int size) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ public class JsonStructWriter implements StructWriter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public StructWriter beginMap() throws IOException {
|
||||
public StructWriter beginMap(int size) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user