/**
* Sets all fields of the given Object to the values stored in this Fields object.
*
* @param o The object whose fields should be set
* @throws StreamCorruptedException
* @throws NotSerializableException
* @throws YggdrasilException If this was called on a Fields object not created by Yggdrasil itself
*/
public void setFields(final Object o) throws StreamCorruptedException, NotSerializableException {
final Yggdrasil y = yggdrasil;
if (y == null)
throw new YggdrasilException("");
final Set<FieldContext> excessive = new HashSet<FieldContext>(fields.values());
final Class<?> oc = o.getClass();
assert oc != null;
for (final Field f : getFields(oc)) {
assert f != null;
final String id = Yggdrasil.getID(f);
final FieldContext c = fields.get(id);
if (c == null) {
if (!(o instanceof YggdrasilRobustSerializable) || !((YggdrasilRobustSerializable) o).missingField(f))
y.missingField(o, f);
} else {
c.setField(o, f, y);
}
excessive.remove(c);
}
for (final FieldContext f : excessive) {
assert f != null;
if (!(o instanceof YggdrasilRobustSerializable) || !((YggdrasilRobustSerializable) o).excessiveField(f))
y.excessiveField(o, f);
}
}
Fields.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:Skript
作者:
评论列表
文章目录