Last change
on this file since 1425 was
1425,
checked in by epitzer, 15 years ago
|
Use version invariant assembly qualified name and update plug-in assembly name. (#506)
|
File size:
917 bytes
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections;
|
---|
3 | using HeuristicLab.Persistence.Core;
|
---|
4 | using HeuristicLab.Persistence.Interfaces;
|
---|
5 | using System.Collections.Generic;
|
---|
6 |
|
---|
7 | namespace HeuristicLab.Persistence.Default.Decomposers {
|
---|
8 |
|
---|
9 | public class TypeDecomposer : IDecomposer {
|
---|
10 | public bool CanDecompose(Type type) {
|
---|
11 | return type == typeof (Type) ||
|
---|
12 | type.VersionInvariantName() == "System.RuntimeType, mscorlib";
|
---|
13 | }
|
---|
14 |
|
---|
15 | public IEnumerable<Tag> DeCompose(object obj) {
|
---|
16 | Type t = (Type) obj;
|
---|
17 | yield return new Tag("VersionInvariantName", t.VersionInvariantName());
|
---|
18 | }
|
---|
19 |
|
---|
20 | public object CreateInstance(Type type) {
|
---|
21 | return null;
|
---|
22 | }
|
---|
23 |
|
---|
24 | public object Populate(object instance, IEnumerable<Tag> objects, Type type) {
|
---|
25 | foreach ( var typeName in objects ) {
|
---|
26 | return Type.GetType((string)typeName.Value);
|
---|
27 | }
|
---|
28 | return null;
|
---|
29 | }
|
---|
30 | }
|
---|
31 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.