Changeset 3577 for trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs
- Timestamp:
- 05/01/10 12:37:16 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs
r3553 r3577 39 39 /// </returns> 40 40 public bool CanSerialize(Type type) { 41 bool markedStorable = StorableReflection.HasStorableClassAttribute(type); 41 42 if (GetConstructor(type) == null) 42 return false; 43 return StorableReflection.IsEmptyOrStorableType(type, true); 43 if (markedStorable) 44 throw new Exception("[Storable] type has no default constructor and no [StorableConstructor]"); 45 else 46 return false; 47 if (!StorableReflection.IsEmptyOrStorableType(type, true)) 48 if (markedStorable) 49 throw new Exception("[Storable] type has non emtpy, non [Storable] base classes"); 50 else 51 return false; 52 return true; 44 53 } 45 54 … … 53 62 /// </returns> 54 63 public string JustifyRejection(Type type) { 64 StringBuilder sb = new StringBuilder(); 55 65 if (GetConstructor(type) == null) 56 return "no default constructor and no storable constructor";66 sb.Append("class has no default constructor and no [StorableConstructor]"); 57 67 if (!StorableReflection.IsEmptyOrStorableType(type, true)) 58 return "class is not marked with the storable class attribute";59 return "no reason";68 sb.Append("class (or one of its bases) is not empty and not marked [Storable]; "); 69 return sb.ToString(); 60 70 } 61 71 … … 154 164 155 165 private Dictionary<HookDesignator, List<StorableReflection.Hook>> hookCache = 156 new Dictionary<HookDesignator, List<StorableReflection.Hook>>(); 166 new Dictionary<HookDesignator, List<StorableReflection.Hook>>(); 157 167 158 168 #endregion
Note: See TracChangeset
for help on using the changeset viewer.