From 01cb90387058204ed40430a84e2710e07297296c Mon Sep 17 00:00:00 2001 From: jansupol <15908245+jansupol@users.noreply.github.com> Date: Mon, 24 Jun 2019 15:50:24 +0200 Subject: [PATCH] Rename ParameterInserters to ParameterUpdaters (#4170) * Rename ParameterInserters to ParameterUpdaters to better fit the functionality name Signed-off-by: Jan Supol --- .../jersey/client/ClientBootstrapBag.java | 15 +++---- .../glassfish/jersey/client/ClientConfig.java | 6 +-- ...terInserter.java => ParameterUpdater.java} | 12 +++--- ...der.java => ParameterUpdaterProvider.java} | 14 +++---- ...er.java => AbstractParamValueUpdater.java} | 26 ++++++------ ...onInserter.java => CollectionUpdater.java} | 42 +++++++++---------- ...java => ParameterUpdaterConfigurator.java} | 18 ++++---- ...tory.java => ParameterUpdaterFactory.java} | 38 ++++++++--------- ...er.java => PrimitiveCharacterUpdater.java} | 12 +++--- ...rter.java => PrimitiveValueOfUpdater.java} | 18 ++++---- ...ter.java => SingleStringValueUpdater.java} | 18 ++++---- ...eInserter.java => SingleValueUpdater.java} | 22 +++++----- .../client/internal/localization.properties | 4 +- ...erException.java => UpdaterException.java} | 10 ++--- .../restclient/InterfaceModel.java | 19 ++++----- 15 files changed, 137 insertions(+), 137 deletions(-) rename core-client/src/main/java/org/glassfish/jersey/client/inject/{ParameterInserter.java => ParameterUpdater.java} (83%) rename core-client/src/main/java/org/glassfish/jersey/client/inject/{ParameterInserterProvider.java => ParameterUpdaterProvider.java} (75%) rename core-client/src/main/java/org/glassfish/jersey/client/internal/inject/{AbstractParamValueInserter.java => AbstractParamValueUpdater.java} (82%) rename core-client/src/main/java/org/glassfish/jersey/client/internal/inject/{CollectionInserter.java => CollectionUpdater.java} (77%) rename core-client/src/main/java/org/glassfish/jersey/client/internal/inject/{ParameterInserterConfigurator.java => ParameterUpdaterConfigurator.java} (75%) rename core-client/src/main/java/org/glassfish/jersey/client/internal/inject/{ParameterInserterFactory.java => ParameterUpdaterFactory.java} (79%) rename core-client/src/main/java/org/glassfish/jersey/client/internal/inject/{PrimitiveCharacterInserter.java => PrimitiveCharacterUpdater.java} (77%) rename core-client/src/main/java/org/glassfish/jersey/client/internal/inject/{PrimitiveValueOfInserter.java => PrimitiveValueOfUpdater.java} (78%) rename core-client/src/main/java/org/glassfish/jersey/client/internal/inject/{SingleStringValueInserter.java => SingleStringValueUpdater.java} (78%) rename core-client/src/main/java/org/glassfish/jersey/client/internal/inject/{SingleValueInserter.java => SingleValueUpdater.java} (74%) rename core-common/src/main/java/org/glassfish/jersey/internal/inject/{InserterException.java => UpdaterException.java} (84%) diff --git a/core-client/src/main/java/org/glassfish/jersey/client/ClientBootstrapBag.java b/core-client/src/main/java/org/glassfish/jersey/client/ClientBootstrapBag.java index 3c858557b0..ced406a7d2 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/ClientBootstrapBag.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/ClientBootstrapBag.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2018 Payara Foundation and/or its affiliates. All rights reserved. + * Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -17,7 +18,7 @@ import org.glassfish.jersey.internal.BootstrapBag; -import org.glassfish.jersey.client.inject.ParameterInserterProvider; +import org.glassfish.jersey.client.inject.ParameterUpdaterProvider; /** * {@inheritDoc} @@ -28,14 +29,14 @@ */ public class ClientBootstrapBag extends BootstrapBag { - private ParameterInserterProvider parameterInserterProvider; + private ParameterUpdaterProvider parameterUpdaterProvider; - public ParameterInserterProvider getParameterInserterProvider() { - requireNonNull(parameterInserterProvider, ParameterInserterProvider.class); - return parameterInserterProvider; + public ParameterUpdaterProvider getParameterUpdaterProvider() { + requireNonNull(parameterUpdaterProvider, ParameterUpdaterProvider.class); + return parameterUpdaterProvider; } - public void setParameterInserterProvider(ParameterInserterProvider provider) { - this.parameterInserterProvider = provider; + public void setParameterUpdaterProvider(ParameterUpdaterProvider provider) { + this.parameterUpdaterProvider = provider; } } diff --git a/core-client/src/main/java/org/glassfish/jersey/client/ClientConfig.java b/core-client/src/main/java/org/glassfish/jersey/client/ClientConfig.java index bf0e4ee41c..29089e1d76 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/ClientConfig.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/ClientConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the @@ -35,7 +35,7 @@ import org.glassfish.jersey.CommonProperties; import org.glassfish.jersey.ExtendedConfig; import org.glassfish.jersey.client.internal.LocalizationMessages; -import org.glassfish.jersey.client.internal.inject.ParameterInserterConfigurator; +import org.glassfish.jersey.client.internal.inject.ParameterUpdaterConfigurator; import org.glassfish.jersey.client.spi.Connector; import org.glassfish.jersey.client.spi.ConnectorProvider; import org.glassfish.jersey.internal.AutoDiscoverableConfigurator; @@ -416,7 +416,7 @@ private ClientRuntime initRuntime() { bootstrapBag.setManagedObjectsFinalizer(new ManagedObjectsFinalizer(injectionManager)); List bootstrapConfigurators = Arrays.asList(new RequestScope.RequestScopeConfigurator(), new ParamConverterConfigurator(), - new ParameterInserterConfigurator(), + new ParameterUpdaterConfigurator(), new RuntimeConfigConfigurator(runtimeCfgState), new ContextResolverFactory.ContextResolversConfigurator(), new MessageBodyFactory.MessageBodyWorkersConfigurator(), diff --git a/core-client/src/main/java/org/glassfish/jersey/client/inject/ParameterInserter.java b/core-client/src/main/java/org/glassfish/jersey/client/inject/ParameterUpdater.java similarity index 83% rename from core-client/src/main/java/org/glassfish/jersey/client/inject/ParameterInserter.java rename to core-client/src/main/java/org/glassfish/jersey/client/inject/ParameterUpdater.java index 8b94e6112a..3d2461a3fd 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/inject/ParameterInserter.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/inject/ParameterUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the @@ -28,12 +28,12 @@ * @author Marek Potociar (marek.potociar at oracle.com) * @author Gaurav Gupta (gaurav.gupta@payara.fish) */ -public interface ParameterInserter { +public interface ParameterUpdater { /** - * Name of the parameter to be inserted + * Name of the parameter to be udpated * - * @return name of the inserted parameter. + * @return name of the updated parameter. */ String getName(); @@ -45,11 +45,11 @@ public interface ParameterInserter { String getDefaultValueString(); /** - * Insert the value using ParamConverter#toString (and using + * Update the value using ParamConverter#toString (and using * the configured {@link #getDefaultValueString() default value}) * * @param parameters custom Java type instance value. * @return converted value. */ - R insert(T parameters); + R update(T parameters); } diff --git a/core-client/src/main/java/org/glassfish/jersey/client/inject/ParameterInserterProvider.java b/core-client/src/main/java/org/glassfish/jersey/client/inject/ParameterUpdaterProvider.java similarity index 75% rename from core-client/src/main/java/org/glassfish/jersey/client/inject/ParameterInserterProvider.java rename to core-client/src/main/java/org/glassfish/jersey/client/inject/ParameterUpdaterProvider.java index 4b29d6a8ee..f52508e227 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/inject/ParameterInserterProvider.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/inject/ParameterUpdaterProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the @@ -20,22 +20,22 @@ import org.glassfish.jersey.model.Parameter; /** - * Provider of parameter inserter. + * Provider of parameter updater. * * @author Paul Sandoz * @author Marek Potociar (marek.potociar at oracle.com) * @author Gaurav Gupta (gaurav.gupta@payara.fish) */ -public interface ParameterInserterProvider { +public interface ParameterUpdaterProvider { /** - * Get the inserter configured to insert value of given {@link Parameter parameter}. + * Get the updater configured to update value of given {@link Parameter parameter}. *

* If the default value has been set on the parameter, it will be configured - * in the inserter. + * in the updater. * * @param parameter client model parameter. - * @return inserter for the method parameter. + * @return updater for the method parameter. */ - ParameterInserter get(Parameter parameter); + ParameterUpdater get(Parameter parameter); } diff --git a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/AbstractParamValueInserter.java b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/AbstractParamValueUpdater.java similarity index 82% rename from core-client/src/main/java/org/glassfish/jersey/client/internal/inject/AbstractParamValueInserter.java rename to core-client/src/main/java/org/glassfish/jersey/client/internal/inject/AbstractParamValueUpdater.java index 28d508b480..fb56ed76d0 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/AbstractParamValueInserter.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/AbstractParamValueUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the @@ -20,19 +20,19 @@ import javax.ws.rs.WebApplicationException; import javax.ws.rs.ext.ParamConverter; -import org.glassfish.jersey.internal.inject.InserterException; +import org.glassfish.jersey.internal.inject.UpdaterException; import org.glassfish.jersey.internal.util.collection.UnsafeValue; import org.glassfish.jersey.internal.util.collection.Values; /** - * Abstract base class for implementing parameter value inserter + * Abstract base class for implementing parameter value updater * logic supplied using {@link ParamConverter parameter converters}. * * @author Paul Sandoz * @author Marek Potociar (marek.potociar at oracle.com) * @author Gaurav Gupta (gaurav.gupta@payara.fish) */ -abstract class AbstractParamValueInserter { +abstract class AbstractParamValueUpdater { private final ParamConverter paramConverter; private final String parameterName; @@ -40,13 +40,13 @@ abstract class AbstractParamValueInserter { private final UnsafeValue convertedDefaultValue; /** - * Constructor that initializes parameter inserter. + * Constructor that initializes parameter updater. * * @param converter parameter converter. * @param parameterName name of the parameter. * @param defaultValueString default parameter value string. */ - protected AbstractParamValueInserter(ParamConverter converter, String parameterName, final String defaultValue) { + protected AbstractParamValueUpdater(ParamConverter converter, String parameterName, final String defaultValue) { this.paramConverter = converter; this.parameterName = parameterName; this.defaultValue = defaultValue; @@ -69,7 +69,7 @@ public String get() throws RuntimeException { } /** - * Get the name of the parameter this inserter belongs to. + * Get the name of the parameter this updater belongs to. * * @return parameter name. */ @@ -87,17 +87,17 @@ public String getDefaultValueString() { } /** - * Insert parameter value to string using the configured {@link ParamConverter parameter converter}. + * Update parameter value to string using the configured {@link ParamConverter parameter converter}. * * A {@link WebApplicationException} / {@link IllegalArgumentException} thrown * from the converter is propagated unchanged. Any other exception throws by - * the converter is wrapped in a new {@link InserterException} before rethrowing. + * the converter is wrapped in a new {@link UpdaterException} before rethrowing. * - * @param value parameter value to be converted/inserted. - * @return inserted value of a given Java type. + * @param value parameter value to be converted/updated. + * @return updated value of a given Java type. * @throws WebApplicationException in case the underlying parameter converter throws * a {@code WebApplicationException}. The exception is rethrown without a change. - * @throws InserterException wrapping any other exception thrown by the parameter converter. + * @throws UpdaterException wrapping any other exception thrown by the parameter converter. */ protected final String toString(T value) { String result = convert(value); @@ -113,7 +113,7 @@ private String convert(T value) { } catch (WebApplicationException | IllegalArgumentException ex) { throw ex; } catch (Exception ex) { - throw new InserterException(ex); + throw new UpdaterException(ex); } } diff --git a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/CollectionInserter.java b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/CollectionUpdater.java similarity index 77% rename from core-client/src/main/java/org/glassfish/jersey/client/internal/inject/CollectionInserter.java rename to core-client/src/main/java/org/glassfish/jersey/client/internal/inject/CollectionUpdater.java index 0902d763b0..ef1ab8ef6a 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/CollectionInserter.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/CollectionUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the @@ -29,35 +29,35 @@ import javax.ws.rs.ProcessingException; import javax.ws.rs.ext.ParamConverter; import org.glassfish.jersey.client.internal.LocalizationMessages; -import org.glassfish.jersey.client.inject.ParameterInserter; +import org.glassfish.jersey.client.inject.ParameterUpdater; /** - * Insert parameter value as a typed collection. + * Update parameter value as a typed collection. * * @param parameter value type. * @author Paul Sandoz * @author Marek Potociar (marek.potociar at oracle.com) * @author Gaurav Gupta (gaurav.gupta@payara.fish) */ -abstract class CollectionInserter extends AbstractParamValueInserter - implements ParameterInserter, Collection> { +abstract class CollectionUpdater extends AbstractParamValueUpdater + implements ParameterUpdater, Collection> { /** - * Create new collection parameter inserter. + * Create new collection parameter updater. * * @param converter parameter converter to be used to convert parameter from a custom Java type. * @param parameterName parameter name. * @param defaultValue default parameter String value. */ - protected CollectionInserter(final ParamConverter converter, - final String parameterName, - final String defaultValue) { + protected CollectionUpdater(final ParamConverter converter, + final String parameterName, + final String defaultValue) { super(converter, parameterName, defaultValue); } @Override @SuppressWarnings("unchecked") - public Collection insert(final Collection values) { + public Collection update(final Collection values) { Collection results = Collections.EMPTY_LIST; if (values != null) { results = values @@ -71,7 +71,7 @@ public Collection insert(final Collection values) { } /** - * Get a new collection instance that will be used to store the inserted parameters. + * Get a new collection instance that will be used to store the updated parameters. *

* The method is overridden by concrete implementations to return an instance * of a proper collection sub-type. @@ -80,7 +80,7 @@ public Collection insert(final Collection values) { */ protected abstract Collection newCollection(); - private static final class ListValueOf extends CollectionInserter { + private static final class ListValueOf extends CollectionUpdater { ListValueOf(final ParamConverter converter, final String parameter, final String defaultValue) { super(converter, parameter, defaultValue); @@ -92,7 +92,7 @@ protected List newCollection() { } } - private static final class SetValueOf extends CollectionInserter { + private static final class SetValueOf extends CollectionUpdater { SetValueOf(final ParamConverter converter, final String parameter, final String defaultValue) { super(converter, parameter, defaultValue); @@ -104,7 +104,7 @@ protected Set newCollection() { } } - private static final class SortedSetValueOf extends CollectionInserter { + private static final class SortedSetValueOf extends CollectionUpdater { SortedSetValueOf(final ParamConverter converter, final String parameter, final String defaultValue) { super(converter, parameter, defaultValue); @@ -117,7 +117,7 @@ protected SortedSet newCollection() { } /** - * Get a new {@code CollectionInserter} instance. + * Get a new {@code CollectionUpdater} instance. * * @param collectionType raw collection type. * @param converter parameter converter to be used to convert parameter Java type values into @@ -125,12 +125,12 @@ protected SortedSet newCollection() { * @param parameterName parameter name. * @param defaultValue default parameter string value. * @param converted parameter Java type. - * @return new collection parameter inserter instance. + * @return new collection parameter updated instance. */ - public static CollectionInserter getInstance(final Class collectionType, - final ParamConverter converter, - final String parameterName, - final String defaultValue) { + public static CollectionUpdater getInstance(final Class collectionType, + final ParamConverter converter, + final String parameterName, + final String defaultValue) { if (List.class == collectionType) { return new ListValueOf<>(converter, parameterName, defaultValue); } else if (Set.class == collectionType) { @@ -138,7 +138,7 @@ public static CollectionInserter getInstance(final Class collectionType, } else if (SortedSet.class == collectionType) { return new SortedSetValueOf<>(converter, parameterName, defaultValue); } else { - throw new ProcessingException(LocalizationMessages.COLLECTION_INSERTER_TYPE_UNSUPPORTED()); + throw new ProcessingException(LocalizationMessages.COLLECTION_UPDATER_TYPE_UNSUPPORTED()); } } } diff --git a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/ParameterInserterConfigurator.java b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/ParameterUpdaterConfigurator.java similarity index 75% rename from core-client/src/main/java/org/glassfish/jersey/client/internal/inject/ParameterInserterConfigurator.java rename to core-client/src/main/java/org/glassfish/jersey/client/internal/inject/ParameterUpdaterConfigurator.java index a75a272f89..ed24fa7f10 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/ParameterInserterConfigurator.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/ParameterUpdaterConfigurator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the @@ -29,30 +29,30 @@ import org.glassfish.jersey.internal.util.collection.LazyValue; import org.glassfish.jersey.internal.util.collection.Value; import org.glassfish.jersey.internal.util.collection.Values; -import org.glassfish.jersey.client.inject.ParameterInserterProvider; +import org.glassfish.jersey.client.inject.ParameterUpdaterProvider; /** - * Configurator which initializes and register {@link ParameterInserterProvider} instance into + * Configurator which initializes and register {@link ParameterUpdaterProvider} instance into * {@link InjectionManager}. * * @author Petr Bouda * @author Gaurav Gupta (gaurav.gupta@payara.fish) */ -public class ParameterInserterConfigurator implements BootstrapConfigurator { +public class ParameterUpdaterConfigurator implements BootstrapConfigurator { @Override public void init(InjectionManager injectionManager, BootstrapBag bootstrapBag) { ClientBootstrapBag clientBag = (ClientBootstrapBag) bootstrapBag; - // Param Converters must be initialized Lazy and created at the time of the call on inserter + // Param Converters must be initialized Lazy and created at the time of the call on updater LazyValue lazyParamConverterFactory = Values.lazy((Value) () -> new ParamConverterFactory( Providers.getProviders(injectionManager, ParamConverterProvider.class), Providers.getCustomProviders(injectionManager, ParamConverterProvider.class))); - ParameterInserterFactory parameterInserter = new ParameterInserterFactory(lazyParamConverterFactory); - clientBag.setParameterInserterProvider(parameterInserter); - injectionManager.register(Bindings.service(parameterInserter) - .to(ParameterInserterProvider.class)); + ParameterUpdaterFactory parameterUpdaterFactory = new ParameterUpdaterFactory(lazyParamConverterFactory); + clientBag.setParameterUpdaterProvider(parameterUpdaterFactory); + injectionManager.register(Bindings.service(parameterUpdaterFactory) + .to(ParameterUpdaterProvider.class)); } } diff --git a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/ParameterInserterFactory.java b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/ParameterUpdaterFactory.java similarity index 79% rename from core-client/src/main/java/org/glassfish/jersey/client/internal/inject/ParameterInserterFactory.java rename to core-client/src/main/java/org/glassfish/jersey/client/internal/inject/ParameterUpdaterFactory.java index 9fa283ae6b..262bf3d8ef 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/ParameterInserterFactory.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/ParameterUpdaterFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the @@ -25,7 +25,7 @@ import javax.ws.rs.ProcessingException; import javax.ws.rs.ext.ParamConverter; import javax.inject.Singleton; -import org.glassfish.jersey.internal.inject.InserterException; +import org.glassfish.jersey.internal.inject.UpdaterException; import org.glassfish.jersey.internal.inject.ParamConverterFactory; import org.glassfish.jersey.internal.util.ReflectionHelper; import org.glassfish.jersey.internal.util.collection.ClassTypePair; @@ -33,36 +33,36 @@ import org.glassfish.jersey.client.internal.LocalizationMessages; import org.glassfish.jersey.model.Parameter; import org.glassfish.jersey.internal.inject.PrimitiveMapper; -import org.glassfish.jersey.client.inject.ParameterInserter; -import org.glassfish.jersey.client.inject.ParameterInserterProvider; +import org.glassfish.jersey.client.inject.ParameterUpdater; +import org.glassfish.jersey.client.inject.ParameterUpdaterProvider; /** - * Implementation of {@link ParameterInserterProvider}. For each + * Implementation of {@link ParameterUpdaterProvider}. For each * parameter, the implementation obtains a * {@link ParamConverter param converter} instance via * {@link ParamConverterFactory} and creates the proper - * {@link ParameterInserter parameter inserter}. + * {@link ParameterUpdater parameter updater}. * * @author Paul Sandoz * @author Marek Potociar (marek.potociar at oracle.com) * @author Gaurav Gupta (gaurav.gupta@payara.fish) */ @Singleton -final class ParameterInserterFactory implements ParameterInserterProvider { +final class ParameterUpdaterFactory implements ParameterUpdaterProvider { private final LazyValue paramConverterFactory; /** - * Create new parameter inserter factory. + * Create new parameter updater factory. * * @param paramConverterFactory string readers factory. */ - public ParameterInserterFactory(LazyValue paramConverterFactory) { + public ParameterUpdaterFactory(LazyValue paramConverterFactory) { this.paramConverterFactory = paramConverterFactory; } @Override - public ParameterInserter get(final Parameter p) { + public ParameterUpdater get(final Parameter p) { return process( paramConverterFactory.get(), p.getDefaultValue(), @@ -73,7 +73,7 @@ public ParameterInserterFactory(LazyValue paramConverterF } @SuppressWarnings("unchecked") - private ParameterInserter process( + private ParameterUpdater process( final ParamConverterFactory paramConverterFactory, final String defaultValue, final Class rawType, @@ -86,8 +86,8 @@ public ParameterInserterFactory(LazyValue paramConverterF ParamConverter converter = paramConverterFactory.getConverter(rawType, type, annotations); if (converter != null) { try { - return new SingleValueInserter(converter, parameterName, defaultValue); - } catch (final InserterException e) { + return new SingleValueUpdater(converter, parameterName, defaultValue); + } catch (final UpdaterException e) { throw e; } catch (final Exception e) { throw new ProcessingException(LocalizationMessages.ERROR_PARAMETER_TYPE_PROCESSING(rawType), e); @@ -109,8 +109,8 @@ public ParameterInserterFactory(LazyValue paramConverterF } if (converter != null) { try { - return CollectionInserter.getInstance(rawType, converter, parameterName, defaultValue); - } catch (final InserterException e) { + return CollectionUpdater.getInstance(rawType, converter, parameterName, defaultValue); + } catch (final UpdaterException e) { throw e; } catch (final Exception e) { throw new ProcessingException(LocalizationMessages.ERROR_PARAMETER_TYPE_PROCESSING(rawType), e); @@ -120,9 +120,9 @@ public ParameterInserterFactory(LazyValue paramConverterF // Check primitive types. if (rawType == String.class) { - return new SingleStringValueInserter(parameterName, defaultValue); + return new SingleStringValueUpdater(parameterName, defaultValue); } else if (rawType == Character.class) { - return new PrimitiveCharacterInserter(parameterName, + return new PrimitiveCharacterUpdater(parameterName, defaultValue, PrimitiveMapper.primitiveToDefaultValueMap.get(rawType)); } else if (rawType.isPrimitive()) { @@ -134,12 +134,12 @@ public ParameterInserterFactory(LazyValue paramConverterF } if (wrappedRaw == Character.class) { - return new PrimitiveCharacterInserter(parameterName, + return new PrimitiveCharacterUpdater(parameterName, defaultValue, PrimitiveMapper.primitiveToDefaultValueMap.get(wrappedRaw)); } - return new PrimitiveValueOfInserter( + return new PrimitiveValueOfUpdater( parameterName, defaultValue, PrimitiveMapper.primitiveToDefaultValueMap.get(wrappedRaw)); diff --git a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/PrimitiveCharacterInserter.java b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/PrimitiveCharacterUpdater.java similarity index 77% rename from core-client/src/main/java/org/glassfish/jersey/client/internal/inject/PrimitiveCharacterInserter.java rename to core-client/src/main/java/org/glassfish/jersey/client/internal/inject/PrimitiveCharacterUpdater.java index 5d80ec79cf..c7f67d235e 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/PrimitiveCharacterInserter.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/PrimitiveCharacterUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the @@ -17,22 +17,22 @@ package org.glassfish.jersey.client.internal.inject; -import org.glassfish.jersey.client.inject.ParameterInserter; +import org.glassfish.jersey.client.inject.ParameterUpdater; /** - * Value inserter for {@link java.lang.Character} and {@code char} parameters. + * Value updater for {@link java.lang.Character} and {@code char} parameters. * * @author Pavel Bucek (pavel.bucek at oracle.com) * @author Gaurav Gupta (gaurav.gupta@payara.fish) * */ -class PrimitiveCharacterInserter implements ParameterInserter { +class PrimitiveCharacterUpdater implements ParameterUpdater { private final String parameter; private final String defaultValue; private final Object defaultPrimitiveTypeValue; - public PrimitiveCharacterInserter(String parameter, String defaultValue, Object defaultPrimitiveTypeValue) { + public PrimitiveCharacterUpdater(String parameter, String defaultValue, Object defaultPrimitiveTypeValue) { this.parameter = parameter; this.defaultValue = defaultValue; this.defaultPrimitiveTypeValue = defaultPrimitiveTypeValue; @@ -49,7 +49,7 @@ public String getDefaultValueString() { } @Override - public String insert(Character value) { + public String update(Character value) { if (value != null) { return value.toString(); } else if (defaultValue != null) { diff --git a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/PrimitiveValueOfInserter.java b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/PrimitiveValueOfUpdater.java similarity index 78% rename from core-client/src/main/java/org/glassfish/jersey/client/internal/inject/PrimitiveValueOfInserter.java rename to core-client/src/main/java/org/glassfish/jersey/client/internal/inject/PrimitiveValueOfUpdater.java index 9c8b33c753..7cef2d0a99 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/PrimitiveValueOfInserter.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/PrimitiveValueOfUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2019 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the @@ -17,10 +17,10 @@ package org.glassfish.jersey.client.internal.inject; -import org.glassfish.jersey.client.inject.ParameterInserter; +import org.glassfish.jersey.client.inject.ParameterUpdater; /** - * Insert String value using {@code toString()} methods + * Update String value using {@code toString()} methods * on the primitive Java type wrapper classes. * * @author Paul Sandoz @@ -29,23 +29,23 @@ * @author Patrik Dudits * */ -final class PrimitiveValueOfInserter implements ParameterInserter { +final class PrimitiveValueOfUpdater implements ParameterUpdater { private final String parameter; private final String defaultValue; private final Object defaultPrimitiveTypeValue; /** - * Create new primitive parameter value inserter. + * Create new primitive parameter value updater. * * @param valueOf {@code valueOf()} method handler. * @param parameter string parameter value. * @param defaultValue default string value. * @param defaultPrimitiveTypeValue default primitive type value. */ - public PrimitiveValueOfInserter(String parameter, - String defaultValue, - Object defaultPrimitiveTypeValue) { + public PrimitiveValueOfUpdater(String parameter, + String defaultValue, + Object defaultPrimitiveTypeValue) { this.parameter = parameter; this.defaultValue = defaultValue; this.defaultPrimitiveTypeValue = defaultPrimitiveTypeValue; @@ -62,7 +62,7 @@ public String getDefaultValueString() { } @Override - public String insert(Object value) { + public String update(Object value) { if (value != null) { return value.toString(); } else if (defaultValue != null) { diff --git a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/SingleStringValueInserter.java b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/SingleStringValueUpdater.java similarity index 78% rename from core-client/src/main/java/org/glassfish/jersey/client/internal/inject/SingleStringValueInserter.java rename to core-client/src/main/java/org/glassfish/jersey/client/internal/inject/SingleStringValueUpdater.java index 03973e43b6..97e98dbc36 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/SingleStringValueInserter.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/SingleStringValueUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the @@ -17,30 +17,30 @@ package org.glassfish.jersey.client.internal.inject; -import org.glassfish.jersey.client.inject.ParameterInserter; +import org.glassfish.jersey.client.inject.ParameterUpdater; /** - * Insert value of the parameter by returning the first string parameter value + * Update value of the parameter by returning the first string parameter value * found in the list of string parameter values. *

- * This class can be seen as a special, optimized, case of {@link SingleValueInserter}. + * This class can be seen as a special, optimized, case of {@link SingleValueUpdater}. * * @author Paul Sandoz * @author Marek Potociar (marek.potociar at oracle.com) * @author Gaurav Gupta (gaurav.gupta@payara.fish) */ -final class SingleStringValueInserter implements ParameterInserter { +final class SingleStringValueUpdater implements ParameterUpdater { private final String paramName; private final String defaultValue; /** - * Create new single string value inserter. + * Create new single string value updater. * * @param parameterName string parameter name. * @param defaultValue default value. */ - public SingleStringValueInserter(String parameterName, String defaultValue) { + public SingleStringValueUpdater(String parameterName, String defaultValue) { this.paramName = parameterName; this.defaultValue = defaultValue; } @@ -63,10 +63,10 @@ public String getDefaultValueString() { * list will be ignored. * * @param parameters map of parameters. - * @return inserted single string parameter value. + * @return updated single string parameter value. */ @Override - public String insert(String value) { + public String update(String value) { return (value != null) ? value : defaultValue; } } diff --git a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/SingleValueInserter.java b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/SingleValueUpdater.java similarity index 74% rename from core-client/src/main/java/org/glassfish/jersey/client/internal/inject/SingleValueInserter.java rename to core-client/src/main/java/org/glassfish/jersey/client/internal/inject/SingleValueUpdater.java index 2ec96408a9..c2a7cd9974 100644 --- a/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/SingleValueInserter.java +++ b/core-client/src/main/java/org/glassfish/jersey/client/internal/inject/SingleValueUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the @@ -20,12 +20,12 @@ import javax.ws.rs.ProcessingException; import javax.ws.rs.WebApplicationException; import javax.ws.rs.ext.ParamConverter; -import org.glassfish.jersey.internal.inject.InserterException; -import org.glassfish.jersey.client.inject.ParameterInserter; +import org.glassfish.jersey.internal.inject.UpdaterException; +import org.glassfish.jersey.client.inject.ParameterUpdater; /** - * Insert value of the parameter using a single parameter value and the underlying + * Update value of the parameter using a single parameter value and the underlying * {@link ParamConverter param converter}. * * @param custom Java type. @@ -33,31 +33,31 @@ * @author Marek Potociar (marek.potociar at oracle.com) * @author Gaurav Gupta (gaurav.gupta@payara.fish) */ -final class SingleValueInserter extends AbstractParamValueInserter implements ParameterInserter { +final class SingleValueUpdater extends AbstractParamValueUpdater implements ParameterUpdater { /** - * Create new single value inserter. + * Create new single value updater. * * @param converter string value reader. * @param parameterName string parameter name. * @param defaultValue default value. */ - public SingleValueInserter(final ParamConverter converter, final String parameterName, final String defaultValue) { + public SingleValueUpdater(final ParamConverter converter, final String parameterName, final String defaultValue) { super(converter, parameterName, defaultValue); } /** * {@inheritDoc} *

- * This implementation inserts the value of the parameter applying the underlying + * This implementation updates the value of the parameter applying the underlying * {@link ParamConverter param converter} to the first value found in the list of potential multiple * parameter values. Any other values in the multi-value list will be ignored. * * @param parameters map of parameters. - * @return inserted single parameter value. + * @return updated single parameter value. */ @Override - public String insert(final T value){ + public String update(final T value){ try { if (value == null && isDefaultValueRegistered()) { return getDefaultValueString(); @@ -69,7 +69,7 @@ public String insert(final T value){ } catch (final IllegalArgumentException ex) { return defaultValue(); } catch (final Exception ex) { - throw new InserterException(ex); + throw new UpdaterException(ex); } } } diff --git a/core-client/src/main/resources/org/glassfish/jersey/client/internal/localization.properties b/core-client/src/main/resources/org/glassfish/jersey/client/internal/localization.properties index 43db86d06f..1a70cb3de2 100644 --- a/core-client/src/main/resources/org/glassfish/jersey/client/internal/localization.properties +++ b/core-client/src/main/resources/org/glassfish/jersey/client/internal/localization.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved. # # This program and the accompanying materials are made available under the # terms of the Eclipse Public License v. 2.0, which is available at @@ -33,7 +33,7 @@ client.target.link.null=Link to the newly created target must not be null. client.uri.template.null=URI template of the newly created target must not be null. client.uri.null=URI of the newly created target must not be null. client.uri.builder.null=URI builder of the newly created target must not be null. -collection.inserter.type.unsupported=Unsupported collection type. +collection.updater.type.unsupported=Unsupported collection type. digest.filter.qop.unsupported=The 'qop' (quality of protection) = {0} extension requested by the server is not supported by Jersey HttpDigestAuthFilter. Cannot authenticate against the server using Http Digest Authentication. error.closing.output.stream=Error when closing the output stream. error.committing.output.stream=Error while committing the request output stream. diff --git a/core-common/src/main/java/org/glassfish/jersey/internal/inject/InserterException.java b/core-common/src/main/java/org/glassfish/jersey/internal/inject/UpdaterException.java similarity index 84% rename from core-common/src/main/java/org/glassfish/jersey/internal/inject/InserterException.java rename to core-common/src/main/java/org/glassfish/jersey/internal/inject/UpdaterException.java index da80ccae8f..f07691e015 100644 --- a/core-common/src/main/java/org/glassfish/jersey/internal/inject/InserterException.java +++ b/core-common/src/main/java/org/glassfish/jersey/internal/inject/UpdaterException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2017 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018 Payara Foundation and/or its affiliates. * * This program and the accompanying materials are made available under the @@ -28,7 +28,7 @@ * @author Gaurav Gupta * */ -public class InserterException extends ProcessingException { +public class UpdaterException extends ProcessingException { private static final long serialVersionUID = -4918023257104413981L; /** @@ -36,7 +36,7 @@ public class InserterException extends ProcessingException { * * @param message exception message. */ - public InserterException(String message) { + public UpdaterException(String message) { super(message); } @@ -46,7 +46,7 @@ public InserterException(String message) { * @param message exception message. * @param cause exception cause. */ - public InserterException(String message, Throwable cause) { + public UpdaterException(String message, Throwable cause) { super(message, cause); } @@ -55,7 +55,7 @@ public InserterException(String message, Throwable cause) { * * @param cause exception cause. */ - public InserterException(Throwable cause) { + public UpdaterException(Throwable cause) { super(cause); } } diff --git a/ext/microprofile/mp-rest-client/src/main/java/org/glassfish/jersey/microprofile/restclient/InterfaceModel.java b/ext/microprofile/mp-rest-client/src/main/java/org/glassfish/jersey/microprofile/restclient/InterfaceModel.java index 259110c1fd..8422a2015a 100644 --- a/ext/microprofile/mp-rest-client/src/main/java/org/glassfish/jersey/microprofile/restclient/InterfaceModel.java +++ b/ext/microprofile/mp-rest-client/src/main/java/org/glassfish/jersey/microprofile/restclient/InterfaceModel.java @@ -28,7 +28,6 @@ import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.inject.spi.BeanManager; -import javax.enterprise.inject.spi.CDI; import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.Produces; @@ -41,8 +40,8 @@ import org.eclipse.microprofile.rest.client.ext.AsyncInvocationInterceptor; import org.eclipse.microprofile.rest.client.ext.ClientHeadersFactory; import org.eclipse.microprofile.rest.client.ext.ResponseExceptionMapper; -import org.glassfish.jersey.client.inject.ParameterInserter; -import org.glassfish.jersey.client.inject.ParameterInserterProvider; +import org.glassfish.jersey.client.inject.ParameterUpdater; +import org.glassfish.jersey.client.inject.ParameterUpdaterProvider; import org.glassfish.jersey.internal.inject.InjectionManager; import org.glassfish.jersey.internal.inject.Providers; import org.glassfish.jersey.model.Parameter; @@ -223,13 +222,13 @@ public InjectionManager getInjectionManager() { * @return converted value of argument */ Object resolveParamValue(Object arg, Parameter parameter) { - final Iterable parameterInserterProviders - = Providers.getAllProviders(injectionManager, ParameterInserterProvider.class); - for (final ParameterInserterProvider parameterInserterProvider : parameterInserterProviders) { - if (parameterInserterProvider != null) { - ParameterInserter inserter = - (ParameterInserter) parameterInserterProvider.get(parameter); - return inserter.insert(arg); + final Iterable parameterUpdaterProviders + = Providers.getAllProviders(injectionManager, ParameterUpdaterProvider.class); + for (final ParameterUpdaterProvider parameterUpdaterProvider : parameterUpdaterProviders) { + if (parameterUpdaterProvider != null) { + ParameterUpdater updater = + (ParameterUpdater) parameterUpdaterProvider.get(parameter); + return updater.update(arg); } } return arg;