The Instantiator is used to instantiate types that will leverage a constructor cache to quickly create the objects. This is used by the various object factories to return type instances that can be used by converters to create the objects that will later be deserialized.
Пример #1
0
 /// <summary>
 /// Constructor for the <c>Support</c> object. This will
 /// create a support object with the matcher and filter provided.
 /// This allows the user to override the transformations that
 /// are used to convert types to strings and back again.
 /// </summary>
 /// <param name="filter">
 /// this is the filter to use with this support
 /// </param>
 /// <param name="matcher">
 /// this is the matcher used for transformations
 /// </param>
 public Support(Filter filter, Matcher matcher)
 {
     this.transform = new Transformer(matcher);
     this.factory   = new ScannerFactory();
     this.creator   = new Instantiator();
     this.matcher   = matcher;
     this.filter    = filter;
 }
Пример #2
0
 /// <summary>
 /// Constructor for the <c>ValueInstance</c> object. This
 /// is used to represent an instance that delegates to the given
 /// value object in order to acquire the object.
 /// </summary>
 /// <param name="creator">
 /// this is the instantiator used to create objects
 /// </param>
 /// <param name="value">
 /// this is the value object that contains the data
 /// </param>
 public ValueInstance(Instantiator creator, Value value) {
    this.type = value.Type;
    this.creator = creator;
    this.value = value;
 }
Пример #3
0
 /// <summary>
 /// Constructor for the <c>ClassInstance</c> object. This is
 /// used to create an instance of the specified type. If the given
 /// type can not be instantiated then an exception is thrown.
 /// </summary>
 /// <param name="creator">
 /// this is the creator used for the instantiation
 /// </param>
 /// <param name="type">
 /// this is the type that is to be instantiated
 /// </param>
 public ClassInstance(Instantiator creator, Class type) {
    this.creator = creator;
    this.type = type;
 }
Пример #4
0
 /// <summary>
 /// Constructor for the <c>ClassInstance</c> object. This is
 /// used to create an instance of the specified type. If the given
 /// type can not be instantiated then an exception is thrown.
 /// </summary>
 /// <param name="creator">
 /// this is the creator used for the instantiation
 /// </param>
 /// <param name="type">
 /// this is the type that is to be instantiated
 /// </param>
 public ClassInstance(Instantiator creator, Class type)
 {
     this.creator = creator;
     this.type    = type;
 }
Пример #5
0
 /// <summary>
 /// Constructor for the <c>Support</c> object. This will
 /// create a support object with the matcher and filter provided.
 /// This allows the user to override the transformations that
 /// are used to convert types to strings and back again.
 /// </summary>
 /// <param name="filter">
 /// this is the filter to use with this support
 /// </param>
 /// <param name="matcher">
 /// this is the matcher used for transformations
 /// </param>
 public Support(Filter filter, Matcher matcher) {
    this.transform = new Transformer(matcher);
    this.factory = new ScannerFactory();
    this.creator = new Instantiator();
    this.matcher = matcher;
    this.filter = filter;
 }