link start!
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.data;
|
||||
|
||||
import javax.baja.collection.BITable;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIDataTable
|
||||
extends BITable {
|
||||
public static final Type TYPE;
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$javax$baja$data$BIDataTable;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$javax$baja$data$BIDataTable = 1.class("[Ljavax.baja.data.BIDataTable;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.data;
|
||||
|
||||
import javax.baja.io.BIEncodable;
|
||||
import javax.baja.sys.Sys;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public interface BIDataValue
|
||||
extends BIEncodable {
|
||||
public static final Type TYPE;
|
||||
|
||||
static {
|
||||
Class clazz = 1.class$javax$baja$data$BIDataValue;
|
||||
if (clazz == null) {
|
||||
clazz = 1.class$javax$baja$data$BIDataValue = 1.class("[Ljavax.baja.data.BIDataValue;", false);
|
||||
}
|
||||
TYPE = Sys.loadType(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.data;
|
||||
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class DataTypeException
|
||||
extends BajaRuntimeException {
|
||||
private Type badType;
|
||||
|
||||
public Type getInvalidType() {
|
||||
return this.badType;
|
||||
}
|
||||
|
||||
public DataTypeException(Type type) {
|
||||
super(type.getTypeSpec().toString() + " is not a valid DataType.");
|
||||
this.badType = type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.data;
|
||||
|
||||
import javax.baja.sys.BAbsTime;
|
||||
import javax.baja.sys.BBoolean;
|
||||
import javax.baja.sys.BDouble;
|
||||
import javax.baja.sys.BDynamicEnum;
|
||||
import javax.baja.sys.BEnumRange;
|
||||
import javax.baja.sys.BFloat;
|
||||
import javax.baja.sys.BInteger;
|
||||
import javax.baja.sys.BLong;
|
||||
import javax.baja.sys.BRelTime;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.Type;
|
||||
import javax.baja.timezone.BTimeZone;
|
||||
import javax.baja.units.BUnit;
|
||||
|
||||
public class DataTypes {
|
||||
public static final Type BOOLEAN = BBoolean.TYPE;
|
||||
public static final Type INTEGER = BInteger.TYPE;
|
||||
public static final Type LONG = BLong.TYPE;
|
||||
public static final Type FLOAT = BFloat.TYPE;
|
||||
public static final Type DOUBLE = BDouble.TYPE;
|
||||
public static final Type STRING = BString.TYPE;
|
||||
public static final Type ENUM = BDynamicEnum.TYPE;
|
||||
public static final Type ENUM_RANGE = BEnumRange.TYPE;
|
||||
public static final Type ABS_TIME = BAbsTime.TYPE;
|
||||
public static final Type REL_TIME = BRelTime.TYPE;
|
||||
public static final Type UNIT = BUnit.TYPE;
|
||||
public static final Type TIME_ZONE = BTimeZone.TYPE;
|
||||
private static final Type[] TYPES = new Type[]{BOOLEAN, INTEGER, LONG, FLOAT, DOUBLE, STRING, ENUM, ENUM_RANGE, ABS_TIME, REL_TIME, UNIT, TIME_ZONE};
|
||||
private static final Type[] bySymbol = new Type[128];
|
||||
|
||||
public static Type[] getTypes() {
|
||||
return (Type[])TYPES.clone();
|
||||
}
|
||||
|
||||
public static Type getBySymbol(char c) {
|
||||
if (c < '\u0080') {
|
||||
return bySymbol[c];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static {
|
||||
int n = 0;
|
||||
while (n < TYPES.length) {
|
||||
Type type;
|
||||
DataTypes.bySymbol[type.getDataTypeSymbol()] = type = TYPES[n];
|
||||
++n;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.data;
|
||||
|
||||
import java.io.IOException;
|
||||
import javax.baja.data.DataTypes;
|
||||
import javax.baja.naming.SlotPath;
|
||||
import javax.baja.sys.BObject;
|
||||
import javax.baja.sys.BSimple;
|
||||
import javax.baja.sys.BString;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class DataUtil {
|
||||
public static String marshal(BObject bObject) throws IOException {
|
||||
if (bObject == null) {
|
||||
return "null";
|
||||
}
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append(bObject.getType().getDataTypeSymbol());
|
||||
stringBuffer.append(':');
|
||||
if (bObject instanceof BString) {
|
||||
stringBuffer.append(SlotPath.escape(bObject.toString()));
|
||||
} else {
|
||||
stringBuffer.append(((BSimple)bObject).encodeToString());
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
public static BObject unmarshal(String string) throws IOException {
|
||||
if (string.equals("null")) {
|
||||
return null;
|
||||
}
|
||||
char c = string.charAt(0);
|
||||
if (string.charAt(1) != ':') {
|
||||
throw new IOException("Expecting colon " + string);
|
||||
}
|
||||
String string2 = string.substring(2);
|
||||
Type type = DataTypes.getBySymbol(c);
|
||||
if (type == null) {
|
||||
throw new IOException("Unknown symbol " + c);
|
||||
}
|
||||
if (type == BString.TYPE) {
|
||||
return BString.make(SlotPath.unescape(string2));
|
||||
}
|
||||
BSimple bSimple = (BSimple)type.getInstance();
|
||||
return bSimple.decodeFromString(string2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package javax.baja.data;
|
||||
|
||||
import javax.baja.sys.BajaRuntimeException;
|
||||
import javax.baja.sys.Type;
|
||||
|
||||
public class TypeMismatchException
|
||||
extends BajaRuntimeException {
|
||||
private Type expected;
|
||||
private Type actual;
|
||||
|
||||
public Type getExpectedType() {
|
||||
return this.expected;
|
||||
}
|
||||
|
||||
public Type getActualType() {
|
||||
return this.actual;
|
||||
}
|
||||
|
||||
public TypeMismatchException(Type type, Type type2) {
|
||||
super("Expected " + type + " instead of " + type2 + '.');
|
||||
this.expected = type;
|
||||
this.actual = type2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user