|
31 | 31 | import java.util.logging.Level;
|
32 | 32 | import java.util.logging.Logger;
|
33 | 33 |
|
34 |
| -import net.sf.cglib.beans.BeanGenerator; |
35 | 34 | import org.opengrok.indexer.configuration.Project;
|
36 | 35 | import org.opengrok.indexer.configuration.RuntimeEnvironment;
|
37 | 36 | import org.opengrok.indexer.logger.LoggerFactory;
|
| 37 | +import org.opengrok.indexer.util.BeanBuilder; |
38 | 38 | import org.opengrok.indexer.util.ClassUtil;
|
39 | 39 | import org.opengrok.indexer.util.PathUtils;
|
40 | 40 |
|
@@ -97,34 +97,19 @@ public Object getRepositoryInfoData() {
|
97 | 97 | }
|
98 | 98 |
|
99 | 99 | private Object createRepositoryInfoTO() {
|
100 |
| - BeanGenerator beanGenerator = new BeanGenerator(); |
101 |
| - beanGenerator.addProperty("type", String.class); |
102 |
| - beanGenerator.addProperty("directoryNameRelative", String.class); |
103 |
| - beanGenerator.addProperty("remote", boolean.class); |
104 |
| - beanGenerator.addProperty("parent", String.class); |
105 |
| - beanGenerator.addProperty("branch", String.class); |
106 |
| - beanGenerator.addProperty("currentVersion", String.class); |
107 |
| - beanGenerator.addProperty("working", Boolean.class); |
108 |
| - beanGenerator.addProperty("handleRenamedFiles", boolean.class); |
109 |
| - beanGenerator.addProperty("historyEnabled", boolean.class); |
110 |
| - |
111 |
| - Object myBean = beanGenerator.create(); |
112 |
| - try { |
113 |
| - ClassUtil.setFieldValue(myBean, "type", this.type); |
114 |
| - ClassUtil.setFieldValue(myBean, "working", |
115 |
| - this.working == null ? false : this.working); |
116 |
| - ClassUtil.setFieldValue(myBean, "directoryNameRelative", this.directoryNameRelative); |
117 |
| - ClassUtil.setFieldValue(myBean, "remote", this.remote); |
118 |
| - ClassUtil.setFieldValue(myBean, "parent", this.parent); |
119 |
| - ClassUtil.setFieldValue(myBean, "branch", this.branch); |
120 |
| - ClassUtil.setFieldValue(myBean, "currentVersion", this.currentVersion); |
121 |
| - ClassUtil.setFieldValue(myBean, "handleRenamedFiles", this.handleRenamedFiles); |
122 |
| - ClassUtil.setFieldValue(myBean, "historyEnabled", this.historyEnabled); |
123 |
| - } catch (IOException e) { |
124 |
| - LOGGER.log(Level.WARNING, "cannot generate RepositoryInfo bean", e); |
125 |
| - return null; |
126 |
| - } |
127 |
| - return myBean; |
| 100 | + BeanBuilder builder = new BeanBuilder(); |
| 101 | + |
| 102 | + builder.add("type", String.class, this.type) |
| 103 | + .add("directoryNameRelative", String.class, this.directoryNameRelative) |
| 104 | + .add("remote", boolean.class, this.remote) |
| 105 | + .add("parent", String.class, this.parent) |
| 106 | + .add("branch", String.class, this.branch) |
| 107 | + .add("currentVersion", String.class, this.currentVersion) |
| 108 | + .add("working", Boolean.class, this.working == null ? false : this.working) |
| 109 | + .add("handleRenamedFiles", boolean.class, this.handleRenamedFiles) |
| 110 | + .add("historyEnabled", boolean.class, this.historyEnabled); |
| 111 | + |
| 112 | + return builder.build(); |
128 | 113 | }
|
129 | 114 |
|
130 | 115 | /**
|
|
0 commit comments