Changeset 1705 for trunk/sources/HeuristicLab.Persistence/3.3/Default
- Timestamp:
- 04/29/09 15:32:59 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Persistence/3.3/Default/Decomposers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/Decomposers/DictionaryDecomposer.cs
r1625 r1705 5 5 using System.Collections.Generic; 6 6 using HeuristicLab.Persistence.Default.Decomposers.Storable; 7 using HeuristicLab.Persistence.Auxiliary; 7 8 8 9 namespace HeuristicLab.Persistence.Default.Decomposers { … … 17 18 18 19 public bool CanDecompose(Type type) { 19 return type.GetInterface(typeof(IDictionary).FullName) != null; 20 return ReflectionTools.HasDefaultConstructor(type) && 21 type.GetInterface(typeof(IDictionary).FullName) != null; 20 22 } 21 23 … … 54 56 } catch (ArgumentException e) { 55 57 throw new PersistenceException("Duplicate dictionary key.", e); 56 } 58 } 57 59 } 58 60 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Decomposers/EnumerableDecomposer.cs
r1683 r1705 6 6 using System.Collections.Generic; 7 7 using HeuristicLab.Persistence.Default.Decomposers.Storable; 8 using HeuristicLab.Persistence.Auxiliary; 8 9 9 10 namespace HeuristicLab.Persistence.Default.Decomposers { … … 19 20 public bool CanDecompose(Type type) { 20 21 return 22 ReflectionTools.HasDefaultConstructor(type) && 21 23 type.GetInterface(typeof(IEnumerable).FullName) != null && 22 24 type.GetMethod("Add") != null && -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Decomposers/NumberEnumerable2StringDecomposer.cs
r1644 r1705 7 7 using System.Text; 8 8 using HeuristicLab.Persistence.Default.Decomposers.Storable; 9 using HeuristicLab.Persistence.Auxiliary; 9 10 10 11 namespace HeuristicLab.Persistence.Default.Decomposers { … … 54 55 public bool CanDecompose(Type type) { 55 56 return 57 ReflectionTools.HasDefaultConstructor(type) && 56 58 ImplementsGenericEnumerable(type) && 57 59 HasAddMethod(type); -
trunk/sources/HeuristicLab.Persistence/3.3/Default/Decomposers/Storable/StorableDecomposer.cs
r1679 r1705 4 4 using HeuristicLab.Persistence.Interfaces; 5 5 using HeuristicLab.Persistence.Core; 6 using System.Reflection; 7 using HeuristicLab.Persistence.Auxiliary; 6 8 7 9 namespace HeuristicLab.Persistence.Default.Decomposers.Storable { … … 15 17 16 18 public bool CanDecompose(Type type) { 17 return StorableAttribute.GetStorableMembers(type, false).Count() > 0 || 18 EmptyStorableClassAttribute.IsEmptyStorable(type); 19 return ReflectionTools.HasDefaultConstructor(type) && 20 (StorableAttribute.GetStorableMembers(type, false).Count() > 0 || 21 EmptyStorableClassAttribute.IsEmptyStorable(type)); 19 22 20 23 } … … 26 29 public IEnumerable<Tag> Decompose(object obj) { 27 30 foreach (var mapping in StorableAttribute.GetStorableAccessors(obj)) { 28 yield return new Tag(mapping.Value.Name ?? mapping.Key, mapping.Value.Get()); 31 yield return new Tag(mapping.Value.Name ?? mapping.Key, mapping.Value.Get()); 29 32 } 30 33 }
Note: See TracChangeset
for help on using the changeset viewer.