Mercurial > projects > orange
comparison orange/util/Reflection.d @ 9:99c52d46822a
Serialization works now with D2, deserialization still doesn't work
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sat, 24 Jul 2010 18:58:18 +0200 |
parents | 32152d5fad4b |
children | 78e5fef4bbf2 |
comparison
equal
deleted
inserted
replaced
8:613a0bb20207 | 9:99c52d46822a |
---|---|
408 * name = the fully qualified name of the class | 408 * name = the fully qualified name of the class |
409 * args = the arguments to the constructor | 409 * args = the arguments to the constructor |
410 * | 410 * |
411 * Returns: the newly created instance or null | 411 * Returns: the newly created instance or null |
412 */ | 412 */ |
413 T factory (T, ARGS...) (string name, ARGS args) | 413 T factory (T) (string name) |
414 { | 414 { |
415 auto classInfo = ClassInfo.find(name); | 415 auto classInfo = ClassInfo.find(name); |
416 | 416 |
417 if (!classInfo) | 417 if (!classInfo) |
418 return null; | 418 return null; |
466 } | 466 } |
467 | 467 |
468 else | 468 else |
469 return _d_newclass(classInfo); | 469 return _d_newclass(classInfo); |
470 } | 470 } |
471 | |
472 Object newInstance (string name) | |
473 { | |
474 auto classInfo = ClassInfo.find(name); | |
475 | |
476 if (!classInfo) | |
477 return null; | |
478 | |
479 return newInstance(classInfo); | |
480 } |