Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ObjectMetadata.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 namespace SiliconStudio.BuildEngine
4 {
5  /// <summary>
6  /// Object metadata created by user in order to inject them in the database
7  /// </summary>
9  {
10  /// <inheritdoc/>
11  public string ObjectUrl { get; private set; }
12 
13  /// <inheritdoc/>
14  public MetadataKey Key { get; private set; }
15 
16  /// <inheritdoc/>
17  public object Value { get; set; }
18 
19  public ObjectMetadata(string owner, MetadataKey key)
20  {
21  ObjectUrl = owner;
22  Key = key;
23  Value = key.GetDefaultValue();
24  }
25 
26  public ObjectMetadata(string owner, MetadataKey key, object value)
27  {
28  ObjectUrl = owner;
29  Key = key;
30  Value = value;
31  }
32  }
33 
34  /// <summary>
35  /// A generic object metadata created by user in order to inject them in the database. It provides a <see cref="GetValue"/> method which return the value casted to the generic type for convenience.
36  /// </summary>
37  public class ObjectMetadata<T> : ObjectMetadata
38  {
39  /// <inheritdoc/>
40  public ObjectMetadata(string owner, MetadataKey key) : base(owner, key) { }
41 
42  /// <inheritdoc/>
43  public ObjectMetadata(string owner, MetadataKey key, T value) : base(owner, key, value) { }
44 
45  /// <summary>
46  /// Return the value of the metadata casted to the generic type
47  /// </summary>
48  public T GetValue()
49  {
50  return (T)Value;
51  }
52  }
53 }
Represent a metadata key. This object is immutable.
Definition: MetadataKey.cs:11
ObjectMetadata(string owner, MetadataKey key)
T GetValue()
Return the value of the metadata casted to the generic type
ObjectMetadata(string owner, MetadataKey key, T value)
ObjectMetadata(string owner, MetadataKey key)
ObjectMetadata(string owner, MetadataKey key, object value)
Interface for object metadata
Object metadata created by user in order to inject them in the database