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 intstatic final DefaultProtoLoaderstatic final intThe default proto search strategy to use.static final StringStandard JVM property.private static final Stringstatic final Stringprotected static final intprotected static final intprotected final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static FilegetBaseDirFromPackagePath(String path, Proto importer) static DefaultProtoLoaderstatic URLgetResource(String resource, Class<?> context) Loads aURLresource from the classloader; If not found, the classloader of thecontextclass specified will be used.static URLgetResource(String resource, Class<?> context, boolean checkParent) Loads aURLresource from the classloader; If not found, the classloader of thecontextclass specified will be used.protected Protoprotected Protostatic ProtoloadFromClasspath(String path, Proto importer) Loads a proto from the classpath.protected ProtoloadFromOtherResource(String path, Proto importer) protected ProtosearchFromAll(String path, Proto importer) Search from every possible resource.protected ProtosearchFromProtoPathAndClasspath(String path, Proto importer) Search from proto_path and classpath (in that order).protected ProtosearchFromProtoPathOnly(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:
loadin 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 aURLresource from the classloader; If not found, the classloader of thecontextclass specified will be used. -
getResource
Loads aURLresource from the classloader; If not found, the classloader of thecontextclass specified will be used. If the flagcheckParentis true, the classloader's parent is included in the lookup.
-