The Builder object is used to represent an single constructor within an object. It contains the actual constructor as well as the list of parameters. Each builder will score its weight when given a Criteria object. This allows the deserialization process to find the most suitable one to use when instantiating an object.
Пример #1
0
 /// <summary>
 /// Constructor for the <c>ClassCreator</c> object. This is
 /// used to create an object that contains all information that
 /// relates to the construction of an instance.
 /// </summary>
 /// <param name="list">
 /// this contains the list of all constructors
 /// </param>
 /// <param name="index">
 /// this contains all parameters for each constructor
 /// </param>
 /// <param name="primary">
 /// this is the default no argument constructor
 /// </param>
 public ClassCreator(List<Builder> list, Index index, Builder primary) {
    this.type = index.Type;
    this.primary = primary;
    this.index = index;
    this.list = list;
 }
Пример #2
0
 /// <summary>
 /// This is used to build the <c>Builder</c> object that is
 /// to be used to instantiate the object. The builder contains
 /// the constructor at the parameters in the declaration order.
 /// </summary>
 /// <param name="factory">
 /// this is the constructor that is to be scanned
 /// </param>
 /// <param name="map">
 /// this is the parameter map that contains parameters
 /// </param>
 public void Build(Constructor factory, Index map) {
    Builder builder = new Builder(factory, map);
    if(builder.isDefault()) {
       primary = builder;
    }
    list.add(builder);
 }