mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-02 18:17:09 +02:00
* adds includedatafields to serv3 * fixes some stuff and adds tests * checks for circular include * fix writing * this one should fix it frfrf * ok now this one is gonna be it i swear * we can save a few operations here * goofy string Co-authored-by: Paul <ritter.paul1@gmail.com>
51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using System;
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Robust.Shared.Serialization.Manager.Definition
|
|
{
|
|
internal sealed class FieldDefinition
|
|
{
|
|
public FieldDefinition(
|
|
DataFieldBaseAttribute attr,
|
|
object? defaultValue,
|
|
AbstractFieldInfo fieldInfo,
|
|
AbstractFieldInfo backingField,
|
|
InheritanceBehavior inheritanceBehavior)
|
|
{
|
|
BackingField = backingField;
|
|
Attribute = attr;
|
|
DefaultValue = defaultValue;
|
|
FieldInfo = fieldInfo;
|
|
InheritanceBehavior = inheritanceBehavior;
|
|
}
|
|
|
|
public DataFieldBaseAttribute Attribute { get; }
|
|
|
|
public object? DefaultValue { get; }
|
|
|
|
public InheritanceBehavior InheritanceBehavior { get; }
|
|
|
|
public AbstractFieldInfo BackingField { get; }
|
|
|
|
public AbstractFieldInfo FieldInfo { get; }
|
|
|
|
public Type FieldType => FieldInfo.FieldType;
|
|
|
|
public object? GetValue(object? obj)
|
|
{
|
|
return BackingField.GetValue(obj);
|
|
}
|
|
|
|
public void SetValue(object? obj, object? value)
|
|
{
|
|
BackingField.SetValue(obj, value);
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"{FieldInfo.Name}({Attribute})";
|
|
}
|
|
}
|
|
}
|