INT-41: Restore old woody interfaces (#26)

This commit is contained in:
Baikov Dmitrii 2022-01-19 00:38:26 -08:00 committed by GitHub
parent 378529478f
commit 6c2e819e79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 92 additions and 64 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>woody</artifactId> <artifactId>woody</artifactId>
<groupId>dev.vality.woody</groupId> <groupId>dev.vality.woody</groupId>
<version>1.0.2</version> <version>1.0.3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -22,10 +22,14 @@ package org.apache.thrift.meta_data;
import org.apache.thrift.TEnum; import org.apache.thrift.TEnum;
public class EnumMetaData extends FieldValueMetaData { public class EnumMetaData extends FieldValueMetaData {
public final Class<? extends TEnum> enumClass; public final Class<? extends TEnum> enumClass;
public EnumMetaData(byte type, Class<? extends TEnum> sClass){ public EnumMetaData(byte type, Class<? extends TEnum> sClass){
super(type); super(type);
this.enumClass = sClass; this.enumClass = sClass;
} }
public Class<? extends TEnum> getEnumClass() {
return enumClass;
}
} }

View File

@ -26,47 +26,51 @@ import org.apache.thrift.protocol.TType;
* the value(s) of a field * the value(s) of a field
*/ */
public class FieldValueMetaData implements java.io.Serializable { public class FieldValueMetaData implements java.io.Serializable {
public final byte type; public final byte type;
private final boolean isTypedefType; private final boolean isTypedefType;
private final String typedefName; private final String typedefName;
private final boolean isBinary; private final boolean isBinary;
public FieldValueMetaData(byte type, boolean binary) { public FieldValueMetaData(byte type, boolean binary) {
this.type = type; this.type = type;
this.isTypedefType = false; this.isTypedefType = false;
this.typedefName = null; this.typedefName = null;
this.isBinary = binary; this.isBinary = binary;
} }
public FieldValueMetaData(byte type) { public FieldValueMetaData(byte type) {
this(type, false); this(type, false);
} }
public FieldValueMetaData(byte type, String typedefName) { public FieldValueMetaData(byte type, String typedefName) {
this.type = type; this.type = type;
this.isTypedefType = true; this.isTypedefType = true;
this.typedefName = typedefName; this.typedefName = typedefName;
this.isBinary = false; this.isBinary = false;
} }
public boolean isTypedef() { public int getType() {
return isTypedefType; return type;
} }
public String getTypedefName() { public boolean isTypedef() {
return typedefName; return isTypedefType;
} }
public boolean isStruct() { public String getTypedefName() {
return type == TType.STRUCT; return typedefName;
} }
public boolean isContainer() { public boolean isStruct() {
return type == TType.LIST || type == TType.MAP || type == TType.SET; return type == TType.STRUCT;
} }
public boolean isBinary() { public boolean isContainer() {
return isBinary; return type == TType.LIST || type == TType.MAP || type == TType.SET;
} }
public boolean isBinary() {
return isBinary;
}
} }

View File

@ -20,10 +20,16 @@
package org.apache.thrift.meta_data; package org.apache.thrift.meta_data;
public class ListMetaData extends FieldValueMetaData { public class ListMetaData extends FieldValueMetaData {
public final FieldValueMetaData elemMetaData;
public final FieldValueMetaData elemMetaData;
public ListMetaData(byte type, FieldValueMetaData eMetaData){
super(type); public ListMetaData(byte type, FieldValueMetaData eMetaData) {
this.elemMetaData = eMetaData; super(type);
} this.elemMetaData = eMetaData;
}
public FieldValueMetaData getElementMetaData() {
return elemMetaData;
}
} }

View File

@ -20,12 +20,22 @@
package org.apache.thrift.meta_data; package org.apache.thrift.meta_data;
public class MapMetaData extends FieldValueMetaData { public class MapMetaData extends FieldValueMetaData {
public final FieldValueMetaData keyMetaData;
public final FieldValueMetaData valueMetaData; public final FieldValueMetaData keyMetaData;
public final FieldValueMetaData valueMetaData;
public MapMetaData(byte type, FieldValueMetaData kMetaData, FieldValueMetaData vMetaData){
super(type); public MapMetaData(byte type, FieldValueMetaData kMetaData, FieldValueMetaData vMetaData) {
this.keyMetaData = kMetaData; super(type);
this.valueMetaData = vMetaData; this.keyMetaData = kMetaData;
} this.valueMetaData = vMetaData;
}
public FieldValueMetaData getKeyMetaData() {
return keyMetaData;
}
public FieldValueMetaData getValueMetaData() {
return valueMetaData;
}
} }

View File

@ -22,10 +22,14 @@ package org.apache.thrift.meta_data;
import org.apache.thrift.TBase; import org.apache.thrift.TBase;
public class StructMetaData extends FieldValueMetaData { public class StructMetaData extends FieldValueMetaData {
public final Class<? extends TBase> structClass; public final Class<? extends TBase> structClass;
public StructMetaData(byte type, Class<? extends TBase> sClass){ public StructMetaData(byte type, Class<? extends TBase> sClass){
super(type); super(type);
this.structClass = sClass; this.structClass = sClass;
} }
public Class<? extends TBase> getStructClass() {
return structClass;
}
} }

View File

@ -12,7 +12,7 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<groupId>dev.vality.woody</groupId> <groupId>dev.vality.woody</groupId>
<artifactId>woody</artifactId> <artifactId>woody</artifactId>
<version>1.0.2</version> <version>1.0.3</version>
<name>Woody Java</name> <name>Woody Java</name>
<description>Java implementation for Woody spec</description> <description>Java implementation for Woody spec</description>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>woody</artifactId> <artifactId>woody</artifactId>
<groupId>dev.vality.woody</groupId> <groupId>dev.vality.woody</groupId>
<version>1.0.2</version> <version>1.0.3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>woody</artifactId> <artifactId>woody</artifactId>
<groupId>dev.vality.woody</groupId> <groupId>dev.vality.woody</groupId>
<version>1.0.2</version> <version>1.0.3</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>