#region License Information
/* HeuristicLab
* Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System;
namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable {
///
/// Mark a class to be considered by the StorableSerializer.
///
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class StorableClassAttribute : Attribute {
///
/// Specify how members are selected for serialization.
///
public StorableClassType Type { get; private set; }
///
/// Mark a class to be serialize by the StorableSerizlier
///
/// The storable class type.
public StorableClassAttribute(StorableClassType type) {
Type = type;
}
///
/// Initializes a new instance of the class.
/// The default value for is
/// .
///
public StorableClassAttribute() { }
///
/// Checks if the is present on a type.
///
/// The type which should be checked for the
///
public static bool IsStorableClass(Type type) {
object[] attribs = type.GetCustomAttributes(typeof(StorableClassAttribute), false);
return attribs.Length > 0;
}
}
}