com.google.auto.factory.Provided Java Examples
The following examples show how to use
com.google.auto.factory.Provided.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PublicKeysManager.java From curiostack with MIT License | 6 votes |
@SuppressWarnings("ConstructorLeaksThis") public PublicKeysManager(@Provided Clock clock, String publicKeysUrl) { this.clock = clock; URI uri = URI.create(publicKeysUrl); path = uri.getPath(); httpClient = WebClient.builder(uri.getScheme() + "://" + uri.getAuthority()) .decorator(LoggingClient.builder().newDecorator()) .decorator(RetryingClient.newDecorator(RetryRule.failsafe())) .build(); keysCache = new AsyncRefreshingValue<>( this::refresh, CachedPublicKeys::expirationTime, CommonPools.workerGroup().next(), clock); }
Example #2
Source File: ScrubbingEditor.java From MOE with Apache License 2.0 | 6 votes |
ScrubbingEditor( @Provided CommandRunner cmd, @Provided FileSystem filesystem, @Named("scrubber_binary") @Provided Lazy<File> executable, @Provided TarUtils tarUtils, @Provided CodebaseMerger merger, String editorName, EditorConfig config, @Provided Gson gson) { this.cmd = cmd; this.filesystem = filesystem; this.executable = executable; this.tarUtils = tarUtils; this.merger = merger; this.name = editorName; this.scrubberConfig = config.scrubberConfig(); this.gson = gson; }
Example #3
Source File: LinkFactory.java From js-dossier with Apache License 2.0 | 6 votes |
/** * Creates a new link factory. * * @param dfs used to generate paths to documentation in the output file system. * @param typeRegistry used to lookup nominal types. * @param jsTypeRegistry used to lookup JavaScript types. * @param typeContext defines the context in which to resolve type names. * @param urlTemplate if provided, defines a template for links to source files. * @param pathContext the object, if any, to generate paths relative to in the output file system. * If {@code null}, paths will be relative to the output root. */ LinkFactory( @Provided DossierFileSystem dfs, @Provided TypeRegistry typeRegistry, @Provided JSTypeRegistry jsTypeRegistry, @Provided NodeLibrary nodeLibrary, @Provided ModuleNamingConvention namingConvention, @Provided TypeContext typeContext, @Provided @SourceUrlTemplate Optional<String> urlTemplate, @Provided @TypeFilter Predicate<String> typeNameFilter, @Nullable NominalType pathContext) { this.dfs = dfs; this.typeRegistry = typeRegistry; this.jsTypeRegistry = jsTypeRegistry; this.nodeLibrary = nodeLibrary; this.namingConvention = namingConvention; this.pathContext = Optional.ofNullable(pathContext); this.typeContext = typeContext; this.urlTemplate = urlTemplate; this.typeNameFilter = typeNameFilter; }
Example #4
Source File: RenderDocumentationTaskSupplier.java From js-dossier with Apache License 2.0 | 6 votes |
NominalTypeProcessor( @Provided LinkFactoryBuilder linkFactoryBuilder, @Provided DossierFileSystem dfs, @Provided CommentParser parser, @Provided TypeRegistry typeRegistry, @Provided JSTypeRegistry jsTypeRegistry, @Provided StaticTypedScope globalScope, @Provided TypeExpressionParserFactory expressionParserFactory, @Provided TypeInspectorFactory typeInspectorFactory, @Provided IndexBuilder typeIndex, NominalType type) { this.dfs = dfs; this.parser = parser; this.typeRegistry = typeRegistry; this.jsRegistry = jsTypeRegistry; this.globalScope = globalScope; this.expressionParserFactory = expressionParserFactory; this.linkFactory = linkFactoryBuilder.create(type).withTypeContext(type); this.typeInspector = typeInspectorFactory.create(type); this.type = type; this.indexReference = updateTypeIndex(typeIndex); }
Example #5
Source File: Publisher.java From curiostack with MIT License | 5 votes |
public Publisher( @Provided PublisherFutureStub stub, @Provided Tracing tracing, PublisherOptions options) { this.stub = checkNotNull(stub, "stub"); this.options = checkNotNull(options, "options"); checkNotNull(tracing, "tracing"); tracer = tracing.tracer(); traceInjector = tracing.propagation().injector(PubsubMessage.Builder::putAttributes); }
Example #6
Source File: MultipleFactoriesConflictingParameterNames.java From auto with Apache License 2.0 | 5 votes |
@AutoFactory MultipleFactoriesConflictingParameterNames( @Provided String string, @Provided Object duplicatedKey_nameDoesntMatter, @Provided Provider<Object> duplicatedKeyProvider_nameDoesntMatter, // used to disambiguate with the second constructor since qualifiers aren't part of the type // system Object unused) {}
Example #7
Source File: SimpleClassNullableParameters.java From auto with Apache License 2.0 | 5 votes |
SimpleClassNullableParameters( @Nullable String nullable, @Nullable @AQualifier String qualifiedNullable, @Nullable @Provided String providedNullable, @Nullable @Provided @BQualifier String providedQualifiedNullable) { this.nullable = nullable; this.qualifiedNullable = qualifiedNullable; this.providedNullable = providedNullable; this.providedQualifiedNullable = providedQualifiedNullable; }
Example #8
Source File: MultipleProvidedParamsSameKey.java From auto with Apache License 2.0 | 5 votes |
public MultipleProvidedParamsSameKey( @Provided String one, @Provided String two, @Nullable @Provided String three, @Provided Provider<String> providerOne, @Provided Provider<String> providerTwo) { this.one = one; this.two = two; this.three = three; this.providerOne = providerOne; this.providerTwo = providerTwo; }
Example #9
Source File: SimpleClassProvidedDeps.java From auto with Apache License 2.0 | 5 votes |
SimpleClassProvidedDeps( @Provided @AQualifier int providedPrimitiveA, @Provided @BQualifier int providedPrimitiveB, @Provided @AQualifier String providedDepA, @Provided @BQualifier String providedDepB) { this.providedPrimitiveA = providedPrimitiveA; this.providedPrimitiveB = providedPrimitiveB; this.providedDepA = providedDepA; this.providedDepB = providedDepB; }
Example #10
Source File: FactoryDescriptorGenerator.java From auto with Apache License 2.0 | 5 votes |
FactoryMethodDescriptor generateDescriptorForConstructor(final AutoFactoryDeclaration declaration, ExecutableElement constructor) { checkNotNull(constructor); checkArgument(constructor.getKind() == ElementKind.CONSTRUCTOR); TypeElement classElement = MoreElements.asType(constructor.getEnclosingElement()); ImmutableListMultimap<Boolean, ? extends VariableElement> parameterMap = Multimaps.index(constructor.getParameters(), Functions.forPredicate( new Predicate<VariableElement>() { @Override public boolean apply(VariableElement parameter) { return isAnnotationPresent(parameter, Provided.class); } })); ImmutableSet<Parameter> providedParameters = Parameter.forParameterList(parameterMap.get(true), types); ImmutableSet<Parameter> passedParameters = Parameter.forParameterList(parameterMap.get(false), types); return FactoryMethodDescriptor.builder(declaration) .name("create") .returnType(classElement.asType()) .publicMethod(classElement.getModifiers().contains(PUBLIC)) .providedParameters(providedParameters) .passedParameters(passedParameters) .creationParameters(Parameter.forParameterList(constructor.getParameters(), types)) .isVarArgs(constructor.isVarArgs()) .build(); }
Example #11
Source File: RenderMarkdownTask.java From js-dossier with Apache License 2.0 | 5 votes |
RenderMarkdownTask( @Provided DossierFileSystem dfs, @Provided CommentParser parser, @Provided LinkFactoryBuilder linkFactoryBuilder, @Provided PageRenderer renderer, MarkdownPage page) { this.dfs = dfs; this.renderer = renderer; this.linkFactory = linkFactoryBuilder.create(null); this.page = page; this.parser = parser; }
Example #12
Source File: TypeExpressionParser.java From js-dossier with Apache License 2.0 | 5 votes |
TypeExpressionParser( @Provided DossierFileSystem dfs, @Provided TypeRegistry typeRegistry, @Provided JSTypeRegistry jsTypeRegistry, @Provided NodeLibrary nodeLibrary, LinkFactory linkFactory) { this.dfs = dfs; this.typeRegistry = typeRegistry; this.jsTypeRegistry = jsTypeRegistry; this.nodeLibrary = nodeLibrary; this.linkFactory = linkFactory; }
Example #13
Source File: TypeInspector.java From js-dossier with Apache License 2.0 | 5 votes |
TypeInspector( @Provided DossierFileSystem dfs, @Provided CommentParser parser, @Provided TypeRegistry registry, @Provided StaticTypedScope globalScope, @Provided JSTypeRegistry jsRegistry, @Provided @TypeFilter Predicate<String> typeFilter, @Provided TypeExpressionParserFactory expressionParserFactory, @Provided LinkFactoryBuilder linkFactoryBuilder, NominalType inspectedType) { this.dfs = dfs; this.parser = parser; this.registry = registry; this.globalScope = globalScope; this.jsRegistry = jsRegistry; this.expressionParserFactory = expressionParserFactory; this.typeFilter = typeFilter; this.linkFactory = linkFactoryBuilder.create(inspectedType); this.inspectedType = inspectedType; JSType type = inspectedType.getType(); if (type.isConstructor() || type.isInterface()) { type = type.toMaybeFunctionType().getInstanceType(); } else { type = jsRegistry.getNativeType(JSTypeNative.UNKNOWN_TYPE); } typeMapReplacer = TemplateTypeReplacer.forPartialReplacement(jsRegistry, type.getTemplateTypeMap()); }
Example #14
Source File: RenderSourceFileTask.java From js-dossier with Apache License 2.0 | 5 votes |
RenderSourceFileTask( @Provided DossierFileSystem dfs, @Provided IndexBuilder index, @Provided PageRenderer renderer, @Provided @SourcePrefix Path prefix, Path path) { this.dfs = dfs; this.index = index; this.renderer = renderer; this.prefix = prefix; this.path = path; }
Example #15
Source File: RenderDocumentationTaskSupplier.java From js-dossier with Apache License 2.0 | 5 votes |
RenderDocumentationTaskSupplier( @Provided RenderDocumentationTaskSupplier_NominalTypeProcessorFactory processorFactory, @Provided RenderDocumentationTaskSupplier_RenderDocumentationTaskFactory renderTaskFactory, ImmutableList<NominalType> types) { this.processorFactory = processorFactory; this.renderTaskFactory = renderTaskFactory; this.types = types; }
Example #16
Source File: GitRepo.java From startup-os with Apache License 2.0 | 5 votes |
GitRepo(@Provided FileUtils fileUtils, String repoPath) { this.fileUtils = fileUtils; this.repoPath = repoPath; gitCommandBase = Arrays.asList( "git", "--git-dir=" + fileUtils.joinToAbsolutePath(repoPath, ".git"), "--work-tree=" + repoPath); }
Example #17
Source File: Subscriber.java From curiostack with MIT License | 5 votes |
public Subscriber( @Provided SubscriberStub stub, @Provided Optional<MeterRegistry> meterRegistry, @Provided Tracing tracing, SubscriberOptions options) { this.stub = options.getUnsafeWrapBuffers() ? Clients.newDerivedClient( stub, GrpcClientOptions.UNSAFE_WRAP_RESPONSE_BUFFERS.newValue(true)) : stub; this.options = options; MeterRegistry registry = meterRegistry.orElse(NoopMeterRegistry.get()); List<Tag> tags = ImmutableList.of(Tag.of("subscription", options.getSubscription())); receivedMessages = registry.counter("subscriber-received-messages", tags); ackedMessages = registry.counter("subscriber-acked-messages", tags); nackedMessages = registry.counter("subscriber-nacked-messages", tags); registry.gauge("reconnect-backoff-millis", tags, streamReconnectBackoff, Duration::toMillis); messageProcessingTime = MoreMeters.newTimer(registry, "subscriber-message-processing-time", tags); tracer = tracing.tracer(); traceExtractor = tracing .propagation() .extractor((message, key) -> message.getAttributesOrDefault(key, null)); }
Example #18
Source File: JwtVerifier.java From curiostack with MIT License | 5 votes |
public JwtVerifier( @Provided PublicKeysManager.Factory publicKeysManagerFactory, Algorithm algorithm, String publicKeysUrl) { this.algorithm = algorithm; publicKeysManager = publicKeysManagerFactory.create(publicKeysUrl); }
Example #19
Source File: LocationProvider.java From open-location-code with Apache License 2.0 | 5 votes |
@AutoFactory public LocationProvider( @Provided GoogleApiAvailability googleApiAvailability, @Provided GoogleApiClient googleApiClient, @Provided FusedLocationProviderApi fusedLocationProviderApi, @Provided LocationManager locationManager, @Provided SensorManager sensorManager, @Provided Display displayManager, Context context, LocationCallback locationCallback) { this.mGoogleApiAvailability = googleApiAvailability; this.mGoogleApiClient = googleApiClient; this.mFusedLocationProviderApi = fusedLocationProviderApi; this.mLocationManager = locationManager; this.mContext = context; this.mLocationCallback = locationCallback; this.mSensorManager = sensorManager; this.mDisplay = displayManager; mLocationRequest = LocationRequest.create() .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY) .setInterval(INTERVAL_IN_MS) .setFastestInterval(FASTEST_INTERVAL_IN_MS); mNetworkLocationListener = createLocationListener(); mGpsLocationListener = createLocationListener(); determineIfUsingGms(); if (isUsingGms()) { mGoogleApiClient.registerConnectionCallbacks(this); mGoogleApiClient.registerConnectionFailedListener(this); } }
Example #20
Source File: RenamingEditor.java From MOE with Apache License 2.0 | 5 votes |
RenamingEditor( @Provided FileSystem filesystem, @Provided Gson gson, String name, EditorConfig config) { this.filesystem = filesystem; this.editorName = name; if (config.mappings() == null) { throw new MoeProblem("No mappings object found in the config for editor %s", editorName); } regexMappings = mappingsFromConfig(gson, config); this.useRegex = config.useRegex(); }
Example #21
Source File: PatchingEditor.java From MOE with Apache License 2.0 | 5 votes |
PatchingEditor( @Provided CommandRunner cmd, @Provided FileSystem filesystem, String editorName, @SuppressWarnings("unused") EditorConfig ignored) { this.cmd = cmd; this.filesystem = filesystem; name = editorName; }
Example #22
Source File: ShellEditor.java From MOE with Apache License 2.0 | 5 votes |
ShellEditor( @Provided CommandRunner cmd, @Provided FileSystem filesystem, String name, EditorConfig config) { this.cmd = cmd; this.filesystem = filesystem; this.name = name; this.commandString = config.commandString(); }
Example #23
Source File: MixedDepsImplementingInterfaces.java From auto with Apache License 2.0 | 4 votes |
@AutoFactory(implementing = {FromInt.class, MarkerA.class}) MixedDepsImplementingInterfaces(@Provided String s, int i) {}
Example #24
Source File: MultipleFactoriesConflictingParameterNames.java From auto with Apache License 2.0 | 4 votes |
@AutoFactory MultipleFactoriesConflictingParameterNames( @Provided @AQualifier String string, @Provided @AQualifier Object qualifiedDuplicatedKey_nameDoesntMatter, @Provided @AQualifier Provider<Object> qualifiedDuplicatedKeyProvider_nameDoesntMatter) {}
Example #25
Source File: SimpleClassMixedDeps.java From auto with Apache License 2.0 | 4 votes |
SimpleClassMixedDeps(@Provided @AQualifier String providedDepA, String depB) { this.providedDepA = providedDepA; this.depB = depB; }
Example #26
Source File: ClassUsingQualifierWithArgs.java From auto with Apache License 2.0 | 4 votes |
ClassUsingQualifierWithArgs( @Provided @QualifierWithArgs(name = "Fred", count = 3) String providedDepA) { this.providedDepA = providedDepA; }
Example #27
Source File: JwtAuthorizer.java From curiostack with MIT License | 4 votes |
public JwtAuthorizer( @Provided JwtVerifier.Factory verifier, Algorithm algorithm, String publicKeysUrl) { this.verifier = verifier.create(algorithm, publicKeysUrl); }
Example #28
Source File: FactoryImplementingGenericInterfaceExtension.java From auto with Apache License 2.0 | 4 votes |
@AutoFactory(implementing = MyFactory.class) FactoryImplementingGenericInterfaceExtension(@Provided String s, Integer i) {}
Example #29
Source File: CustomNullable.java From auto with Apache License 2.0 | 4 votes |
CustomNullable( @CustomNullable.Nullable String string, @CustomNullable.Nullable @Provided Object object) { this.string = string; this.object = object; }
Example #30
Source File: RenderResourceTask.java From js-dossier with Apache License 2.0 | 4 votes |
RenderResourceTask(@Provided DossierFileSystem dfs, TemplateFile file) { this.dfs = dfs; this.file = file; }