Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.projection.proj;
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * Proj Factory that creates instances from a given class.
|
---|
6 | */
|
---|
7 | public class ClassProjFactory implements ProjFactory {
|
---|
8 |
|
---|
9 | private Class<? extends Proj> projClass;
|
---|
10 |
|
---|
11 | public ClassProjFactory(Class<? extends Proj> projClass) {
|
---|
12 | this.projClass = projClass;
|
---|
13 | }
|
---|
14 |
|
---|
15 | @Override
|
---|
16 | public Proj createInstance() {
|
---|
17 | Proj proj = null;
|
---|
18 | try {
|
---|
19 | proj = projClass.newInstance();
|
---|
20 | } catch (InstantiationException | IllegalAccessException e) {
|
---|
21 | throw new RuntimeException(e);
|
---|
22 | }
|
---|
23 | return proj;
|
---|
24 | }
|
---|
25 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.