Last change
on this file since 193 was
193,
checked in by Maciej Komosinski, 10 years ago
|
Set svn:eol-style native for all textual files
|
-
Property svn:eol-style set to
native
|
File size:
572 bytes
|
Line | |
---|
1 | package com.framsticks.structure; |
---|
2 | |
---|
3 | import com.framsticks.util.FramsticksException; |
---|
4 | |
---|
5 | public class SideNoteKey<T> { |
---|
6 | |
---|
7 | protected final Class<T> type; |
---|
8 | |
---|
9 | /** |
---|
10 | * @param type |
---|
11 | */ |
---|
12 | public SideNoteKey(Class<T> type) { |
---|
13 | this.type = type; |
---|
14 | } |
---|
15 | |
---|
16 | public static <T2> SideNoteKey<T2> make(Class<T2> type) { |
---|
17 | return new SideNoteKey<T2>(type); |
---|
18 | } |
---|
19 | |
---|
20 | public T newValue() { |
---|
21 | try { |
---|
22 | return type.newInstance(); |
---|
23 | } catch (InstantiationException | IllegalAccessException e) { |
---|
24 | throw new FramsticksException().msg("failed to create side note value").arg("type", type).cause(e); |
---|
25 | } |
---|
26 | } |
---|
27 | |
---|
28 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.