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:
750 bytes
|
Line | |
---|
1 | package com.framsticks.util; |
---|
2 | |
---|
3 | import java.io.InputStream; |
---|
4 | |
---|
5 | import com.framsticks.params.annotations.ParamAnnotation; |
---|
6 | |
---|
7 | public abstract class ResourceBuilder<T> implements Builder<T> { |
---|
8 | |
---|
9 | protected InputStream stream; |
---|
10 | |
---|
11 | /** |
---|
12 | * @return the stream |
---|
13 | */ |
---|
14 | public InputStream getStream() { |
---|
15 | return stream; |
---|
16 | } |
---|
17 | |
---|
18 | /** |
---|
19 | * @return the resource |
---|
20 | */ |
---|
21 | @ParamAnnotation |
---|
22 | public String getResource() { |
---|
23 | return resource; |
---|
24 | } |
---|
25 | |
---|
26 | /** |
---|
27 | * @param stream the stream to set |
---|
28 | */ |
---|
29 | public ResourceBuilder<T> stream(InputStream stream) { |
---|
30 | this.stream = stream; |
---|
31 | return this; |
---|
32 | } |
---|
33 | |
---|
34 | protected String resource; |
---|
35 | |
---|
36 | @ParamAnnotation |
---|
37 | public ResourceBuilder<T> resource(String resource) { |
---|
38 | this.resource = resource; |
---|
39 | return stream(getClass().getResourceAsStream(resource)); |
---|
40 | } |
---|
41 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.