Package io.protostuff.parser
Class DefaultProtoLoader
java.lang.Object
io.protostuff.parser.DefaultProtoLoader
- All Implemented Interfaces:
Proto.Loader
- Direct Known Subclasses:
CachingProtoLoader
Default proto loader for imported protos.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
static final DefaultProtoLoader
static final int
The default proto search strategy to use.static final String
Standard JVM property.private static final String
static final String
protected static final int
protected static final int
protected final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static File
getBaseDirFromPackagePath
(String path, Proto importer) static DefaultProtoLoader
static URL
getResource
(String resource, Class<?> context) Loads aURL
resource from the classloader; If not found, the classloader of thecontext
class specified will be used.static URL
getResource
(String resource, Class<?> context, boolean checkParent) Loads aURL
resource from the classloader; If not found, the classloader of thecontext
class specified will be used.protected Proto
protected Proto
static Proto
loadFromClasspath
(String path, Proto importer) Loads a proto from the classpath.protected Proto
loadFromOtherResource
(String path, Proto importer) protected Proto
searchFromAll
(String path, Proto importer) Search from every possible resource.protected Proto
searchFromProtoPathAndClasspath
(String path, Proto importer) Search from proto_path and classpath (in that order).protected Proto
searchFromProtoPathOnly
(String path, Proto importer) Search from proto_path only.
-
Field Details
-
ALL
protected static final int ALL- See Also:
-
PROTO_PATH_ONLY
protected static final int PROTO_PATH_ONLY- See Also:
-
PROTO_PATH_AND_CLASSPATH
protected static final int PROTO_PATH_AND_CLASSPATH- See Also:
-
DEFAULT_PROTO_SEARCH_STRATEGY
public static final int DEFAULT_PROTO_SEARCH_STRATEGYThe default proto search strategy to use. -
PATH_SEPARATOR
Standard JVM property. See https://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html -
PATH_SEPARATOR_PROPERTY
- See Also:
-
PATH_SEPARATOR_DEFAULT
- See Also:
-
DEFAULT_INSTANCE
-
__protoLoadDirs
-
protoSearchStrategy
protected final int protoSearchStrategy
-
-
Constructor Details
-
DefaultProtoLoader
public DefaultProtoLoader() -
DefaultProtoLoader
public DefaultProtoLoader(int protoSearchStrategy)
-
-
Method Details
-
getDefaultInstance
-
load
- Specified by:
load
in interfaceProto.Loader
- Throws:
Exception
-
searchFromProtoPathOnly
Search from proto_path only. For full protoc compatibility, use this.Enable via: -Dproto_path=$path -Dproto_search_strategy=1
- Throws:
Exception
-
searchFromProtoPathAndClasspath
Search from proto_path and classpath (in that order).Enable via: -Dproto_path=$path -Dproto_search_strategy=2
- Throws:
Exception
-
searchFromAll
Search from every possible resource. Also loads from a remote url (if path starts with http://).Search order is: 1. relative path 2. proto_path 3. classpath
- Throws:
Exception
-
getBaseDirFromPackagePath
-
loadFromOtherResource
- Throws:
Exception
-
loadFrom
- Throws:
Exception
-
loadFrom
- Throws:
Exception
-
loadFromClasspath
Loads a proto from the classpath.- Throws:
Exception
-
getResource
Loads aURL
resource from the classloader; If not found, the classloader of thecontext
class specified will be used. -
getResource
Loads aURL
resource from the classloader; If not found, the classloader of thecontext
class specified will be used. If the flagcheckParent
is true, the classloader's parent is included in the lookup.
-