Class FileDescriptor
java.lang.Object
org.infinispan.protostream.descriptors.FileDescriptor
Representation of a .proto file, including its dependencies.
- Since:
- 2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classprivate static enumThe validation status of a .proto file.static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Configurationprivate final Map<String, FileDescriptor> Files that directly depend on this one.The imports.private final List<EnumDescriptor> private FileNamespaceThe types defined in this file or in the imported files.private static final Logprivate final List<Descriptor> private final Stringprivate final Stringprivate final DescriptorParserExceptionWhenstatusis equal toFileDescriptor.Status.PARSING_ERROR, this exception provides the cause.The public imports.private FileDescriptor.Statusprivate final FileDescriptor.Syntax -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckCompatibility(FileDescriptor that, boolean strict) voidcheckCompatibility(FileDescriptor that, boolean strict, List<String> errors) voidClear resolving errors of unresolved files.private voidcollectDescriptors(Descriptor descriptor, ResolutionContext resolutionContext) private voidcollectEnumDescriptors(EnumDescriptor enumDescriptor, ResolutionContext resolutionContext) static StringTop level message types defined in this file.getName()private StringgetScopedName(String name) getTypes()All types defined in this file (both message and enum).boolean(package private) voidvoidvoidvoidresolveDependencies(ResolutionContext resolutionContext) Resolve type references across files and report semantic errors like duplicate type declarations, duplicate type ids or clashing enum value constants.private voidresolveDependencies(ResolutionContext resolutionContext, Set<String> processedFiles) private voidresolveFieldTypes(Descriptor descriptor) private List<FileDescriptor> resolveImports(List<String> dependencies, ResolutionContext resolutionContext, Set<String> processedFiles) Resolves imported file names toFileDescriptors.private GenericDescriptorsearchType(String name, Descriptor scope) voidsetConfiguration(Configuration configuration) This method is not part of the public API.toString()
-
Field Details
-
log
-
syntax
-
configuration
-
name
-
packageName
-
dependencies
-
publicDependencies
-
options
-
messageTypes
-
enumTypes
-
dependants
Files that directly depend on this one. -
fileNamespace
The types defined in this file or in the imported files. -
status
-
parsingException
Whenstatusis equal toFileDescriptor.Status.PARSING_ERROR, this exception provides the cause.
-
-
Constructor Details
-
FileDescriptor
-
-
Method Details
-
getConfiguration
-
setConfiguration
This method is not part of the public API. May be removed in future versions. -
getDependants
-
getDependencies
-
isResolved
public boolean isResolved() -
markUnresolved
public void markUnresolved() -
markError
void markError() -
clearErrors
public void clearErrors()Clear resolving errors of unresolved files. Parsing errors are not cleared. Transitions from ERROR status back to UNRESOLVED and propagates this recursively to all dependant FileDescriptors. All internal state acquired during type reference resolution is cleared for this file and dependants (recursively). -
getExportedNamespace
-
resolveDependencies
public void resolveDependencies(ResolutionContext resolutionContext) throws DescriptorParserException Resolve type references across files and report semantic errors like duplicate type declarations, duplicate type ids or clashing enum value constants. OnlyFileDescriptor.Status.UNRESOLVEDfiles are processed. Files with other states are ignored.- Throws:
DescriptorParserException
-
resolveDependencies
private void resolveDependencies(ResolutionContext resolutionContext, Set<String> processedFiles) throws DescriptorParserException - Throws:
DescriptorParserException
-
resolveImports
private List<FileDescriptor> resolveImports(List<String> dependencies, ResolutionContext resolutionContext, Set<String> processedFiles) throws DescriptorParserException Resolves imported file names toFileDescriptors. Changes the status of current file to ERROR if any of the imported files (directly or indirectly) have any errors.- Returns:
- the list of resolved
FileDescriptors - Throws:
DescriptorParserException
-
collectDescriptors
-
collectEnumDescriptors
private void collectEnumDescriptors(EnumDescriptor enumDescriptor, ResolutionContext resolutionContext) -
resolveFieldTypes
-
getScopedName
-
searchType
-
getSyntax
-
getName
-
getPackage
-
getOptions
-
getOption
-
getEnumTypes
-
getMessageTypes
Top level message types defined in this file. -
getTypes
All types defined in this file (both message and enum). -
checkCompatibility
-
checkCompatibility
-
parseAnnotations
public void parseAnnotations() -
toString
-
fullName
-