BrightSide Workbench Full Report + Source Code
WebLocaleResource.java
Go to the documentation of this file.
1
/*
2
* TurrĂ³ i Cutiller Foundation. License notice.
3
* Copyright (C) 2021 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU Affero General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Affero General Public License for more details.
14
*
15
* You should have received a copy of the GNU Affero General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
package
org.turro.elephant.web.context;
20
21
import
java.io.File;
22
import
java.util.Map;
23
import
java.util.Set;
24
import
java.util.TreeMap;
25
30
public
class
WebLocaleResource
{
31
32
// Lang
33
private
final
Map<String, WebResource> resources =
new
TreeMap<>();
34
35
public
File
resourceForLang
(String lang) {
36
WebResource
wr = resources.get(lang);
37
if
(wr !=
null
) {
38
return
wr.
getResource
();
39
}
else
{
40
return
null
;
41
}
42
}
43
44
public
String
resourceNameForLang
(String lang) {
45
File resource =
resourceForLang
(lang);
46
if
(resource !=
null
) {
47
return
resource.getName();
48
}
else
{
49
return
null
;
50
}
51
}
52
53
public
WebResource
addWebResource
(String lang,
WebResource
resource) {
54
resources.putIfAbsent(lang, resource);
55
return
resources.get(lang);
56
}
57
58
public
WebResource
getWebResource
(String lang) {
59
return
resources.get(lang);
60
}
61
62
public
Set<String>
getLangs
() {
63
return
resources.keySet();
64
}
65
66
}
org.turro.elephant.web.context.WebLocaleResource
Definition:
WebLocaleResource.java:30
org.turro.elephant.web.context.WebLocaleResource.getWebResource
WebResource getWebResource(String lang)
Definition:
WebLocaleResource.java:58
org.turro.elephant.web.context.WebLocaleResource.resourceForLang
File resourceForLang(String lang)
Definition:
WebLocaleResource.java:35
org.turro.elephant.web.context.WebLocaleResource.getLangs
Set< String > getLangs()
Definition:
WebLocaleResource.java:62
org.turro.elephant.web.context.WebLocaleResource.resourceNameForLang
String resourceNameForLang(String lang)
Definition:
WebLocaleResource.java:44
org.turro.elephant.web.context.WebLocaleResource.addWebResource
WebResource addWebResource(String lang, WebResource resource)
Definition:
WebLocaleResource.java:53
org.turro.elephant.web.context.WebResource
Definition:
WebResource.java:34
org.turro.elephant.web.context.WebResource.getResource
File getResource()
Definition:
WebResource.java:45
TurroProjects
Public
Elephant
elephant
src
main
java
org
turro
elephant
web
context
WebLocaleResource.java
Generated on Tue Mar 12 2024 07:01:21 for BrightSide by
1.9.1