@ProvidesIntoSet Feature exceptionMappersFeature() { return (context) -> { context.register(RuntimeExceptionMapper.class); context.register(WebApplicationExceptionMapper.class); return true; }; }
@ProvidesIntoSet Feature customFeature() { return (context) -> { context.register(xPoweredByFilter()); context.register(requestLoggerFilter()); return true; }; }
@ProvidesIntoSet HealthDependency getDependency2() { return new ImportantHealthDependency2(); }
@ProvidesIntoSet @ResourceTwoFeature SerializationFeatureFlag getSerializationFeature() { return SerializationFeatureFlag.create(SerializationFeature.INDENT_OUTPUT, true); }
@ProvidesIntoSet @TestBindingAnnotation Module getModule() { return new TestModule(); }
@ProvidesIntoSet @TestBindingAnnotation SerializationFeatureFlag getSerializationFeature() { return SerializationFeatureFlag.create(SerializationFeature.CLOSE_CLOSEABLE, true); }
@ProvidesIntoSet @TestBindingAnnotation SerializationFeatureFlag getSerializationFeature2() { return SerializationFeatureFlag.create(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); }
@ProvidesIntoSet @TestBindingAnnotation SerializationFeatureFlag getSerializationFeature3() { return SerializationFeatureFlag .create(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false); }
@ProvidesIntoSet @TestBindingAnnotation DeserializationFeatureFlag getDeserializationFeature() { return DeserializationFeatureFlag .create(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, true); }
@ProvidesIntoSet @TestBindingAnnotation MapperFeatureFlag getMapperFeature() { return MapperFeatureFlag.create(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); }
@ProvidesIntoSet @TestBindingAnnotation JsonGeneratorFeatureFlag getJsonGeneratorFeature() { return JsonGeneratorFeatureFlag.create(JsonGenerator.Feature.QUOTE_FIELD_NAMES, true); }
@ProvidesIntoSet @TestBindingAnnotation JsonParserFeatureFlag getJsonParserFeature() { return JsonParserFeatureFlag.create(JsonParser.Feature.ALLOW_COMMENTS, true); }
@ProvidesIntoSet HealthDependency provideMyHealthDependency1() { return new HealthDependency1(); }
@ProvidesIntoSet HealthDependency provideMyHealthDependency2() { return new HealthDependency2(); }
@ProvidesIntoSet HealthDependency provideMyHealthDependency3() { return new HealthDependency3(); }
@ProvidesIntoSet SerializationFeatureFlag getSerializationFeature() { return SerializationFeatureFlag.create(SerializationFeature.CLOSE_CLOSEABLE, true); }
@ProvidesIntoSet SerializationFeatureFlag getSerializationFeature2() { return SerializationFeatureFlag.create(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true); }
@ProvidesIntoSet SerializationFeatureFlag getSerializationFeature3() { return SerializationFeatureFlag.create(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false); }
@ProvidesIntoSet DeserializationFeatureFlag getDeserializationFeature() { return DeserializationFeatureFlag.create(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, true); }
@ProvidesIntoSet MapperFeatureFlag getMapperFeature() { return MapperFeatureFlag.create(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); }
@ProvidesIntoSet JsonGeneratorFeatureFlag getJsonGeneratorFeature() { return JsonGeneratorFeatureFlag.create(JsonGenerator.Feature.QUOTE_FIELD_NAMES, true); }
@ProvidesIntoSet JsonParserFeatureFlag getJsonParserFeature() { return JsonParserFeatureFlag.create(JsonParser.Feature.ALLOW_COMMENTS, true); }
@ProvidesIntoSet Class<? extends Feature> jacksonFeature() { return JsonJacksonFeature.class; }
@ProvidesIntoSet Class<? extends Feature> boundWebResourcesFeature() { return BoundWebResourcesFeature.class; }
@ProvidesIntoSet public static Procedure getKillQueryProcedure(KillQueryProcedure procedure) { return procedure.getProcedure(); }
@SuppressWarnings({"unchecked", "rawtypes"}) // mapKey doesn't know its key type @Override public <T> Key<T> prepareMethod( Binder binder, Annotation annotation, Key<T> key, InjectionPoint injectionPoint) { Method method = (Method) injectionPoint.getMember(); AnnotationOrError mapKey = findMapKeyAnnotation(binder, method); if (annotation instanceof Provides) { if (mapKey.annotation != null) { binder.addError("Found a MapKey annotation on non map binding at %s.", method); } // no key rewriting for plain old @Provides return key; } if (annotation instanceof ProvidesIntoSet) { if (mapKey.annotation != null) { binder.addError("Found a MapKey annotation on non map binding at %s.", method); } return RealMultibinder.newRealSetBinder(binder, key).getKeyForNewItem(); } else if (annotation instanceof ProvidesIntoMap) { if (mapKey.error) { // Already failed on the MapKey, don't bother doing more work. return key; } if (mapKey.annotation == null) { // If no MapKey, make an error and abort. binder.addError("No MapKey found for map binding at %s.", method); return key; } TypeAndValue typeAndValue = typeAndValueOfMapKey(mapKey.annotation); return RealMapBinder.newRealMapBinder(binder, typeAndValue.type, key) .getKeyForNewValue(typeAndValue.value); } else if (annotation instanceof ProvidesIntoOptional) { if (mapKey.annotation != null) { binder.addError("Found a MapKey annotation on non map binding at %s.", method); } switch (((ProvidesIntoOptional) annotation).value()) { case DEFAULT: return RealOptionalBinder.newRealOptionalBinder(binder, key).getKeyForDefaultBinding(); case ACTUAL: return RealOptionalBinder.newRealOptionalBinder(binder, key).getKeyForActualBinding(); } } throw new IllegalStateException("Invalid annotation: " + annotation); }