mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-16 07:12:27 +02:00
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
46 lines
1.2 KiB
C#
46 lines
1.2 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(
|
|
DataFieldAttribute attr,
|
|
object? defaultValue,
|
|
AbstractFieldInfo fieldInfo,
|
|
AbstractFieldInfo backingField,
|
|
InheritanceBehavior inheritanceBehavior)
|
|
{
|
|
BackingField = backingField;
|
|
Attribute = attr;
|
|
DefaultValue = defaultValue;
|
|
FieldInfo = fieldInfo;
|
|
InheritanceBehavior = inheritanceBehavior;
|
|
}
|
|
|
|
public DataFieldAttribute 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);
|
|
}
|
|
}
|
|
}
|