BJ-76: Rename grammar to format

This commit is contained in:
Pavel Popov 2017-01-31 17:39:35 +03:00
parent 23e70868ec
commit a8d3f6c2d9
6 changed files with 33 additions and 19 deletions

View File

@ -1,10 +1,7 @@
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.
*/

View File

@ -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;

View File

@ -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);
}
}

View File

@ -1,7 +0,0 @@
package com.rbkmoney.kebab.exception;
/**
* Created by tolkonepiu on 31/01/2017.
*/
public class BadGrammarException {
}

View File

@ -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());

View File

@ -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;
}