本文整理汇总了Java中ch.njol.yggdrasil.Fields类的典型用法代码示例。如果您正苦于以下问题:Java Fields类的具体用法?Java Fields怎么用?Java Fields使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Fields类属于ch.njol.yggdrasil包,在下文中一共展示了Fields类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@Override
protected JavaType deserialize(Fields fields) throws StreamCorruptedException,
NotSerializableException {
try {
return new JavaType(LibraryLoader.getClassLoader().loadClass((String) fields.getObject("type")));
} catch (ClassNotFoundException e) {
throw new NotSerializableException();
}
}
示例2: deserialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@Override
public void deserialize(final Fields fields) throws StreamCorruptedException, NotSerializableException {
final String codeName = fields.getAndRemoveObject("info.codeName", String.class);
for (final SimpleEntityDataInfo i : types) {
if (i.codeName.equals(codeName)) {
info = i;
super.deserialize(fields);
return;
}
}
throw new StreamCorruptedException("Invalid SimpleEntityDataInfo code name " + codeName);
}
示例3: serialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@SuppressWarnings("null")
@Override
public Fields serialize() {
final Fields f = new Fields();
f.putPrimitive("id", claim.getID());
return f;
}
示例4: deserialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@Override
public void deserialize(final Fields fields) throws StreamCorruptedException {
final long id = fields.getPrimitive("id", long.class);
final Claim c = getClaim(id);
if (c == null)
throw new StreamCorruptedException("Invalid claim " + id);
claim = c;
}
示例5: deserialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@Override
public void deserialize(final Fields fields) throws StreamCorruptedException, NotSerializableException {
final String r = fields.getAndRemoveObject("region", String.class);
fields.setFields(this);
final ProtectedRegion region = plugin.getRegionManager(world).getRegion(r);
if (region == null)
throw new StreamCorruptedException("Invalid region " + r + " in world " + world);
this.region = region;
}
示例6: serialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@Override
public Fields serialize() throws NotSerializableException {
final Fields f = new Fields(this);
// both are serialisable with Yggdrasil
f.putObject("enchantments", enchantments);
f.putObject("meta", meta);
return f;
}
示例7: deserialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@Override
public void deserialize(final Fields fields) throws StreamCorruptedException, NotSerializableException {
enchantments = fields.getAndRemoveObject("enchantments", Map.class);
meta = fields.getAndRemoveObject("meta", Object.class);
if (meta != null && !(meta instanceof ItemMeta))
throw new StreamCorruptedException();
fields.setFields(this);
}
示例8: deserialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@Override
public void deserialize(final T o, final Fields f) throws StreamCorruptedException, NotSerializableException {
if (o instanceof YggdrasilExtendedSerializable)
((YggdrasilExtendedSerializable) o).deserialize(f);
else
f.setFields(o);
}
示例9: deserialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "null"})
@Override
public <E extends T> E deserialize(final Class<E> c, final Fields fields) throws StreamCorruptedException, NotSerializableException {
final ClassInfo<? extends T> info = this.info;
assert info != null;
assert info.getC().isAssignableFrom(c);
return (E) deserialize(fields);
}
示例10: deserialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@SuppressWarnings("null")
@Override
protected T deserialize(final Fields fields) throws StreamCorruptedException {
final String val = fields.getObject("value", String.class);
if (val == null)
throw new StreamCorruptedException();
final ClassInfo<? extends T> info = this.info;
assert info != null;
final T t = deserializeCS(val, info.getC());
if (t == null)
throw new StreamCorruptedException();
return t;
}
示例11: serialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@Override
public Fields serialize(JavaType cls) throws NotSerializableException {
Fields f = new Fields();
f.putObject("type", cls.getJavaClass().getName());
return f;
}
示例12: serialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@Override
public Fields serialize() throws NotSerializableException {
return new Fields(this);
}
示例13: deserialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@Override
public void deserialize(final Fields fields) throws StreamCorruptedException, NotSerializableException {
fields.setFields(this);
}
示例14: serialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@Override
public Fields serialize() throws NotSerializableException {
final Fields f = super.serialize();
f.putObject("info.codeName", info.codeName);
return f;
}
示例15: serialize
import ch.njol.yggdrasil.Fields; //导入依赖的package包/类
@Override
public Fields serialize() throws NotSerializableException {
final Fields f = new Fields(this);
f.putObject("region", region.getId());
return f;
}