Changeset 14927 for branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers
- Timestamp:
- 05/04/17 17:19:35 (7 years ago)
- Location:
- branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/ArraySerializer.cs
r14185 r14927 23 23 using System.Collections.Generic; 24 24 using HeuristicLab.Persistence.Core; 25 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;25 using HeuristicLab.Persistence; 26 26 using HeuristicLab.Persistence.Interfaces; 27 27 28 28 namespace HeuristicLab.Persistence.Default.CompositeSerializers { 29 29 30 [Storable Class]30 [StorableType("17987df2-38f0-4158-b4c7-783ffa2737d1")] 31 31 internal sealed class ArraySerializer : ICompositeSerializer { 32 32 … … 99 99 } 100 100 return Array.CreateInstance(t.GetElementType(), lengths, lowerBounds); 101 } 102 catch (InvalidOperationException x) { 101 } catch (InvalidOperationException x) { 103 102 throw new PersistenceException("Insufficient meta information to construct array instance.", x); 104 } 105 catch (InvalidCastException x) { 103 } catch (InvalidCastException x) { 106 104 throw new PersistenceException("Invalid format of array metainfo.", x); 107 105 } … … 134 132 } 135 133 } 136 } 137 catch (InvalidOperationException x) { 134 } catch (InvalidOperationException x) { 138 135 throw new PersistenceException("Insufficient data to fill array instance", x); 139 } 140 catch (InvalidCastException x) { 136 } catch (InvalidCastException x) { 141 137 throw new PersistenceException("Invalid element data. Cannot fill array", x); 142 } 143 catch (IndexOutOfRangeException x) { 138 } catch (IndexOutOfRangeException x) { 144 139 throw new PersistenceException("Too many elements during array deserialization", x); 145 140 } -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/CompactNumberArray2StringSerializer.cs
r14185 r14927 26 26 using HeuristicLab.Persistence.Auxiliary; 27 27 using HeuristicLab.Persistence.Core; 28 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;28 using HeuristicLab.Persistence; 29 29 using HeuristicLab.Persistence.Interfaces; 30 30 31 31 namespace HeuristicLab.Persistence.Default.CompositeSerializers { 32 32 33 [Storable Class]33 [StorableType("a5c269da-4122-4ea0-9eb7-c3441be404b8")] 34 34 public sealed class CompactNumberArray2StringSerializer : ICompositeSerializer { 35 35 … … 187 187 } 188 188 return a; 189 } 190 catch (InvalidOperationException e) { 189 } catch (InvalidOperationException e) { 191 190 throw new PersistenceException("Insuffictient data to deserialize compact array", e); 192 } 193 catch (InvalidCastException e) { 191 } catch (InvalidCastException e) { 194 192 throw new PersistenceException("Invalid element data during compact array deserialization", e); 195 193 } -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/ConcreteDictionarySerializer.cs
r14185 r14927 25 25 using System.Linq; 26 26 using HeuristicLab.Persistence.Core; 27 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;27 using HeuristicLab.Persistence; 28 28 using HeuristicLab.Persistence.Interfaces; 29 29 30 30 namespace HeuristicLab.Persistence.Default.CompositeSerializers { 31 31 32 [Storable Class]32 [StorableType("0ce2011a-5666-40df-9874-f5eeccea5a72")] 33 33 internal sealed class ConcreteDictionarySerializer : ICompositeSerializer { 34 34 -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/DictionarySerializer.cs
r14185 r14927 25 25 using HeuristicLab.Persistence.Auxiliary; 26 26 using HeuristicLab.Persistence.Core; 27 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;27 using HeuristicLab.Persistence; 28 28 using HeuristicLab.Persistence.Interfaces; 29 29 30 30 namespace HeuristicLab.Persistence.Default.CompositeSerializers { 31 31 32 [Storable Class]32 [StorableType("813d9a0f-a611-478e-8149-e5d338c9a273")] 33 33 internal sealed class DictionarySerializer : ICompositeSerializer { 34 34 … … 79 79 dict.Add(key.Value, value.Value); 80 80 } 81 } 82 catch (InvalidOperationException e) { 81 } catch (InvalidOperationException e) { 83 82 throw new PersistenceException("Dictionaries must contain an even number of elements (key+value).", e); 84 } 85 catch (NotSupportedException e) { 83 } catch (NotSupportedException e) { 86 84 throw new PersistenceException("The serialized dictionary type was read-only or had a fixed size and cannot be deserialized.", e); 87 } 88 catch (ArgumentNullException e) { 85 } catch (ArgumentNullException e) { 89 86 throw new PersistenceException("Dictionary key was null.", e); 90 } 91 catch (ArgumentException e) { 87 } catch (ArgumentException e) { 92 88 throw new PersistenceException("Duplicate dictionary key.", e); 93 89 } -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/EnumSerializer.cs
r14185 r14927 23 23 using System.Collections.Generic; 24 24 using HeuristicLab.Persistence.Core; 25 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;25 using HeuristicLab.Persistence; 26 26 using HeuristicLab.Persistence.Interfaces; 27 27 28 28 namespace HeuristicLab.Persistence.Default.CompositeSerializers { 29 29 30 [Storable Class]30 [StorableType("7ff55c07-1c83-4d0f-924a-37c28d936d74")] 31 31 internal sealed class EnumSerializer : ICompositeSerializer { 32 32 … … 60 60 it.MoveNext(); 61 61 return Enum.Parse(t, (string)it.Current.Value); 62 } 63 catch (InvalidOperationException e) { 62 } catch (InvalidOperationException e) { 64 63 throw new PersistenceException("not enough meta information to recstruct enum", e); 65 } 66 catch (InvalidCastException e) { 64 } catch (InvalidCastException e) { 67 65 throw new PersistenceException("invalid meta information found while trying to reconstruct enum", e); 68 66 } -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/EnumerableSerializer.cs
r14185 r14927 26 26 using HeuristicLab.Persistence.Auxiliary; 27 27 using HeuristicLab.Persistence.Core; 28 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;28 using HeuristicLab.Persistence; 29 29 using HeuristicLab.Persistence.Interfaces; 30 30 31 31 namespace HeuristicLab.Persistence.Default.CompositeSerializers { 32 32 33 [Storable Class]33 [StorableType("4421c2a4-9ee1-4cfc-b98e-755a81dc5241")] 34 34 internal sealed class EnumerableSerializer : ICompositeSerializer { 35 35 … … 80 80 foreach (var tag in tags) 81 81 addMethod.Invoke(instance, new[] { tag.Value }); 82 } 83 catch (Exception e) { 82 } catch (Exception e) { 84 83 throw new PersistenceException("Exception caught while trying to populate enumerable.", e); 85 84 } -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/HashSetSerializer.cs
r14185 r14927 26 26 using System.Reflection; 27 27 using HeuristicLab.Persistence.Core; 28 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;28 using HeuristicLab.Persistence; 29 29 using HeuristicLab.Persistence.Interfaces; 30 30 31 31 namespace HeuristicLab.Persistence.Default.CompositeSerializers { 32 32 33 [Storable Class]33 [StorableType("51099049-20f2-4a71-8eae-b4ea9d677115")] 34 34 internal sealed class HashSetSerializer : ICompositeSerializer { 35 35 -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/KeyValuePairSerializer.cs
r14185 r14927 25 25 using System.Reflection; 26 26 using HeuristicLab.Persistence.Core; 27 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;27 using HeuristicLab.Persistence; 28 28 using HeuristicLab.Persistence.Interfaces; 29 29 30 30 namespace HeuristicLab.Persistence.Default.CompositeSerializers { 31 31 32 [Storable Class]32 [StorableType("97d00efc-4eb0-4dc7-a58c-977c45c2904c")] 33 33 internal sealed class KeyValuePairSerializer : ICompositeSerializer { 34 34 … … 64 64 try { 65 65 key = new Tag("key", t.GetProperty("Key").GetValue(o, null)); 66 } 67 catch (Exception e) { 66 } catch (Exception e) { 68 67 throw new PersistenceException("Exception caught during KeyValuePair decomposition", e); 69 68 } … … 71 70 try { 72 71 value = new Tag("value", t.GetProperty("Value").GetValue(o, null)); 73 } 74 catch (Exception e) { 72 } catch (Exception e) { 75 73 throw new PersistenceException("Exception caught during KeyValuePair decomposition", e); 76 74 } … … 91 89 t.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) 92 90 .Single(fi => fi.Name == "value").SetValue(instance, iter.Current.Value); 93 } 94 catch (InvalidOperationException e) { 91 } catch (InvalidOperationException e) { 95 92 throw new PersistenceException("Not enough components to populate KeyValuePair instance", e); 96 } 97 catch (Exception e) { 93 } catch (Exception e) { 98 94 throw new PersistenceException("Exception caught during KeyValuePair reconstruction", e); 99 95 } -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Number2StringSerializer.cs
r14185 r14927 25 25 using HeuristicLab.Persistence.Auxiliary; 26 26 using HeuristicLab.Persistence.Core; 27 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;27 using HeuristicLab.Persistence; 28 28 using HeuristicLab.Persistence.Default.Xml; 29 29 using HeuristicLab.Persistence.Default.Xml.Primitive; … … 40 40 /// but can be useful in generating custom serializers. 41 41 /// </summary> 42 [Storable Class]42 [StorableType("23af67f5-2af6-4aca-b841-21345eacfb2f")] 43 43 public sealed class Number2StringSerializer : ICompositeSerializer { 44 44 … … 115 115 try { 116 116 return numberSerializerMap[Nullable.GetUnderlyingType(type) ?? type].Parse(new XmlString(stringValue)); 117 } 118 catch (FormatException e) { 117 } catch (FormatException e) { 119 118 throw new PersistenceException("Invalid element data during number parsing.", e); 120 } 121 catch (OverflowException e) { 119 } catch (OverflowException e) { 122 120 throw new PersistenceException("Overflow during number parsing.", e); 123 121 } … … 172 170 it.MoveNext(); 173 171 return Parse((string)it.Current.Value, type); 174 } 175 catch (InvalidOperationException e) { 172 } catch (InvalidOperationException e) { 176 173 throw new PersistenceException( 177 174 String.Format("Insufficient meta information to reconstruct number of type {0}.", 178 175 type.VersionInvariantName()), e); 179 } 180 catch (InvalidCastException e) { 176 } catch (InvalidCastException e) { 181 177 throw new PersistenceException("Invalid meta information element type", e); 182 178 } -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/NumberEnumerable2StringSerializer.cs
r14185 r14927 26 26 using HeuristicLab.Persistence.Auxiliary; 27 27 using HeuristicLab.Persistence.Core; 28 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;28 using HeuristicLab.Persistence; 29 29 using HeuristicLab.Persistence.Interfaces; 30 30 31 31 namespace HeuristicLab.Persistence.Default.CompositeSerializers { 32 32 33 [Storable Class]33 [StorableType("8bb7c8b8-89e5-41d4-a37e-c43e5beee451")] 34 34 internal sealed class NumberEnumerable2StringSerializer : ICompositeSerializer { 35 35 … … 136 136 addMethod.Invoke(instance, new[] { numberConverter.Parse(value, elementType) }); 137 137 } 138 } 139 catch (InvalidOperationException e) { 138 } catch (InvalidOperationException e) { 140 139 throw new PersistenceException("Insufficient element data to reconstruct number enumerable", e); 141 } 142 catch (InvalidCastException e) { 140 } catch (InvalidCastException e) { 143 141 throw new PersistenceException("Invalid element data during reconstruction of number enumerable", e); 144 142 } -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/QueueSerializer.cs
r14185 r14927 25 25 using System.Reflection; 26 26 using HeuristicLab.Persistence.Core; 27 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;27 using HeuristicLab.Persistence; 28 28 using HeuristicLab.Persistence.Interfaces; 29 29 30 30 namespace HeuristicLab.Persistence.Default.CompositeSerializers { 31 31 32 [Storable Class]32 [StorableType("7a0dee32-0800-4a78-a1c3-88cd97939ca0")] 33 33 internal sealed class QueueSerializer : ICompositeSerializer { 34 34 -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/StackSerializer.cs
r14185 r14927 25 25 using System.Reflection; 26 26 using HeuristicLab.Persistence.Core; 27 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;27 using HeuristicLab.Persistence; 28 28 using HeuristicLab.Persistence.Interfaces; 29 29 30 30 namespace HeuristicLab.Persistence.Default.CompositeSerializers { 31 31 32 [Storable Class]32 [StorableType("e395b076-6001-417e-925c-8820cc0354df")] 33 33 internal sealed class StackSerializer : ICompositeSerializer { 34 34 … … 76 76 foreach (var tag in tags) 77 77 addMethod.Invoke(instance, new[] { tag.Value }); 78 } 79 catch (Exception e) { 78 } catch (Exception e) { 80 79 throw new PersistenceException("Exception caught while trying to populate enumerable.", e); 81 80 } -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs
r14185 r14927 28 28 using HeuristicLab.Persistence.Core; 29 29 using HeuristicLab.Persistence.Interfaces; 30 using HeuristicLab.Persistence; 30 31 31 32 namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable { … … 38 39 /// or <c>AllFieldsAndAllProperties</c>. 39 40 /// </summary> 40 [Storable Class]41 [StorableType("ea2bd700-d2c9-4319-9883-b795bd8f078f")] 41 42 public sealed class StorableSerializer : ICompositeSerializer { 42 43 -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/StructSerializer.cs
r14185 r14927 24 24 using System.Reflection; 25 25 using HeuristicLab.Persistence.Core; 26 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;26 using HeuristicLab.Persistence; 27 27 using HeuristicLab.Persistence.Interfaces; 28 28 29 29 namespace HeuristicLab.Persistence.Default.CompositeSerializers { 30 30 31 [Storable Class]31 [StorableType("070243ae-13d3-490e-ad17-81a96941ea3c")] 32 32 internal sealed class StructSerializer : ICompositeSerializer { 33 33 -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/TupleSerializer.cs
r14185 r14927 25 25 using System.Reflection; 26 26 using HeuristicLab.Persistence.Core; 27 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;27 using HeuristicLab.Persistence; 28 28 using HeuristicLab.Persistence.Interfaces; 29 29 30 30 namespace HeuristicLab.Persistence.Default.CompositeSerializers { 31 31 32 [Storable Class]32 [StorableType("604ea532-4a4f-4cf6-af44-1e56cf357997")] 33 33 internal sealed class TupleSerializer : ICompositeSerializer { 34 34 -
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/TypeSerializer.cs
r14185 r14927 24 24 using HeuristicLab.Persistence.Auxiliary; 25 25 using HeuristicLab.Persistence.Core; 26 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;26 using HeuristicLab.Persistence; 27 27 using HeuristicLab.Persistence.Interfaces; 28 28 29 29 namespace HeuristicLab.Persistence.Default.CompositeSerializers { 30 30 31 [Storable Class]31 [StorableType("dd23170e-0998-438a-b935-2061a7a4762e")] 32 32 internal sealed class TypeSerializer : ICompositeSerializer { 33 33 … … 66 66 try { 67 67 it.MoveNext(); 68 } 69 catch (InvalidOperationException e) { 68 } catch (InvalidOperationException e) { 70 69 throw new PersistenceException("Insufficient meta information to instantiate Type object", e); 71 70 } 72 71 try { 73 72 return TypeLoader.Load((string)it.Current.Value); 74 } 75 catch (InvalidCastException e) { 73 } catch (InvalidCastException e) { 76 74 throw new PersistenceException("Invalid meta information during reconstruction of Type object", e); 77 } 78 catch (TypeLoadException e) { 75 } catch (TypeLoadException e) { 79 76 throw new PersistenceException(String.Format( 80 77 "Cannot load Type {0}, make sure all required assemblies are available.",
Note: See TracChangeset
for help on using the changeset viewer.