Even More Modifiers  1.0.0.0
A mod for rolling various bonus stats on items
PropertyBuilder.cs
Go to the documentation of this file.
1 namespace Loot.Api.Builder
2 {
6  public abstract class PropertyBuilder<T> : IPropertyBuilder<T> where T : class, new()
7  {
8  protected T Property = new T();
9  protected abstract T DefaultProperty { set; }
10 
11  protected PropertyBuilder()
12  {
13  }
14 
15  protected PropertyBuilder(IPropertyBuilder<T> defaultPropertyBuilder)
16  {
17  WithDefault(defaultPropertyBuilder);
18  }
19 
20  protected PropertyBuilder(T defaultValue)
21  {
22  WithDefault(defaultValue);
23  }
24 
25  public void WithDefault(IPropertyBuilder<T> defaultPropertyBuilder)
26  {
27  DefaultProperty = defaultPropertyBuilder.Build();
28  }
29 
30  public void WithDefault(T defaultValue)
31  {
32  DefaultProperty = defaultValue;
33  }
34 
35  public virtual T Build()
36  {
37  return Property;
38  }
39  }
40 }
void WithDefault(IPropertyBuilder< T > defaultPropertyBuilder)
void WithDefault(T defaultValue)
PropertyBuilder(IPropertyBuilder< T > defaultPropertyBuilder)
Defines the interface for a PropertyBuilder of generic T
Defines an abstract implementation of IPropertyBuilder<T>