source: josm/trunk/src/org/openstreetmap/josm/data/projection/proj/ClassProjFactory.java@ 9565

Last change on this file since 9565 was 9067, checked in by Don-vip, 8 years ago

sonar - Immutable Field

  • Property svn:eol-style set to native
File size: 668 bytes
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.projection.proj;
3
4/**
5 * Proj Factory that creates instances from a given class.
6 */
7public class ClassProjFactory implements ProjFactory {
8
9 private final 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.