using System; using System.Collections.Generic; using HeuristicLab.Persistence.Core; namespace HeuristicLab.Persistence.Interfaces { public interface ICompositeSerializer { /// /// Defines the Priorty of this composite serializer. Higher number means /// higher prioriy. Negative numbers are fallback serializers. /// All default generic composite serializers have priority 100. Specializations /// have priority 200 so they will be tried first. Priorities are /// only considered for default configurations. /// int Priority { get; } /// /// Determines for every type whether the composite serializer is applicable. /// bool CanSerialize(Type type); /// /// Generate MetaInfo necessary for instance creation. (i.e. /// array dimensions). /// IEnumerable CreateMetaInfo(object obj); /// /// Decompose an object into KeyValuePairs, the Key can be null, /// the order in which elements are generated is guaranteed to be /// the same as they will be supplied to the Populate method. /// IEnumerable Decompose(object obj); /// /// Create an instance of the object using the provided meta information. /// /// /// object CreateInstance(Type type, IEnumerable metaInfo); /// /// Compose an object from the KeyValuePairs previously generated /// in DeCompose. The order in which the values are supplied is /// the same as they where generated. Keys might be null. /// void Populate(object instance, IEnumerable tags, Type type); } }