Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/23/15 18:47:21 (9 years ago)
Author:
swagner
Message:

#2520: Worked on persistence overhaul

Location:
branches/PersistenceOverhaul/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/PersistenceOverhaul/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableAttribute.cs

    r12012 r13347  
    2121
    2222using System;
     23using System.Reflection;
    2324using System.Text;
    2425
     
    3738    Inherited = false)]
    3839  public class StorableAttribute : Attribute {
     40    public static bool IsStorable(MemberInfo memberInfo) {
     41      return Attribute.IsDefined(memberInfo, typeof(StorableAttribute), false);
     42    }
     43    public static StorableAttribute GetStorableAttribute(MemberInfo memberInfo) {
     44      return (StorableAttribute)Attribute.GetCustomAttribute(memberInfo, typeof(StorableAttribute), false);
     45    }
    3946
    4047    /// <summary>
  • branches/PersistenceOverhaul/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassAttribute.cs

    r12012 r13347  
    3636    public StorableClassType Type { get; private set; }
    3737
     38    public Guid Guid { get; private set; }
     39    public bool Released { get; set; }
     40
    3841    /// <summary>
    3942    /// Mark a class to be serialize by the <c>StorableSerizlier</c>
    4043    /// </summary>
    4144    /// <param name="type">The storable class type.</param>
    42     public StorableClassAttribute(StorableClassType type) {
     45    public StorableClassAttribute(StorableClassType type, string guid) {
    4346      Type = type;
     47      Guid = new Guid(guid);
     48      Released = false;
    4449    }
    4550
     
    6166    }
    6267
     68    public static StorableClassAttribute GetStorableClassAttribute(Type type) {
     69      return (StorableClassAttribute)Attribute.GetCustomAttribute(type, typeof(StorableClassAttribute), false);
     70    }
     71
    6372  }
    6473}
  • branches/PersistenceOverhaul/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableConstructorAttribute.cs

    r12012 r13347  
    2121
    2222using System;
     23using System.Reflection;
    2324
    2425namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable {
     
    3435  /// </summary>
    3536  [AttributeUsage(AttributeTargets.Constructor, Inherited = false, AllowMultiple = false)]
    36   public sealed class StorableConstructorAttribute : Attribute { }
     37  public sealed class StorableConstructorAttribute : Attribute {
     38    public static bool IsStorableConstructor(ConstructorInfo constructorInfo) {
     39      return Attribute.IsDefined(constructorInfo, typeof(StorableConstructorAttribute));
     40    }
     41  }
    3742}
  • branches/PersistenceOverhaul/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableHookAttribute.cs

    r12012 r13347  
    2121
    2222using System;
     23using System.Linq;
     24using System.Reflection;
    2325
    2426namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable {
     
    5052  [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)]
    5153  public sealed class StorableHookAttribute : Attribute {
     54    public static bool IsStorableHook(MethodInfo methodInfo) {
     55      return Attribute.IsDefined(methodInfo, typeof(StorableHookAttribute), false);
     56    }
     57    public static StorableHookAttribute[] GetStorableHookAttributes(MethodInfo methodInfo) {
     58      return Attribute.GetCustomAttributes(methodInfo, false).OfType<StorableHookAttribute>().ToArray();
     59    }
    5260
    5361    private readonly HookType hookType;
Note: See TracChangeset for help on using the changeset viewer.