Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6221


Ignore:
Timestamp:
05/17/11 14:19:51 (14 years ago)
Author:
epitzer
Message:

streamline access and don't eat exceptions when access unavailable types and members (#1530)

Location:
branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/FieldDescriptor.cs

    r6214 r6221  
    2020#endregion
    2121using System;
    22 using System.Collections.Generic;
    23 using System.Linq;
    2422using System.Reflection;
    2523using System.Text;
    26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2724
    2825namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable.Descriptors {
     
    3532
    3633    #region Fields & Properties
    37    
     34
    3835    /// <summary>
    3936    /// The type that declared this field.
     
    7572    public FieldInfo Handle {
    7673      get {
    77         try {
    78           if (handle == null)
    79             handle = DeclaringType.Handle.GetField(RealName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
    80         } catch { }
     74        if (handle == null)
     75          handle = DeclaringType.Handle.GetField(RealName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
    8176        return handle;
    8277      }
    8378    }
    8479    #endregion
    85    
     80
    8681    [StorableConstructor]
    8782    private FieldDescriptor(bool deserializing) { }
  • branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/HookDescriptor.cs

    r6214 r6221  
    2020#endregion
    2121using System;
    22 using System.Collections.Generic;
    23 using System.Linq;
    2422using System.Reflection;
    2523using System.Text;
    26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2724using HeuristicLab.Persistence.Auxiliary;
    2825
     
    5451    public HookType HookType { get; set; }
    5552
    56     private MethodInfo handle;
     53    internal MethodInfo handle;
    5754    /// <summary>
    5855    /// The MethodInfo of the hook as obtained by reflection.
     
    6057    public MethodInfo Handle {
    6158      get {
    62         try {
    63           if (handle == null)
    64             handle = DeclaringType.Handle.GetMethod(MethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null);
    65         } catch { }
     59        if (handle == null)
     60          handle = DeclaringType.Handle.GetMethod(MethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null);
    6661        return handle;
    67       }
    68       internal set {
    69         handle = value;
    7062      }
    7163    }
  • branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/PropertyDescriptor.cs

    r6214 r6221  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    2523using System.Reflection;
    2624using System.Text;
    27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2825
    2926namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable.Descriptors {
     
    3532  public sealed class PropertyDescriptor : ITypeComponent {
    3633
     34    #region Fields & Properties
    3735    /// <summary>
    3836    /// The type descriptor of the type who declared this property. This
     
    8280    public string Name { get { return StoredName ?? RealName; } }
    8381
    84     #region Activation
    85     private PropertyInfo handle;
     82    internal PropertyInfo handle;
    8683    /// <summary>
    8784    /// The PropertyInfo object as obtained by reflection representing
     
    9087    public PropertyInfo Handle {
    9188      get {
    92         try {
    93           if (handle == null)
    94             handle = DeclaringType.Handle.GetProperty(RealName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
    95         } catch { }
     89        if (handle == null)
     90          handle = DeclaringType.Handle.GetProperty(RealName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
    9691        return handle;
    9792      }
    98       internal set {
    99         handle = value;
    100       }
    10193    }
    10294    #endregion
     
    119111
    120112    [StorableConstructor]
    121     private PropertyDescriptor(bool deserializing)  { }
     113    private PropertyDescriptor(bool deserializing) { }
    122114
    123115    /// <summary>
     
    136128      CanRead = propertyInfo.CanRead;
    137129      CanWrite = propertyInfo.CanWrite;
    138       Handle = propertyInfo;
     130      handle = propertyInfo;
    139131    }
    140132
  • branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/Descriptors/TypeDescriptor.cs

    r6214 r6221  
    9191    public bool IsInvalid { get; set; }
    9292
    93     private Type handle;
     93    internal Type handle;
    9494    /// <summary>
    9595    /// Get the System.Type handle representing this type.
     
    9797    public Type Handle {
    9898      get {
    99         if (handle != null)
    100           return handle;
    101         try {
     99        if (handle == null)
    102100          handle = Type.GetType(AssemblyQualifiedName);
    103           return handle;
    104         } catch {
    105           return null;
    106         }
     101        return handle;
    107102      }
    108103    }
Note: See TracChangeset for help on using the changeset viewer.