public class Model extends Element implements ConfigLocationResolver
| Modifier and Type | Method and Description |
|---|---|
void |
addDiagIfNotSuppressed(java.lang.Object elementOrLocation,
Diag diag)
Adds diagnosis to the model if it is not suppressed.
|
void |
addRoot(ProtoElement root)
Add a root element to the model.
|
void |
addSupressionDirective(Element elem,
java.lang.String directive)
Adds a user-level suppression directive.
|
static Model |
create(com.google.protobuf.DescriptorProtos.FileDescriptorSet proto)
Creates an model where all protos in the descriptor are considered to be sources.
|
static Model |
create(com.google.protobuf.DescriptorProtos.FileDescriptorSet proto,
java.lang.Iterable<java.lang.String> sources)
Creates a new model based on the given file descriptor set and list of source file names.
|
static Model |
create(com.google.protobuf.DescriptorProtos.FileDescriptorSet proto,
java.lang.Iterable<java.lang.String> sources,
java.lang.Iterable<java.lang.String> experiments,
ExtensionPool extensionPool)
Creates a new model based on the given file descriptor, list of source file names and list of
experiments to be enabled for the model.
|
static Model |
create(com.google.api.Service normalizedConfig)
Creates a model from a normalized service config, rather than from descriptor and .yaml files.
|
static java.lang.String |
diagPrefix(java.lang.String aspectName)
Returns a prefix to be used in diag messages for general errors and warnings.
|
static java.lang.String |
diagPrefixForLint(java.lang.String aspectName,
java.lang.String ruleName)
Returns a prefix to be used in diag messages representing linter warnings.
|
void |
enableDiscoveryDocDerivation(boolean generateDerivedDiscovery) |
void |
enableExperiment(java.lang.String experiment)
Enables the given experiment (for testing).
|
boolean |
establishStage(com.google.inject.Key<?> key)
Establishes a processing stage.
|
java.io.File |
findDataFile(java.lang.String name)
Finds a file on the data path.
|
java.lang.String |
getApiV1VersionSuffix()
Gets API v1 version suffix.
|
java.lang.Iterable<ConfigAspect> |
getConfigAspects()
Returns the registered configuration aspects.
|
int |
getConfigVersion()
Returns the effective config version.
|
java.lang.String |
getControlEnvironment()
Returns the control environment string of this model.
|
java.lang.String |
getDataPath()
Returns a search path for data dependencies.
|
java.util.Set<java.util.Set<java.lang.String>> |
getDeclaredVisibilityCombinations()
Get a collection of declared visibility combinations.
|
static int |
getDefaultConfigVersion()
Returns the default config version.
|
static int |
getDevConfigVersion()
Returns the config version under development.
|
DiagCollector |
getDiagCollector() |
com.google.common.collect.ImmutableList<ProtoFile> |
getFiles()
Returns the list of (proto) files.
|
java.lang.String |
getFullName()
Returns a fully qualified name for the element.
|
Location |
getLocation()
Returns the location associated with this element.
|
Location |
getLocationInConfig(com.google.protobuf.Message message,
java.lang.String fieldName)
Returns the service config file location of the given named field in the (sub)message.
|
Location |
getLocationOfRepeatedFieldInConfig(com.google.protobuf.Message message,
java.lang.String fieldName,
java.lang.Object elementKey)
Returns the service config file location of the given named field in the (sub)message.
|
Model |
getModel()
Returns the model associated with this element.
|
com.google.api.Service |
getNormalizedConfig()
Returns the normalized service config
|
java.lang.Iterable<ProtoElement> |
getRoots()
Get the roots collected for the model.
|
Scoper |
getScoper()
Gets the scoper used for this model.
|
com.google.api.Service |
getServiceConfig()
Returns the associated service config raw value.
|
ConfigSource |
getServiceConfigSource()
Returns the associated service config source.
|
java.lang.String |
getSimpleName()
Returns a simple name for the element.
|
SymbolTable |
getSymbolTable()
Returns the symbolTable
|
java.util.Set<java.lang.String> |
getVisibilityLabels()
Returns the visibility labels the caller wants to apply to this model.
|
boolean |
isExperimentEnabled(java.lang.String experiment)
Checks whether a given experiment is enabled.
|
boolean |
isPrivateService()
Returns true if the service is a private API, corp API, or on sandbox.googles.com non
production environent.
|
boolean |
isSuppressedDiag(Diag diag,
Element elem)
Checks whether the given diagnosis is suppressed for the given element.
|
<E extends ProtoElement> |
reachable(java.lang.Iterable<E> elems)
Returns the iterable scoped to the reachable elements.
|
void |
registerConfigAspect(ConfigAspect aspect)
Registers the configuration aspect with the model.
|
Processor |
registerProcessor(Processor processor)
Registers a stage processor.
|
void |
setApiV1VersionSuffix(java.lang.String value)
Sets API v1 version suffix in the model.
|
void |
setConfigs(java.lang.Iterable<com.google.protobuf.Message> configs)
Deprecated.
|
void |
setConfigSources(java.lang.Iterable<ConfigSource> configs)
Sets the service config based on a sequence of sources of heterogeneous types.
|
void |
setDataPath(java.lang.String dataPath)
Sets the data dependency search path.
|
void |
setDeclaredVisibilityCombinations(java.util.Set<java.util.Set<java.lang.String>> declaredVisibilityCombinations)
Set a collection of declared visibility combinations.
|
void |
setFiles(com.google.common.collect.ImmutableList<ProtoFile> files)
Set the list of (proto) files.
|
void |
setNormalizedConfig(com.google.api.Service normalizedConfig) |
Scoper |
setScoper(Scoper scoper)
Sets the scoper used for traversing this model.
|
void |
setServiceConfig(ConfigSource source)
Sets the service config from a config source.
|
void |
setServiceConfig(com.google.api.Service config)
Deprecated.
|
void |
setSymbolTable(SymbolTable symbolTable)
For setting the symbol table.
|
java.util.Set<java.lang.String> |
setVisibilityLabels(java.util.Set<java.lang.String> visibilityLabels)
Set visibility labels from the given list.
|
void |
setWarningFilter(java.lang.String aspectNamePattern)
Set a filter for warnings based on regular expression for aspect name.
|
boolean |
shouldDerivedDiscoveryDoc()
Returns true if the derived discovery doc should be generated and added into service config.
|
void |
suppressAllWarnings()
Shortcut for suppressing all warnings.
|
addAttribute, getAttribute, getAttributeOrDefault, hasAttribute, putAttribute, removeAttributepublic static Model create(com.google.protobuf.DescriptorProtos.FileDescriptorSet proto, java.lang.Iterable<java.lang.String> sources, java.lang.Iterable<java.lang.String> experiments, ExtensionPool extensionPool)
public static Model create(com.google.protobuf.DescriptorProtos.FileDescriptorSet proto, java.lang.Iterable<java.lang.String> sources)
public static Model create(com.google.protobuf.DescriptorProtos.FileDescriptorSet proto)
public static Model create(com.google.api.Service normalizedConfig)
public static int getDefaultConfigVersion()
public static int getDevConfigVersion()
public Model getModel()
Elementpublic Location getLocation()
ElementgetLocation in class Elementpublic java.lang.String getFullName()
ElementgetFullName in class Elementpublic java.lang.String getSimpleName()
ElementgetSimpleName in class Elementpublic DiagCollector getDiagCollector()
public com.google.common.collect.ImmutableList<ProtoFile> getFiles()
public void setFiles(com.google.common.collect.ImmutableList<ProtoFile> files)
@Nullable public java.util.Set<java.lang.String> getVisibilityLabels()
public java.util.Set<java.lang.String> setVisibilityLabels(@Nullable
java.util.Set<java.lang.String> visibilityLabels)
public java.util.Set<java.util.Set<java.lang.String>> getDeclaredVisibilityCombinations()
public void setDeclaredVisibilityCombinations(java.util.Set<java.util.Set<java.lang.String>> declaredVisibilityCombinations)
public boolean isExperimentEnabled(java.lang.String experiment)
public void enableExperiment(java.lang.String experiment)
public void setApiV1VersionSuffix(java.lang.String value)
public java.lang.String getApiV1VersionSuffix()
public SymbolTable getSymbolTable()
public void setSymbolTable(SymbolTable symbolTable)
public void addRoot(ProtoElement root)
public java.lang.Iterable<ProtoElement> getRoots()
public Scoper setScoper(Scoper scoper)
public Scoper getScoper()
public <E extends ProtoElement> java.lang.Iterable<E> reachable(java.lang.Iterable<E> elems)
@Deprecated public void setServiceConfig(com.google.api.Service config)
public void setServiceConfig(ConfigSource source)
public void setConfigSources(java.lang.Iterable<ConfigSource> configs)
@Deprecated public void setConfigs(java.lang.Iterable<com.google.protobuf.Message> configs)
public com.google.api.Service getServiceConfig()
public ConfigSource getServiceConfigSource()
public int getConfigVersion()
public com.google.api.Service getNormalizedConfig()
public void setNormalizedConfig(com.google.api.Service normalizedConfig)
public static java.lang.String diagPrefix(java.lang.String aspectName)
public static java.lang.String diagPrefixForLint(java.lang.String aspectName,
java.lang.String ruleName)
public void setWarningFilter(@Nullable
java.lang.String aspectNamePattern)
public void suppressAllWarnings()
public void addSupressionDirective(Element elem, java.lang.String directive)
public boolean isSuppressedDiag(Diag diag, Element elem)
public Location getLocationInConfig(com.google.protobuf.Message message, java.lang.String fieldName)
SimpleLocation.TOPLEVEL if the location is not known.getLocationInConfig in interface ConfigLocationResolverpublic Location getLocationOfRepeatedFieldInConfig(com.google.protobuf.Message message, java.lang.String fieldName, java.lang.Object elementKey)
SimpleLocation.TOPLEVEL if the location is not known.getLocationOfRepeatedFieldInConfig in interface ConfigLocationResolverpublic void addDiagIfNotSuppressed(java.lang.Object elementOrLocation,
Diag diag)
public void registerConfigAspect(ConfigAspect aspect)
public java.lang.Iterable<ConfigAspect> getConfigAspects()
@Nullable public Processor registerProcessor(Processor processor)
public boolean establishStage(com.google.inject.Key<?> key)
public java.lang.String getDataPath()
public void setDataPath(java.lang.String dataPath)
@Nullable public java.io.File findDataFile(java.lang.String name)
public java.lang.String getControlEnvironment()
public boolean isPrivateService()
public boolean shouldDerivedDiscoveryDoc()
public void enableDiscoveryDocDerivation(boolean generateDerivedDiscovery)