public class ResourceLoader<T>
extends org.osgl.inject.ValueLoader.Base<T>
Modifier and Type | Field and Description |
---|---|
protected static org.osgl.logging.Logger |
LOGGER |
protected Object |
resource |
Constructor and Description |
---|
ResourceLoader() |
Modifier and Type | Method and Description |
---|---|
protected static Object |
_load(String resourcePath,
org.osgl.inject.BeanSpec spec,
boolean ignoreResourceNotFound) |
T |
get() |
protected void |
initialized() |
static <T> T |
load(String resourcePath,
org.osgl.inject.BeanSpec spec)
Load resource content from given path into variable with type specified by
spec . |
static <T> T |
load(String resourcePath,
org.osgl.inject.BeanSpec spec,
boolean ignoreResourceNotFound) |
static <T> T |
load(String path,
Class<T> type)
A static method to load resource content
|
static <T> T |
load(String path,
Class<T> type,
boolean ignoreResourceNotFound) |
static <T> T |
load(String path,
com.alibaba.fastjson.TypeReference<T> typeReference)
A static method to load resource content
|
static <T> T |
load(String path,
com.alibaba.fastjson.TypeReference<T> typeReference,
boolean ignoreResourceNotFound) |
protected static final org.osgl.logging.Logger LOGGER
protected Object resource
protected void initialized()
initialized
in class org.osgl.inject.ValueLoader.Base<T>
public T get()
public static <T> T load(String path, Class<T> type)
A static method to load resource content
If any exception encountered during resource load, this method returns null
T
- generic type of return valuepath
- the relative path to the resourcetype
- the return value typenull
if exception encountered.public static <T> T load(String path, com.alibaba.fastjson.TypeReference<T> typeReference)
A static method to load resource content
If any exception encountered during resource load, this method returns null
T
- generic type of return valuepath
- the relative path to the resourcetypeReference
- the return value typenull
if exception encountered.public static <T> T load(String path, com.alibaba.fastjson.TypeReference<T> typeReference, boolean ignoreResourceNotFound)
public static <T> T load(String resourcePath, org.osgl.inject.BeanSpec spec)
Load resource content from given path into variable with type specified by spec
.
resourcePath
- the resource pathspec
- BeanSpec
specifies the return value typenull
if resource not foundorg.osgl.exception.UnexpectedException
- if return value type not supportedpublic static <T> T load(String resourcePath, org.osgl.inject.BeanSpec spec, boolean ignoreResourceNotFound)
Copyright © 2014–2018 ActFramework. All rights reserved.