| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
package com.google.inject.jndi; |
| 18 |
|
|
| 19 |
|
import com.google.inject.Inject; |
| 20 |
|
import com.google.inject.Provider; |
| 21 |
|
import javax.naming.Context; |
| 22 |
|
import javax.naming.NamingException; |
| 23 |
|
|
| 24 |
|
|
| 25 |
|
|
| 26 |
|
@link |
| 27 |
|
|
| 28 |
|
@author |
| 29 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 30 |
|
public class JndiIntegration { |
| 31 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 32 |
0
|
private JndiIntegration() {}... |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 42 |
0
|
public static <T> Provider<T> fromJndi(Class<T> type, String name) {... |
| 43 |
0
|
return new JndiProvider<T>(type, name); |
| 44 |
|
} |
| 45 |
|
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
| 46 |
|
static class JndiProvider<T> implements Provider<T> { |
| 47 |
|
|
| 48 |
|
@Inject Context context; |
| 49 |
|
final Class<T> type; |
| 50 |
|
final String name; |
| 51 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 52 |
0
|
public JndiProvider(Class<T> type, String name) {... |
| 53 |
0
|
this.type = type; |
| 54 |
0
|
this.name = name; |
| 55 |
|
} |
| 56 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 57 |
0
|
public T get() {... |
| 58 |
0
|
try { |
| 59 |
0
|
return type.cast(context.lookup(name)); |
| 60 |
|
} |
| 61 |
|
catch (NamingException e) { |
| 62 |
0
|
throw new RuntimeException(e); |
| 63 |
|
} |
| 64 |
|
} |
| 65 |
|
} |
| 66 |
|
} |