This is an automated email from the ASF dual-hosted git repository. vavrtom pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-broker-j.git
The following commit(s) were added to refs/heads/main by this push: new 6f8786b037 QPID-8653: [Broker-J] Code cleanup: collection type arguments, collection factory methods, lambdas (#210) 6f8786b037 is described below commit 6f8786b03717e9904ed9f8a3888b13e4b2f29fe7 Author: Daniil Kirilyuk <daniel.kiril...@gmail.com> AuthorDate: Mon Aug 7 12:57:03 2023 +0200 QPID-8653: [Broker-J] Code cleanup: collection type arguments, collection factory methods, lambdas (#210) --- .../protocol/v1_0/AMQPConnection_1_0Impl.java | 14 ++--- .../server/protocol/v1_0/ConsumerTarget_1_0.java | 50 +++++++-------- .../apache/qpid/server/protocol/v1_0/LinkImpl.java | 2 +- .../v1_0/MessageConverter_v1_0_to_Internal.java | 2 - .../protocol/v1_0/NodeReceivingDestination.java | 39 +++++------- .../qpid/server/protocol/v1_0/Session_1_0.java | 14 ++--- .../server/protocol/v1_0/codec/BinaryWriter.java | 13 +--- .../protocol/v1_0/codec/BooleanConstructor.java | 41 +++--------- .../server/protocol/v1_0/codec/BooleanWriter.java | 13 +--- .../protocol/v1_0/codec/ByteArrayWriter.java | 13 +--- .../server/protocol/v1_0/codec/ByteWriter.java | 13 +--- .../server/protocol/v1_0/codec/CharWriter.java | 12 +--- .../server/protocol/v1_0/codec/DoubleWriter.java | 12 +--- .../server/protocol/v1_0/codec/FloatWriter.java | 13 +--- .../server/protocol/v1_0/codec/IntegerWriter.java | 28 ++++----- .../server/protocol/v1_0/codec/ListWriter.java | 16 +---- .../server/protocol/v1_0/codec/LongWriter.java | 28 ++++----- .../qpid/server/protocol/v1_0/codec/MapWriter.java | 11 +--- .../server/protocol/v1_0/codec/NullWriter.java | 12 +--- .../v1_0/codec/RestrictedTypeValueWriter.java | 15 ++--- .../server/protocol/v1_0/codec/ShortWriter.java | 13 +--- .../server/protocol/v1_0/codec/StringWriter.java | 13 +--- .../protocol/v1_0/codec/SymbolArrayWriter.java | 14 +---- .../server/protocol/v1_0/codec/SymbolWriter.java | 16 +---- .../protocol/v1_0/codec/TimestampWriter.java | 13 +--- .../server/protocol/v1_0/codec/UUIDWriter.java | 13 +--- .../protocol/v1_0/codec/UnsignedByteWriter.java | 13 +--- .../protocol/v1_0/codec/UnsignedIntegerWriter.java | 72 ++++++++++------------ .../protocol/v1_0/codec/UnsignedLongWriter.java | 42 +++++-------- .../protocol/v1_0/codec/UnsignedShortWriter.java | 12 +--- .../server/protocol/v1_0/framing/AMQFrame.java | 1 - .../v1_0/type/messaging/ApplicationProperties.java | 1 - .../v1_0/type/messaging/codec/AcceptedWriter.java | 11 +--- .../type/messaging/codec/AmqpSequenceWriter.java | 12 +--- .../v1_0/type/messaging/codec/AmqpValueWriter.java | 14 +---- .../codec/ApplicationPropertiesWriter.java | 15 +---- .../v1_0/type/messaging/codec/DataWriter.java | 12 +--- .../type/messaging/codec/DeleteOnCloseWriter.java | 15 +---- .../codec/DeleteOnNoLinksOrMessagesWriter.java | 16 +---- .../messaging/codec/DeleteOnNoLinksWriter.java | 14 +---- .../messaging/codec/DeleteOnNoMessagesWriter.java | 14 +---- .../messaging/codec/DeliveryAnnotationsWriter.java | 15 +---- .../messaging/codec/ExactSubjectFilterWriter.java | 14 +---- .../v1_0/type/messaging/codec/FooterWriter.java | 14 +---- .../v1_0/type/messaging/codec/HeaderWriter.java | 15 +---- .../messaging/codec/JMSSelectorFilterWriter.java | 15 +---- .../codec/MatchingSubjectFilterWriter.java | 15 +---- .../messaging/codec/MessageAnnotationsWriter.java | 14 +---- .../v1_0/type/messaging/codec/ModifiedWriter.java | 15 +---- .../type/messaging/codec/NoLocalFilterWriter.java | 14 +---- .../type/messaging/codec/PropertiesWriter.java | 15 +---- .../v1_0/type/messaging/codec/ReceivedWriter.java | 15 +---- .../v1_0/type/messaging/codec/RejectedWriter.java | 14 +---- .../v1_0/type/messaging/codec/ReleasedWriter.java | 14 +---- .../v1_0/type/messaging/codec/SourceWriter.java | 14 +---- .../v1_0/type/messaging/codec/TargetWriter.java | 14 +---- .../type/security/codec/SaslChallengeWriter.java | 14 +---- .../v1_0/type/security/codec/SaslInitWriter.java | 14 +---- .../type/security/codec/SaslMechanismsWriter.java | 17 +---- .../type/security/codec/SaslOutcomeWriter.java | 14 +---- .../type/security/codec/SaslResponseWriter.java | 15 +---- .../type/transaction/codec/CoordinatorWriter.java | 15 +---- .../v1_0/type/transaction/codec/DeclareWriter.java | 14 +---- .../type/transaction/codec/DeclaredWriter.java | 13 +--- .../type/transaction/codec/DischargeWriter.java | 14 +---- .../codec/TransactionalStateWriter.java | 12 +--- .../v1_0/type/transport/codec/AttachWriter.java | 14 +---- .../v1_0/type/transport/codec/BeginWriter.java | 14 +---- .../v1_0/type/transport/codec/CloseWriter.java | 14 +---- .../v1_0/type/transport/codec/DetachWriter.java | 14 +---- .../type/transport/codec/DispositionWriter.java | 15 +---- .../v1_0/type/transport/codec/EndWriter.java | 13 +--- .../v1_0/type/transport/codec/ErrorWriter.java | 11 +--- .../v1_0/type/transport/codec/FlowWriter.java | 14 +---- .../v1_0/type/transport/codec/OpenWriter.java | 14 +---- .../v1_0/type/transport/codec/TransferWriter.java | 15 +---- .../protocol/v1_0/SendingLinkEndpointTest.java | 1 - 77 files changed, 205 insertions(+), 1000 deletions(-) diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0Impl.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0Impl.java index ea5e38d80d..15ccb3312f 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0Impl.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0Impl.java @@ -223,7 +223,7 @@ public class AMQPConnection_1_0Impl extends AbstractAMQPConnection<AMQPConnectio private final AtomicBoolean _orderlyClose = new AtomicBoolean(false); private final Collection<Session_1_0> - _sessions = Collections.synchronizedCollection(new ArrayList<Session_1_0>()); + _sessions = Collections.synchronizedCollection(new ArrayList<>()); private final Object _reference = new Object(); @@ -231,7 +231,7 @@ public class AMQPConnection_1_0Impl extends AbstractAMQPConnection<AMQPConnectio new ConcurrentLinkedQueue<>(); private final Set<AMQPSession<?,?>> _sessionsWithWork = - Collections.newSetFromMap(new ConcurrentHashMap<AMQPSession<?,?>, Boolean>()); + Collections.newSetFromMap(new ConcurrentHashMap<>()); // Multi session transactions @@ -852,9 +852,9 @@ public class AMQPConnection_1_0Impl extends AbstractAMQPConnection<AMQPConnectio _outgoingIdleTimeout = open.getIdleTimeOut().longValue(); } final Map<Symbol, Object> remoteProperties = open.getProperties() == null - ? Collections.emptyMap() + ? Map.of() : Collections.unmodifiableMap(new LinkedHashMap<>(open.getProperties())); - _remoteDesiredCapabilities = open.getDesiredCapabilities() == null ? Collections.emptySet() : Sets.newHashSet(open.getDesiredCapabilities()); + _remoteDesiredCapabilities = open.getDesiredCapabilities() == null ? Set.of() : Sets.newHashSet(open.getDesiredCapabilities()); if (remoteProperties.containsKey(Symbol.valueOf("product"))) { setClientProduct(remoteProperties.get(Symbol.valueOf("product")).toString()); @@ -980,7 +980,7 @@ public class AMQPConnection_1_0Impl extends AbstractAMQPConnection<AMQPConnectio _properties.put(Symbol.valueOf("amqp:connection-establishment-failed"), true); final Error error = new Error(AmqpError.INVALID_FIELD, String.format("Connection closed due to sole-connection-enforcement-policy '%s'", e.getPolicy())); - error.setInfo(Collections.singletonMap(Symbol.valueOf("invalid-field"), Symbol.valueOf("container-id"))); + error.setInfo(Map.of(Symbol.valueOf("invalid-field"), Symbol.valueOf("container-id"))); closeConnection(error); getEventLogger().message(ResourceLimitMessages.REJECTED( "Opening", "connection", String.format("container '%s'", e.getContainerID()), e.getMessage())); @@ -989,7 +989,7 @@ public class AMQPConnection_1_0Impl extends AbstractAMQPConnection<AMQPConnectio { final Error error = new Error(AmqpError.RESOURCE_LOCKED, String.format("Connection closed due to sole-connection-enforcement-policy '%s'", e.getPolicy())); - error.setInfo(Collections.singletonMap(Symbol.valueOf("sole-connection-enforcement"), true)); + error.setInfo(Map.of(Symbol.valueOf("sole-connection-enforcement"), true)); final EventLogger logger = getEventLogger(); final List<ListenableFuture<Void>> rescheduleFutures = new ArrayList<>(); @@ -1688,7 +1688,7 @@ public class AMQPConnection_1_0Impl extends AbstractAMQPConnection<AMQPConnectio { Open open = new Open(); - Map<String,Object> props = Collections.emptyMap(); + Map<String,Object> props = Map.of(); for(ConnectionPropertyEnricher enricher : getPort().getConnectionPropertyEnrichers()) { props = enricher.addConnectionProperties(this, props); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java index 289e2ce7f5..319ca7ada8 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/ConsumerTarget_1_0.java @@ -62,7 +62,6 @@ import org.apache.qpid.server.transport.AMQPConnection; import org.apache.qpid.server.transport.ProtocolEngine; import org.apache.qpid.server.txn.ServerTransaction; import org.apache.qpid.server.txn.TransactionMonitor; -import org.apache.qpid.server.util.Action; import org.apache.qpid.server.util.ServerScopedRuntimeException; import org.apache.qpid.server.util.StateChangeListener; @@ -76,24 +75,28 @@ class ConsumerTarget_1_0 extends AbstractConsumerTarget<ConsumerTarget_1_0> private Binary _transactionId; private final SendingLinkEndpoint _linkEndpoint; - private final StateChangeListener<MessageInstance, MessageInstance.EntryState> _unacknowledgedMessageListener = new StateChangeListener<MessageInstance, MessageInstance.EntryState>() - { - @Override - public void stateChanged(MessageInstance entry, MessageInstance.EntryState oldState, MessageInstance.EntryState newState) - { - if (isConsumerAcquiredStateForThis(oldState) && !isConsumerAcquiredStateForThis(newState)) + private final StateChangeListener<MessageInstance, MessageInstance.EntryState> _unacknowledgedMessageListener = + new StateChangeListener<>() { - removeUnacknowledgedMessage(entry); - entry.removeStateChangeListener(this); - } - } + @Override + public void stateChanged(MessageInstance entry, + MessageInstance.EntryState oldState, + MessageInstance.EntryState newState) + { + if (isConsumerAcquiredStateForThis(oldState) && !isConsumerAcquiredStateForThis(newState)) + { + removeUnacknowledgedMessage(entry); + entry.removeStateChangeListener(this); + } + } - private boolean isConsumerAcquiredStateForThis(MessageInstance.EntryState state) - { - return state instanceof MessageInstance.ConsumerAcquiredState - && ((MessageInstance.ConsumerAcquiredState) state).getConsumer().getTarget() == ConsumerTarget_1_0.this; - } - }; + private boolean isConsumerAcquiredStateForThis(MessageInstance.EntryState state) + { + return state instanceof MessageInstance.ConsumerAcquiredState + && ((MessageInstance.ConsumerAcquiredState) state).getConsumer().getTarget() + == ConsumerTarget_1_0.this; + } + }; public ConsumerTarget_1_0(final SendingLinkEndpoint linkEndpoint, boolean acquires) { @@ -648,17 +651,8 @@ class ConsumerTarget_1_0 extends AbstractConsumerTarget<ConsumerTarget_1_0> int requeues = 0; if (_queueEntry.makeAcquisitionUnstealable(getConsumer())) { - requeues = _queueEntry.routeToAlternate(new Action<MessageInstance>() - { - @Override - public void performAction(final MessageInstance requeueEntry) - { - - eventLogger.message(logSubject, - ChannelMessages.DEADLETTERMSG(message.getMessageNumber(), - requeueEntry.getOwningResource().getName())); - } - }, null, null); + requeues = _queueEntry.routeToAlternate(requeueEntry -> + eventLogger.message(logSubject, ChannelMessages.DEADLETTERMSG(message.getMessageNumber(), requeueEntry.getOwningResource().getName())), null, null); } if (requeues == 0) diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/LinkImpl.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/LinkImpl.java index cabcf9b133..e2a45d32db 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/LinkImpl.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/LinkImpl.java @@ -257,7 +257,7 @@ public class LinkImpl<S extends BaseSource, T extends BaseTarget> implements Lin { AbstractConfiguredObject.addFutureCallback(doStealLink(thiefInformation.getSession(), thiefInformation.getAttach()), - new FutureCallback<LinkEndpoint<S, T>>() + new FutureCallback<>() { @Override public void onSuccess(final LinkEndpoint<S, T> result) diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_v1_0_to_Internal.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_v1_0_to_Internal.java index 15039d6044..c486358cbf 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_v1_0_to_Internal.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/MessageConverter_v1_0_to_Internal.java @@ -33,8 +33,6 @@ import org.apache.qpid.server.plugin.MessageConverter; import org.apache.qpid.server.plugin.PluggableService; import org.apache.qpid.server.protocol.v1_0.type.Symbol; import org.apache.qpid.server.protocol.v1_0.type.codec.AMQPDescribedTypeRegistry; -import org.apache.qpid.server.protocol.v1_0.type.messaging.MessageAnnotationsSection; -import org.apache.qpid.server.util.ServerScopedRuntimeException; @PluggableService public class MessageConverter_v1_0_to_Internal implements MessageConverter<Message_1_0, InternalMessage> diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/NodeReceivingDestination.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/NodeReceivingDestination.java index befa0156df..3727094b8d 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/NodeReceivingDestination.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/NodeReceivingDestination.java @@ -23,7 +23,7 @@ package org.apache.qpid.server.protocol.v1_0; import static org.apache.qpid.server.protocol.v1_0.Session_1_0.DELAYED_DELIVERY; import java.util.Arrays; -import java.util.Collections; +import java.util.Map; import org.apache.qpid.server.logging.EventLogger; import org.apache.qpid.server.logging.messages.ExchangeMessages; @@ -87,30 +87,23 @@ public class NodeReceivingDestination implements ReceivingDestination final SecurityToken securityToken) throws UnroutableMessageException { final String routingAddress = "".equals(_routingAddress) ? getRoutingAddress(message) : _routingAddress; - _destination.authorisePublish(securityToken, Collections.singletonMap("routingKey", routingAddress)); + _destination.authorisePublish(securityToken, Map.of("routingKey", routingAddress)); - final InstanceProperties instanceProperties = - new InstanceProperties() + final InstanceProperties instanceProperties = prop -> + { + switch(prop) { - - @Override - public Object getProperty(final Property prop) - { - switch(prop) - { - case MANDATORY: - return false; - case REDELIVERED: - return false; - case PERSISTENT: - return message.isPersistent(); - case IMMEDIATE: - return false; - case EXPIRATION: - return message.getExpiration(); - } - return null; - }}; + case MANDATORY: + case REDELIVERED: + case IMMEDIATE: + return false; + case PERSISTENT: + return message.isPersistent(); + case EXPIRATION: + return message.getExpiration(); + } + return null; + }; final RoutingResult<? extends ServerMessage<? extends StorableMessageMetaData>> result = _destination.route(message, routingAddress, instanceProperties); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java index d3abefc8da..2249257fdf 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/Session_1_0.java @@ -167,14 +167,10 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget _primaryDomain = getPrimaryDomain(); _incomingWindow = UnsignedInteger.valueOf(incomingWindow); - AccessController.doPrivileged((new PrivilegedAction<Object>() + AccessController.doPrivileged(((PrivilegedAction<Object>) () -> { - @Override - public Object run() - { - _connection.getEventLogger().message(ChannelMessages.CREATE()); - return null; - } + _connection.getEventLogger().message(ChannelMessages.CREATE()); + return null; }), _accessControllerContext); } @@ -847,9 +843,9 @@ public class Session_1_0 extends AbstractAMQPSession<Session_1_0, ConsumerTarget final Terminus terminus) throws AmqpErrorException { final Symbol[] capabilities = terminus.getCapabilities(); - final Set<Symbol> capabilitySet = capabilities == null ? Collections.emptySet() : Sets.newHashSet(capabilities); + final Set<Symbol> capabilitySet = capabilities == null ? Set.of() : Sets.newHashSet(capabilities); boolean isTopic = capabilitySet.contains(Symbol.valueOf("temporary-topic")) || capabilitySet.contains(Symbol.valueOf("topic")); - final String destName = (isTopic ? "TempTopic" : "TempQueue") + UUID.randomUUID().toString(); + final String destName = (isTopic ? "TempTopic" : "TempQueue") + UUID.randomUUID(); try { final Map<String, Object> attributes = createDynamicNodeAttributes(link, terminus, destName); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/BinaryWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/BinaryWriter.java index d6c53646af..44e71dcb76 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/BinaryWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/BinaryWriter.java @@ -25,6 +25,7 @@ import org.apache.qpid.server.protocol.v1_0.type.Binary; public class BinaryWriter extends SimpleVariableWidthWriter<Binary> { + private static final Factory<Binary> FACTORY = (registry, object) -> new BinaryWriter(object); public BinaryWriter(final Binary object) { @@ -43,18 +44,6 @@ public class BinaryWriter extends SimpleVariableWidthWriter<Binary> return (byte)0xa0; } - - private static final Factory<Binary> FACTORY = new Factory<Binary>() - { - - @Override - public ValueWriter<Binary> newInstance(final Registry registry, - final Binary object) - { - return new BinaryWriter(object); - } - }; - public static void register(Registry registry) { registry.register(Binary.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/BooleanConstructor.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/BooleanConstructor.java index ca49996568..0a59f223dd 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/BooleanConstructor.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/BooleanConstructor.java @@ -19,51 +19,26 @@ package org.apache.qpid.server.protocol.v1_0.codec; -import org.apache.qpid.server.bytebuffer.QpidByteBuffer; import org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException; import org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError; public class BooleanConstructor { - private static final TypeConstructor<Boolean> TRUE_INSTANCE = new TypeConstructor<Boolean>() + private static final TypeConstructor<Boolean> TRUE_INSTANCE = (in, handler) -> Boolean.TRUE; + private static final TypeConstructor<Boolean> FALSE_INSTANCE = (in, handler) -> Boolean.FALSE; + private static final TypeConstructor<Boolean> BYTE_INSTANCE = (in, handler) -> { - - @Override - public Boolean construct(final QpidByteBuffer in, final ValueHandler handler) throws AmqpErrorException + if (in.hasRemaining()) { - return Boolean.TRUE; + byte b = in.get(); + return b != (byte) 0; } - }; - - private static final TypeConstructor<Boolean> FALSE_INSTANCE = new TypeConstructor<Boolean>() - { - - @Override - public Boolean construct(final QpidByteBuffer in, final ValueHandler handler) - throws AmqpErrorException - { - return Boolean.FALSE; - } - }; - private static final TypeConstructor<Boolean> BYTE_INSTANCE = new TypeConstructor<Boolean>() - { - - @Override - public Boolean construct(final QpidByteBuffer in, final ValueHandler handler) throws AmqpErrorException + else { - if (in.hasRemaining()) - { - byte b = in.get(); - return b != (byte) 0; - } - else - { - throw new AmqpErrorException(AmqpError.DECODE_ERROR, "Cannot construct boolean: insufficient input data"); - } + throw new AmqpErrorException(AmqpError.DECODE_ERROR, "Cannot construct boolean: insufficient input data"); } }; - public static TypeConstructor<Boolean> getTrueInstance() { return TRUE_INSTANCE; diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/BooleanWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/BooleanWriter.java index a2fd5cc127..e9b03c014d 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/BooleanWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/BooleanWriter.java @@ -25,6 +25,8 @@ import org.apache.qpid.server.bytebuffer.QpidByteBuffer; public class BooleanWriter implements ValueWriter<Boolean> { + private static final Factory<Boolean> FACTORY = (registry, object) -> new BooleanWriter(object); + private boolean _value; public BooleanWriter() @@ -53,17 +55,6 @@ public class BooleanWriter implements ValueWriter<Boolean> _value = value.booleanValue(); } - private static final Factory<Boolean> FACTORY = new Factory<Boolean>() - { - - @Override - public ValueWriter<Boolean> newInstance(final Registry registry, - final Boolean object) - { - return new BooleanWriter(object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Boolean.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ByteArrayWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ByteArrayWriter.java index 0cd4c094a1..98dee89995 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ByteArrayWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ByteArrayWriter.java @@ -23,6 +23,7 @@ package org.apache.qpid.server.protocol.v1_0.codec; public class ByteArrayWriter extends SimpleVariableWidthWriter<byte[]> { + private static final Factory<byte[]> FACTORY = (registry, object) -> new ByteArrayWriter(object); public ByteArrayWriter(final byte[] object) { @@ -41,20 +42,8 @@ public class ByteArrayWriter extends SimpleVariableWidthWriter<byte[]> return (byte)0xa0; } - private static final Factory<byte[]> FACTORY = new Factory<byte[]>() - { - - @Override - public ValueWriter<byte[]> newInstance(final Registry registry, - final byte[] object) - { - return new ByteArrayWriter(object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(byte[].class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ByteWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ByteWriter.java index ea5087df40..ce9db48781 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ByteWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ByteWriter.java @@ -25,6 +25,8 @@ import org.apache.qpid.server.bytebuffer.QpidByteBuffer; public class ByteWriter implements ValueWriter<Byte> { + private static final Factory<Byte> FACTORY = (registry, object) -> new ByteWriter(object); + private byte _value; public ByteWriter() @@ -55,17 +57,6 @@ public class ByteWriter implements ValueWriter<Byte> _value = value.byteValue(); } - private static final Factory<Byte> FACTORY = new Factory<Byte>() - { - - @Override - public ValueWriter<Byte> newInstance(final Registry registry, - final Byte object) - { - return new ByteWriter(object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Byte.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/CharWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/CharWriter.java index 0300a4c27c..240287e20e 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/CharWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/CharWriter.java @@ -24,6 +24,7 @@ package org.apache.qpid.server.protocol.v1_0.codec; public class CharWriter extends FixedFourWriter<Character> { private static final byte FORMAT_CODE = (byte)0x73; + private static final Factory<Character> FACTORY = (registry, object) -> new CharWriter(object); public CharWriter(final Character object) { @@ -36,17 +37,6 @@ public class CharWriter extends FixedFourWriter<Character> return FORMAT_CODE; } - private static final Factory<Character> FACTORY = new Factory<Character>() - { - - @Override - public ValueWriter<Character> newInstance(final Registry registry, - final Character object) - { - return new CharWriter(object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Character.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/DoubleWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/DoubleWriter.java index 9ae4dd8df1..53d432b497 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/DoubleWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/DoubleWriter.java @@ -24,6 +24,7 @@ package org.apache.qpid.server.protocol.v1_0.codec; public class DoubleWriter extends FixedEightWriter<Double> { private static final byte FORMAT_CODE = (byte) 0x82; + private static final Factory<Double> FACTORY = (registry, object) -> new DoubleWriter(object); public DoubleWriter(final Double object) { @@ -36,17 +37,6 @@ public class DoubleWriter extends FixedEightWriter<Double> return FORMAT_CODE; } - private static final Factory<Double> FACTORY = new Factory<Double>() - { - - @Override - public ValueWriter<Double> newInstance(final Registry registry, - final Double object) - { - return new DoubleWriter(object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Double.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/FloatWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/FloatWriter.java index 44ec7c6bdc..b7d5ab39ff 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/FloatWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/FloatWriter.java @@ -24,7 +24,7 @@ package org.apache.qpid.server.protocol.v1_0.codec; public class FloatWriter extends FixedFourWriter<Float> { private static final byte FORMAT_CODE = (byte)0x72; - + private static final Factory<Float> FACTORY = (registry, object) -> new FloatWriter(object); public FloatWriter(final Float object) { @@ -37,17 +37,6 @@ public class FloatWriter extends FixedFourWriter<Float> return FORMAT_CODE; } - private static final Factory<Float> FACTORY = new Factory<Float>() - { - - @Override - public ValueWriter<Float> newInstance(final Registry registry, - final Float object) - { - return new FloatWriter(object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Float.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/IntegerWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/IntegerWriter.java index 3a77e44528..bb83b775ff 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/IntegerWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/IntegerWriter.java @@ -26,23 +26,17 @@ public class IntegerWriter private static final byte EIGHT_BYTE_FORMAT_CODE = (byte)0x71; private static final byte ONE_BYTE_FORMAT_CODE = (byte) 0x54; - private static final ValueWriter.Factory<Integer> FACTORY = new ValueWriter.Factory<Integer>() - { - - @Override - public ValueWriter<Integer> newInstance(final ValueWriter.Registry registry, - final Integer i) - { - if(i >= -128 && i <= 127) - { - return new IntegerFixedOneWriter(i); - } - else - { - return new IntegerFixedFourWriter(i); - } - } - }; + private static final ValueWriter.Factory<Integer> FACTORY = (registry, i) -> + { + if(i >= -128 && i <= 127) + { + return new IntegerFixedOneWriter(i); + } + else + { + return new IntegerFixedFourWriter(i); + } + }; public static void register(ValueWriter.Registry registry) { diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ListWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ListWriter.java index 0fb00ef24f..3db2ed93b8 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ListWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ListWriter.java @@ -68,6 +68,9 @@ public class ListWriter public static final ValueWriter<List> EMPTY_LIST_WRITER = new EmptyListValueWriter(); + private static final ValueWriter.Factory<List> FACTORY = + (registry, object) -> object.isEmpty() ? EMPTY_LIST_WRITER : new NonEmptyListWriter(registry, object); + public static class EmptyListValueWriter implements ValueWriter<List> { @@ -84,21 +87,8 @@ public class ListWriter } } - private static final ValueWriter.Factory<List> FACTORY = - new ValueWriter.Factory<List>() - { - - @Override - public ValueWriter<List> newInstance(final ValueWriter.Registry registry, - final List object) - { - return object.isEmpty() ? EMPTY_LIST_WRITER : new NonEmptyListWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(List.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/LongWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/LongWriter.java index d846c381ce..31e9cf0cd0 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/LongWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/LongWriter.java @@ -28,23 +28,17 @@ public class LongWriter private static final byte ONE_BYTE_FORMAT_CODE = (byte) 0x55; - private static final ValueWriter.Factory<Long> FACTORY = - new ValueWriter.Factory<Long>() - { - @Override - public ValueWriter<Long> newInstance(final ValueWriter.Registry registry, - final Long l) - { - if (l >= -128 && l <= 127) - { - return new LongFixedOneWriter(l); - } - else - { - return new LongFixedEightWriter(l); - } - } - }; + private static final ValueWriter.Factory<Long> FACTORY = (registry, l) -> + { + if (l >= -128 && l <= 127) + { + return new LongFixedOneWriter(l); + } + else + { + return new LongFixedEightWriter(l); + } + }; public static void register(ValueWriter.Registry registry) { diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/MapWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/MapWriter.java index 01a7f15625..142024294e 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/MapWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/MapWriter.java @@ -26,16 +26,7 @@ import java.util.Map; public class MapWriter extends AbstractMapWriter<Map> { - private static final Factory<Map> FACTORY = new Factory<Map>() - { - - @Override - public ValueWriter<Map> newInstance(final Registry registry, - final Map object) - { - return new MapWriter(registry, object); - } - }; + private static final Factory<Map> FACTORY = MapWriter::new; private final Map _map; private Object _value; diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/NullWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/NullWriter.java index 52c5c3cf8d..2c6d0a5d9f 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/NullWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/NullWriter.java @@ -26,6 +26,7 @@ import org.apache.qpid.server.bytebuffer.QpidByteBuffer; public class NullWriter implements ValueWriter<Void> { private static final NullWriter INSTANCE = new NullWriter(); + private static final Factory<Void> FACTORY = (registry, object) -> INSTANCE; @Override public int getEncodedSize() @@ -40,17 +41,6 @@ public class NullWriter implements ValueWriter<Void> buffer.put((byte)0x40); } - private static final Factory<Void> FACTORY = new Factory<Void>() - { - - @Override - public ValueWriter<Void> newInstance(final Registry registry, - final Void object) - { - return INSTANCE; - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Void.TYPE, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/RestrictedTypeValueWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/RestrictedTypeValueWriter.java index adc77ef28e..168617e923 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/RestrictedTypeValueWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/RestrictedTypeValueWriter.java @@ -24,6 +24,8 @@ import org.apache.qpid.server.protocol.v1_0.type.RestrictedType; public class RestrictedTypeValueWriter<V> extends DelegatingValueWriter<RestrictedType<V>> { + private static final Factory FACTORY = + (registry, object) -> new RestrictedTypeValueWriter(registry, (RestrictedType) object); public RestrictedTypeValueWriter(final Registry registry, final RestrictedType<V> object) @@ -37,17 +39,8 @@ public class RestrictedTypeValueWriter<V> extends DelegatingValueWriter<Restrict return restrictedType.getValue(); } - private static final Factory FACTORY = new Factory() - { - - @Override - public ValueWriter newInstance(final Registry registry, final Object object) - { - return new RestrictedTypeValueWriter(registry, (RestrictedType) object); - } - }; - public static void register(ValueWriter.Registry registry, Class clazz) { registry.register(clazz, FACTORY); - }} + } +} diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ShortWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ShortWriter.java index 08f06c9306..238397cceb 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ShortWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/ShortWriter.java @@ -23,8 +23,8 @@ package org.apache.qpid.server.protocol.v1_0.codec; public class ShortWriter extends FixedTwoWriter<Short> { - private static final byte FORMAT_CODE = (byte)0x61; + private static final Factory<Short> FACTORY = (registry, object) -> new ShortWriter(object); public ShortWriter() { @@ -48,17 +48,6 @@ public class ShortWriter extends FixedTwoWriter<Short> return FORMAT_CODE; } - private static final Factory<Short> FACTORY = new Factory<Short>() - { - - @Override - public ValueWriter<Short> newInstance(final Registry registry, - final Short object) - { - return new ShortWriter(object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Short.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/StringWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/StringWriter.java index 2b8c058070..8c9f926d60 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/StringWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/StringWriter.java @@ -25,6 +25,7 @@ import java.nio.charset.StandardCharsets; public class StringWriter extends SimpleVariableWidthWriter<String> { + private static final Factory<String> FACTORY = (registry, object) -> new StringWriter(object); public StringWriter(final String value) { @@ -43,18 +44,6 @@ public class StringWriter extends SimpleVariableWidthWriter<String> return (byte) 0xa1; } - - private static final Factory<String> FACTORY = new Factory<String>() - { - - @Override - public ValueWriter<String> newInstance(final Registry registry, - final String object) - { - return new StringWriter(object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(String.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/SymbolArrayWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/SymbolArrayWriter.java index 937f1054e6..50ef51fbbf 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/SymbolArrayWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/SymbolArrayWriter.java @@ -25,6 +25,8 @@ import org.apache.qpid.server.protocol.v1_0.type.Symbol; public class SymbolArrayWriter extends SimpleVariableWidthWriter<Symbol[]> { + private static final Factory<Symbol[]> FACTORY = (registry, object) -> new SymbolArrayWriter(object); + private SymbolArrayWriter(final Symbol[] object) { super(getEncodedValue(object)); @@ -128,18 +130,6 @@ public class SymbolArrayWriter extends SimpleVariableWidthWriter<Symbol[]> return true; } - - private static final Factory<Symbol[]> FACTORY = new Factory<Symbol[]>() - { - - @Override - public ValueWriter<Symbol[]> newInstance(final Registry registry, - final Symbol[] object) - { - return new SymbolArrayWriter(object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Symbol[].class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/SymbolWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/SymbolWriter.java index 51a5a597a9..b45239f955 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/SymbolWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/SymbolWriter.java @@ -21,16 +21,15 @@ package org.apache.qpid.server.protocol.v1_0.codec; -import java.nio.charset.Charset; - import org.apache.qpid.server.bytebuffer.QpidByteBuffer; import org.apache.qpid.server.protocol.v1_0.type.Symbol; public class SymbolWriter extends VariableWidthWriter<Symbol> { - private static final Charset ENCODING_CHARSET = Charset.forName("US-ASCII"); public static final byte LARGE_ENCODING_CODE = (byte) 0xb3; public static final byte SMALL_ENCODING_CODE = (byte) 0xa3; + private static final Factory<Symbol> FACTORY = (registry, object) -> new SymbolWriter(object); + private final Symbol _value; public SymbolWriter(final Symbol object) @@ -61,17 +60,6 @@ public class SymbolWriter extends VariableWidthWriter<Symbol> } } - private static final Factory<Symbol> FACTORY = new Factory<Symbol>() - { - - @Override - public ValueWriter<Symbol> newInstance(final Registry registry, - final Symbol object) - { - return new SymbolWriter(object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Symbol.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/TimestampWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/TimestampWriter.java index 1314b30d8f..a478b9fdd8 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/TimestampWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/TimestampWriter.java @@ -26,6 +26,7 @@ import java.util.Date; public class TimestampWriter extends FixedEightWriter<Date> { private static final byte FORMAT_CODE = (byte) 0x83; + private static final Factory<Date> FACTORY = (registry, object) -> new TimestampWriter(object); public TimestampWriter(final Date object) { @@ -38,20 +39,8 @@ public class TimestampWriter extends FixedEightWriter<Date> return FORMAT_CODE; } - private static final Factory<Date> FACTORY = new Factory<Date>() - { - - @Override - public ValueWriter<Date> newInstance(final Registry registry, - final Date object) - { - return new TimestampWriter(object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Date.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UUIDWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UUIDWriter.java index 22908f4e6e..4e3249646e 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UUIDWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UUIDWriter.java @@ -26,6 +26,7 @@ import java.util.UUID; public class UUIDWriter extends FixedSixteenWriter<UUID> { private static final byte FORMAT_CODE = (byte) 0x98; + private static final Factory<UUID> FACTORY = (registry, object) -> new UUIDWriter(object); public UUIDWriter() { @@ -54,20 +55,8 @@ public class UUIDWriter extends FixedSixteenWriter<UUID> return value.getLeastSignificantBits(); } - private static final Factory<UUID> FACTORY = new Factory<UUID>() - { - - @Override - public ValueWriter<UUID> newInstance(final Registry registry, - final UUID object) - { - return new UUIDWriter(object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(UUID.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedByteWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedByteWriter.java index 40f7c1e750..7446ee48fe 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedByteWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedByteWriter.java @@ -25,6 +25,8 @@ import org.apache.qpid.server.protocol.v1_0.type.UnsignedByte; public class UnsignedByteWriter extends FixedOneWriter<UnsignedByte> { + private static final Factory<UnsignedByte> FACTORY = (registry, object) -> new UnsignedByteWriter(object); + public UnsignedByteWriter(final UnsignedByte value) { super(value.byteValue()); @@ -36,17 +38,6 @@ public class UnsignedByteWriter extends FixedOneWriter<UnsignedByte> return (byte) 0x50; } - private static final Factory<UnsignedByte> FACTORY = new Factory<UnsignedByte>() - { - - @Override - public ValueWriter<UnsignedByte> newInstance(final Registry registry, - final UnsignedByte object) - { - return new UnsignedByteWriter(object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(UnsignedByte.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedIntegerWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedIntegerWriter.java index 72bc604a94..2470cdff1d 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedIntegerWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedIntegerWriter.java @@ -31,47 +31,41 @@ public class UnsignedIntegerWriter private static final byte ZERO_BYTE_FORMAT_CODE = (byte) 0x43; - private static final ValueWriter<UnsignedInteger> ZERO_BYTE_WRITER = new ValueWriter<UnsignedInteger>() + private static final ValueWriter<UnsignedInteger> ZERO_BYTE_WRITER = new ValueWriter<>() + { + + @Override + public int getEncodedSize() + { + return 1; + } + + @Override + public void writeToBuffer(QpidByteBuffer buffer) { + buffer.put(ZERO_BYTE_FORMAT_CODE); + } + }; + + - @Override - public int getEncodedSize() - { - return 1; - } - - @Override - public void writeToBuffer(QpidByteBuffer buffer) - { - buffer.put(ZERO_BYTE_FORMAT_CODE); - } - }; - - - - - - private static final ValueWriter.Factory<UnsignedInteger> FACTORY = new ValueWriter.Factory<UnsignedInteger>() - { - - @Override - public ValueWriter<UnsignedInteger> newInstance(final ValueWriter.Registry registry, - final UnsignedInteger uint) - { - if(uint.equals(UnsignedInteger.ZERO)) - { - return ZERO_BYTE_WRITER; - } - else if(uint.compareTo(UnsignedInteger.valueOf(256))<0) - { - return new UnsignedIntegerFixedOneWriter(uint); - } - else - { - return new UnsignedIntegerFixedFourWriter(uint); - } - } - }; + + + private static final ValueWriter.Factory<UnsignedInteger> FACTORY = (registry, uint) -> + { + if(uint.equals(UnsignedInteger.ZERO)) + { + return ZERO_BYTE_WRITER; + } + else if(uint.compareTo(UnsignedInteger.valueOf(256))<0) + { + return new UnsignedIntegerFixedOneWriter(uint); + } + else + { + return new UnsignedIntegerFixedFourWriter(uint); + } + }; public static void register(ValueWriter.Registry registry) { diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedLongWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedLongWriter.java index 89ebf701d5..27a6d07c63 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedLongWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedLongWriter.java @@ -30,8 +30,7 @@ public class UnsignedLongWriter private static final byte ONE_BYTE_FORMAT_CODE = (byte) 0x53; private static final byte ZERO_BYTE_FORMAT_CODE = (byte) 0x44; - - private static final ValueWriter<UnsignedLong> ZERO_BYTE_WRITER = new ValueWriter<UnsignedLong>() + private static final ValueWriter<UnsignedLong> ZERO_BYTE_WRITER = new ValueWriter<>() { @Override public int getEncodedSize() @@ -46,30 +45,21 @@ public class UnsignedLongWriter } }; - - - private static final ValueWriter.Factory<UnsignedLong> FACTORY = - new ValueWriter.Factory<UnsignedLong>() - { - - @Override - public ValueWriter<UnsignedLong> newInstance(final ValueWriter.Registry registry, - final UnsignedLong object) - { - if (object.equals(UnsignedLong.ZERO)) - { - return ZERO_BYTE_WRITER; - } - else if ((object.longValue() & 0xffL) == object.longValue()) - { - return new UnsignedLongFixedOneWriter(object); - } - else - { - return new UnsignedLongFixedEightWriter(object); - } - } - }; + private static final ValueWriter.Factory<UnsignedLong> FACTORY = (registry, object) -> + { + if (object.equals(UnsignedLong.ZERO)) + { + return ZERO_BYTE_WRITER; + } + else if ((object.longValue() & 0xffL) == object.longValue()) + { + return new UnsignedLongFixedOneWriter(object); + } + else + { + return new UnsignedLongFixedEightWriter(object); + } + }; public static void register(ValueWriter.Registry registry) { diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedShortWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedShortWriter.java index ed0da8ad83..aad268d6c1 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedShortWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/codec/UnsignedShortWriter.java @@ -26,6 +26,7 @@ import org.apache.qpid.server.protocol.v1_0.type.UnsignedShort; public class UnsignedShortWriter extends FixedTwoWriter<UnsignedShort> { private static final byte FORMAT_CODE = (byte)0x60; + private static final Factory<UnsignedShort> FACTORY = (registry, object) -> new UnsignedShortWriter(object); public UnsignedShortWriter() { @@ -48,17 +49,6 @@ public class UnsignedShortWriter extends FixedTwoWriter<UnsignedShort> return FORMAT_CODE; } - private static final Factory<UnsignedShort> FACTORY = new Factory<UnsignedShort>() - { - - @Override - public ValueWriter<UnsignedShort> newInstance(final Registry registry, - final UnsignedShort object) - { - return new UnsignedShortWriter(object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(UnsignedShort.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/framing/AMQFrame.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/framing/AMQFrame.java index d8e0481e5b..eeec261df4 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/framing/AMQFrame.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/framing/AMQFrame.java @@ -22,7 +22,6 @@ package org.apache.qpid.server.protocol.v1_0.framing; import org.apache.qpid.server.bytebuffer.QpidByteBuffer; -import org.apache.qpid.server.protocol.v1_0.type.FrameBody; public abstract class AMQFrame<T> { diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/ApplicationProperties.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/ApplicationProperties.java index b2d3954b4a..213c06b217 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/ApplicationProperties.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/ApplicationProperties.java @@ -24,7 +24,6 @@ package org.apache.qpid.server.protocol.v1_0.type.messaging; import java.util.Date; -import java.util.LinkedHashMap; import java.util.Map; import java.util.UUID; diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AcceptedWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AcceptedWriter.java index abb8b9136b..c499d6e325 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AcceptedWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AcceptedWriter.java @@ -33,22 +33,13 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.Accepted; public class AcceptedWriter extends AbstractDescribedTypeWriter<Accepted> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x24); + private static final Factory<Accepted> FACTORY = (registry, object) -> new AcceptedWriter(registry); public AcceptedWriter(final Registry registry) { super(DESCRIPTOR_WRITER, ListWriter.EMPTY_LIST_WRITER); } - private static final Factory<Accepted> FACTORY = new Factory<Accepted>() - { - - @Override - public ValueWriter<Accepted> newInstance(final Registry registry, final Accepted object) - { - return new AcceptedWriter(registry); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Accepted.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpSequenceWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpSequenceWriter.java index 71289ac74b..92fddc5f22 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpSequenceWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpSequenceWriter.java @@ -33,23 +33,13 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpSequence; public class AmqpSequenceWriter extends AbstractDescribedTypeWriter<AmqpSequence> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x76); - + private static final Factory<AmqpSequence> FACTORY = AmqpSequenceWriter::new; public AmqpSequenceWriter(final Registry registry, final AmqpSequence object) { super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue())); } - private static final Factory<AmqpSequence> FACTORY = new Factory<AmqpSequence>() - { - - @Override - public ValueWriter<AmqpSequence> newInstance(final Registry registry, final AmqpSequence object) - { - return new AmqpSequenceWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(AmqpSequence.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueWriter.java index 0aec0148b8..076aba7ccc 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/AmqpValueWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -33,25 +31,15 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue; public class AmqpValueWriter extends AbstractDescribedTypeWriter<AmqpValue> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x77); + private static final Factory<AmqpValue> FACTORY = AmqpValueWriter::new; private AmqpValueWriter(final Registry registry, final AmqpValue object) { super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue())); } - private static final Factory<AmqpValue> FACTORY = new Factory<AmqpValue>() - { - - @Override - public ValueWriter<AmqpValue> newInstance(final Registry registry, final AmqpValue object) - { - return new AmqpValueWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(AmqpValue.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ApplicationPropertiesWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ApplicationPropertiesWriter.java index fae98ec77b..a1e9c3aac4 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ApplicationPropertiesWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ApplicationPropertiesWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -33,26 +31,15 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.ApplicationProperties public class ApplicationPropertiesWriter extends AbstractDescribedTypeWriter<ApplicationProperties> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x74); + private static final Factory<ApplicationProperties> FACTORY = ApplicationPropertiesWriter::new; private ApplicationPropertiesWriter(final Registry registry, final ApplicationProperties object) { super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue())); } - private static final Factory<ApplicationProperties> FACTORY = new Factory<ApplicationProperties>() - { - - @Override - public ValueWriter<ApplicationProperties> newInstance(final Registry registry, - final ApplicationProperties object) - { - return new ApplicationPropertiesWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(ApplicationProperties.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataWriter.java index ee6aef23b4..44c36c81af 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DataWriter.java @@ -33,25 +33,15 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.Data; public class DataWriter extends AbstractDescribedTypeWriter<Data> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x75); + private static final Factory<Data> FACTORY = DataWriter::new; public DataWriter(final Registry registry, final Data object) { super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue())); } - private static final Factory<Data> FACTORY = new Factory<Data>() - { - - @Override - public ValueWriter<Data> newInstance(final Registry registry, final Data object) - { - return new DataWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Data.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnCloseWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnCloseWriter.java index 16a4cb9575..499883e4d9 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnCloseWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnCloseWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -33,26 +31,15 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnClose; public class DeleteOnCloseWriter extends AbstractDescribedTypeWriter<DeleteOnClose> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x2B); + private static final Factory<DeleteOnClose> FACTORY = (registry, object) -> new DeleteOnCloseWriter(registry); public DeleteOnCloseWriter(final Registry registry) { super(DESCRIPTOR_WRITER, ListWriter.EMPTY_LIST_WRITER); } - - private static final Factory<DeleteOnClose> FACTORY = new Factory<DeleteOnClose>() - { - - @Override - public ValueWriter<DeleteOnClose> newInstance(final Registry registry, final DeleteOnClose object) - { - return new DeleteOnCloseWriter(registry); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(DeleteOnClose.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksOrMessagesWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksOrMessagesWriter.java index ed0d33604a..e84af84e52 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksOrMessagesWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksOrMessagesWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -33,26 +31,16 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnNoLinksOrMess public class DeleteOnNoLinksOrMessagesWriter extends AbstractDescribedTypeWriter<DeleteOnNoLinksOrMessages> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x2E); + private static final Factory<DeleteOnNoLinksOrMessages> FACTORY = + (registry, object) -> new DeleteOnNoLinksOrMessagesWriter(registry); public DeleteOnNoLinksOrMessagesWriter(final Registry registry) { super(DESCRIPTOR_WRITER, ListWriter.EMPTY_LIST_WRITER); } - private static final Factory<DeleteOnNoLinksOrMessages> FACTORY = new Factory<DeleteOnNoLinksOrMessages>() - { - - @Override - public ValueWriter<DeleteOnNoLinksOrMessages> newInstance(final Registry registry, - final DeleteOnNoLinksOrMessages object) - { - return new DeleteOnNoLinksOrMessagesWriter(registry); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(DeleteOnNoLinksOrMessages.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksWriter.java index d63e5bb019..90ac9217de 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoLinksWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -33,25 +31,15 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnNoLinks; public class DeleteOnNoLinksWriter extends AbstractDescribedTypeWriter<DeleteOnNoLinks> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x2C); + private static final Factory<DeleteOnNoLinks> FACTORY = (registry, object) -> new DeleteOnNoLinksWriter(registry); public DeleteOnNoLinksWriter(final Registry registry) { super(DESCRIPTOR_WRITER, ListWriter.EMPTY_LIST_WRITER); } - private static final Factory<DeleteOnNoLinks> FACTORY = new Factory<DeleteOnNoLinks>() - { - - @Override - public ValueWriter<DeleteOnNoLinks> newInstance(final Registry registry, final DeleteOnNoLinks object) - { - return new DeleteOnNoLinksWriter(registry); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(DeleteOnNoLinks.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoMessagesWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoMessagesWriter.java index 770a1db2d5..35d9857534 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoMessagesWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeleteOnNoMessagesWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -33,6 +31,7 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.DeleteOnNoMessages; public class DeleteOnNoMessagesWriter extends AbstractDescribedTypeWriter<DeleteOnNoMessages> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x2D); + private static final Factory<DeleteOnNoMessages> FACTORY = DeleteOnNoMessagesWriter::new; public DeleteOnNoMessagesWriter(final Registry registry, final DeleteOnNoMessages object) @@ -40,19 +39,8 @@ public class DeleteOnNoMessagesWriter extends AbstractDescribedTypeWriter<Delete super(DESCRIPTOR_WRITER, ListWriter.EMPTY_LIST_WRITER); } - private static final Factory<DeleteOnNoMessages> FACTORY = new Factory<DeleteOnNoMessages>() - { - - @Override - public ValueWriter<DeleteOnNoMessages> newInstance(final Registry registry, final DeleteOnNoMessages object) - { - return new DeleteOnNoMessagesWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(DeleteOnNoMessages.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsWriter.java index dfdeba40c9..4e1ed2e16d 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/DeliveryAnnotationsWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -33,7 +31,7 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.DeliveryAnnotations; public class DeliveryAnnotationsWriter extends AbstractDescribedTypeWriter<DeliveryAnnotations> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x71); - + private static final Factory<DeliveryAnnotations> FACTORY = DeliveryAnnotationsWriter::new; public DeliveryAnnotationsWriter(final Registry registry, final DeliveryAnnotations object) @@ -41,19 +39,8 @@ public class DeliveryAnnotationsWriter extends AbstractDescribedTypeWriter<Deliv super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue())); } - private static final Factory<DeliveryAnnotations> FACTORY = new Factory<DeliveryAnnotations>() - { - - @Override - public ValueWriter<DeliveryAnnotations> newInstance(final Registry registry, final DeliveryAnnotations object) - { - return new DeliveryAnnotationsWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(DeliveryAnnotations.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ExactSubjectFilterWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ExactSubjectFilterWriter.java index 80220e80de..c40ef30cbe 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ExactSubjectFilterWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ExactSubjectFilterWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -32,6 +30,7 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.ExactSubjectFilter; public class ExactSubjectFilterWriter extends AbstractDescribedTypeWriter<ExactSubjectFilter> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter(0x0000468C00000000L); + private static final Factory<ExactSubjectFilter> FACTORY = ExactSubjectFilterWriter::new; public ExactSubjectFilterWriter(final Registry registry, final ExactSubjectFilter object) @@ -39,19 +38,8 @@ public class ExactSubjectFilterWriter extends AbstractDescribedTypeWriter<ExactS super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue())); } - private static final Factory<ExactSubjectFilter> FACTORY = new Factory<ExactSubjectFilter>() - { - - @Override - public ValueWriter<ExactSubjectFilter> newInstance(final Registry registry, final ExactSubjectFilter object) - { - return new ExactSubjectFilterWriter(registry, object); - } - }; - public static void register(Registry registry) { registry.register(ExactSubjectFilter.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/FooterWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/FooterWriter.java index c7e2356206..e0ed31bef8 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/FooterWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/FooterWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -33,6 +31,7 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.Footer; public class FooterWriter extends AbstractDescribedTypeWriter<Footer> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x78); + private static final Factory<Footer> FACTORY = FooterWriter::new; public FooterWriter(final Registry registry, final Footer object) @@ -40,19 +39,8 @@ public class FooterWriter extends AbstractDescribedTypeWriter<Footer> super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue())); } - private static final Factory<Footer> FACTORY = new Factory<Footer>() - { - - @Override - public ValueWriter<Footer> newInstance(final Registry registry, final Footer object) - { - return new FooterWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Footer.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/HeaderWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/HeaderWriter.java index 025b7bfc1c..a13cdbe0db 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/HeaderWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/HeaderWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,13 +32,13 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.Header; public class HeaderWriter extends AbstractDescribedTypeWriter<Header> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x70); + private static final Factory<Header> FACTORY = HeaderWriter::new; public HeaderWriter(final Registry registry, final Header object) { super(DESCRIPTOR_WRITER, new Writer(registry, object)); } - private static class Writer extends AbstractListWriter<Header> { private final int _count; @@ -131,19 +129,8 @@ public class HeaderWriter extends AbstractDescribedTypeWriter<Header> } } - private static final Factory<Header> FACTORY = new Factory<Header>() - { - - @Override - public ValueWriter<Header> newInstance(final Registry registry, final Header object) - { - return new HeaderWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Header.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/JMSSelectorFilterWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/JMSSelectorFilterWriter.java index 48be9f485c..fc611a314b 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/JMSSelectorFilterWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/JMSSelectorFilterWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -32,6 +30,7 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.JMSSelectorFilter; public class JMSSelectorFilterWriter extends AbstractDescribedTypeWriter<JMSSelectorFilter> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter(0x0000468C00000004L); + private static final Factory<JMSSelectorFilter> FACTORY = JMSSelectorFilterWriter::new; public JMSSelectorFilterWriter(final Registry registry, final JMSSelectorFilter object) @@ -39,20 +38,8 @@ public class JMSSelectorFilterWriter extends AbstractDescribedTypeWriter<JMSSele super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue())); } - - private static final Factory<JMSSelectorFilter> FACTORY = new Factory<JMSSelectorFilter>() - { - - @Override - public ValueWriter<JMSSelectorFilter> newInstance(final Registry registry, final JMSSelectorFilter object) - { - return new JMSSelectorFilterWriter(registry, object); - } - }; - public static void register(Registry registry) { registry.register(JMSSelectorFilter.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/MatchingSubjectFilterWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/MatchingSubjectFilterWriter.java index 53689185de..0ab0ede7f3 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/MatchingSubjectFilterWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/MatchingSubjectFilterWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -32,6 +30,7 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.MatchingSubjectFilter public class MatchingSubjectFilterWriter extends AbstractDescribedTypeWriter<MatchingSubjectFilter> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter(0x0000468C00000001L); + private static final Factory<MatchingSubjectFilter> FACTORY = MatchingSubjectFilterWriter::new; public MatchingSubjectFilterWriter(final Registry registry, final MatchingSubjectFilter object) @@ -39,20 +38,8 @@ public class MatchingSubjectFilterWriter extends AbstractDescribedTypeWriter<Mat super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue())); } - private static final Factory<MatchingSubjectFilter> FACTORY = new Factory<MatchingSubjectFilter>() - { - - @Override - public ValueWriter<MatchingSubjectFilter> newInstance(final Registry registry, - final MatchingSubjectFilter object) - { - return new MatchingSubjectFilterWriter(registry, object); - } - }; - public static void register(Registry registry) { registry.register(MatchingSubjectFilter.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/MessageAnnotationsWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/MessageAnnotationsWriter.java index 03945bc81b..11577ae52f 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/MessageAnnotationsWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/MessageAnnotationsWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -33,6 +31,7 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.MessageAnnotations; public class MessageAnnotationsWriter extends AbstractDescribedTypeWriter<MessageAnnotations> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x72); + private static final Factory<MessageAnnotations> FACTORY = MessageAnnotationsWriter::new; public MessageAnnotationsWriter(final Registry registry, final MessageAnnotations object) @@ -40,19 +39,8 @@ public class MessageAnnotationsWriter extends AbstractDescribedTypeWriter<Messag super(DESCRIPTOR_WRITER, registry.getValueWriter(object.getValue())); } - private static final Factory<MessageAnnotations> FACTORY = new Factory<MessageAnnotations>() - { - - @Override - public ValueWriter<MessageAnnotations> newInstance(final Registry registry, final MessageAnnotations object) - { - return new MessageAnnotationsWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(MessageAnnotations.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ModifiedWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ModifiedWriter.java index 9176f8130a..4c6e69db9b 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ModifiedWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ModifiedWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,13 +32,13 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.Modified; public class ModifiedWriter extends AbstractDescribedTypeWriter<Modified> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x27); + private static final Factory<Modified> FACTORY = ModifiedWriter::new; public ModifiedWriter(final Registry registry, final Modified object) { super(DESCRIPTOR_WRITER, new Writer(registry, object)); } - private static class Writer extends AbstractListWriter<Modified> { private int _field; @@ -114,19 +112,8 @@ public class ModifiedWriter extends AbstractDescribedTypeWriter<Modified> } } - private static final Factory<Modified> FACTORY = new Factory<Modified>() - { - - @Override - public ValueWriter<Modified> newInstance(final Registry registry, final Modified object) - { - return new ModifiedWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Modified.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/NoLocalFilterWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/NoLocalFilterWriter.java index 45ab03ac2e..fab2195b78 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/NoLocalFilterWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/NoLocalFilterWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -33,25 +31,15 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.NoLocalFilter; public class NoLocalFilterWriter extends AbstractDescribedTypeWriter<NoLocalFilter> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter(0x0000468C00000003L); + private static final Factory<NoLocalFilter> FACTORY = (registry, object) -> new NoLocalFilterWriter(registry); public NoLocalFilterWriter(final Registry registry) { super(DESCRIPTOR_WRITER, ListWriter.EMPTY_LIST_WRITER); } - private static final Factory<NoLocalFilter> FACTORY = new Factory<NoLocalFilter>() - { - - @Override - public ValueWriter<NoLocalFilter> newInstance(final Registry registry, final NoLocalFilter object) - { - return new NoLocalFilterWriter(registry); - } - }; - public static void register(Registry registry) { registry.register(NoLocalFilter.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/PropertiesWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/PropertiesWriter.java index 0a7dac45dd..f3624010c1 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/PropertiesWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/PropertiesWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,13 +32,13 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.Properties; public class PropertiesWriter extends AbstractDescribedTypeWriter<Properties> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x73); + private static final Factory<Properties> FACTORY = PropertiesWriter::new; public PropertiesWriter(final Registry registry, final Properties object) { super(DESCRIPTOR_WRITER, new Writer(registry, object)); } - private static class Writer extends AbstractListWriter<Properties> { private int _field; @@ -194,19 +192,8 @@ public class PropertiesWriter extends AbstractDescribedTypeWriter<Properties> } } - private static final Factory<Properties> FACTORY = new Factory<Properties>() - { - - @Override - public ValueWriter<Properties> newInstance(final Registry registry, final Properties object) - { - return new PropertiesWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Properties.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReceivedWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReceivedWriter.java index cf068be0f4..5380761f03 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReceivedWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReceivedWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,7 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.Received; public class ReceivedWriter extends AbstractDescribedTypeWriter<Received> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x23); - + private static final Factory<Received> FACTORY = ReceivedWriter::new; private ReceivedWriter(final Registry registry, final Received object) { @@ -106,19 +104,8 @@ public class ReceivedWriter extends AbstractDescribedTypeWriter<Received> } } - private static final Factory<Received> FACTORY = new Factory<Received>() - { - - @Override - public ValueWriter<Received> newInstance(final Registry registry, final Received object) - { - return new ReceivedWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Received.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/RejectedWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/RejectedWriter.java index 66a881f7c7..f8d723211b 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/RejectedWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/RejectedWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.Rejected; public class RejectedWriter extends AbstractDescribedTypeWriter<Rejected> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x25); + private static final Factory<Rejected> FACTORY = RejectedWriter::new; private RejectedWriter(final Registry registry, final Rejected object) { @@ -98,19 +97,8 @@ public class RejectedWriter extends AbstractDescribedTypeWriter<Rejected> } } - private static final Factory<Rejected> FACTORY = new Factory<Rejected>() - { - - @Override - public ValueWriter<Rejected> newInstance(final Registry registry, final Rejected object) - { - return new RejectedWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Rejected.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReleasedWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReleasedWriter.java index 58a95be235..b8f3058389 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReleasedWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/ReleasedWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -33,25 +31,15 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.Released; public class ReleasedWriter extends AbstractDescribedTypeWriter<Released> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x26); + private static final Factory<Released> FACTORY = (registry, object) -> new ReleasedWriter(registry); private ReleasedWriter(final Registry registry) { super(DESCRIPTOR_WRITER, ListWriter.EMPTY_LIST_WRITER); } - private static final Factory<Released> FACTORY = new Factory<Released>() - { - - @Override - public ValueWriter<Released> newInstance(final Registry registry, final Released object) - { - return new ReleasedWriter(registry); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Released.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/SourceWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/SourceWriter.java index a154301ee9..66a8899cf7 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/SourceWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/SourceWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.Source; public class SourceWriter extends AbstractDescribedTypeWriter<Source> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x28); + private static final Factory<Source> FACTORY = SourceWriter::new; private SourceWriter(final Registry registry, final Source object) { @@ -177,19 +176,8 @@ public class SourceWriter extends AbstractDescribedTypeWriter<Source> } } - private static final Factory<Source> FACTORY = new Factory<Source>() - { - - @Override - public ValueWriter<Source> newInstance(final Registry registry, final Source object) - { - return new SourceWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Source.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/TargetWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/TargetWriter.java index 5abe6f86ab..f3d6eccf56 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/TargetWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/messaging/codec/TargetWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.messaging.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.messaging.Target; public class TargetWriter extends AbstractDescribedTypeWriter<Target> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x29); + private static final Factory<Target> FACTORY = TargetWriter::new; public TargetWriter(final Registry registry, final Target object) { @@ -145,19 +144,8 @@ public class TargetWriter extends AbstractDescribedTypeWriter<Target> } } - private static final Factory<Target> FACTORY = new Factory<Target>() - { - - @Override - public ValueWriter<Target> newInstance(final Registry registry, final Target object) - { - return new TargetWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Target.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslChallengeWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslChallengeWriter.java index 72c0dd7251..de67d83ad5 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslChallengeWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslChallengeWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.security.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.security.SaslChallenge; public class SaslChallengeWriter extends AbstractDescribedTypeWriter<SaslChallenge> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x42); + private static final Factory<SaslChallenge> FACTORY = SaslChallengeWriter::new; private SaslChallengeWriter(final Registry registry, final SaslChallenge object) @@ -97,19 +96,8 @@ public class SaslChallengeWriter extends AbstractDescribedTypeWriter<SaslChallen } } - private static final Factory<SaslChallenge> FACTORY = new Factory<SaslChallenge>() - { - - @Override - public ValueWriter<SaslChallenge> newInstance(final Registry registry, final SaslChallenge object) - { - return new SaslChallengeWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(SaslChallenge.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslInitWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslInitWriter.java index 2785e00683..35f61bc4b2 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslInitWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslInitWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.security.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.security.SaslInit; public class SaslInitWriter extends AbstractDescribedTypeWriter<SaslInit> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x41); + private static final Factory<SaslInit> FACTORY = SaslInitWriter::new; private SaslInitWriter(final Registry registry, final SaslInit object) { @@ -111,19 +110,8 @@ public class SaslInitWriter extends AbstractDescribedTypeWriter<SaslInit> } } - private static final Factory<SaslInit> FACTORY = new Factory<SaslInit>() - { - - @Override - public ValueWriter<SaslInit> newInstance(final Registry registry, final SaslInit object) - { - return new SaslInitWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(SaslInit.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslMechanismsWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslMechanismsWriter.java index 9a50d070fd..5c2e84c024 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslMechanismsWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslMechanismsWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.security.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,9 +32,9 @@ import org.apache.qpid.server.protocol.v1_0.type.security.SaslMechanisms; public class SaslMechanismsWriter extends AbstractDescribedTypeWriter<SaslMechanisms> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x40); + private static final Factory<SaslMechanisms> FACTORY = SaslMechanismsWriter::new; - private SaslMechanismsWriter(final Registry registry, - final SaslMechanisms object) + private SaslMechanismsWriter(final Registry registry, final SaslMechanisms object) { super(DESCRIPTOR_WRITER, new Writer(registry, object)); @@ -97,19 +95,8 @@ public class SaslMechanismsWriter extends AbstractDescribedTypeWriter<SaslMechan } } - private static final Factory<SaslMechanisms> FACTORY = new Factory<SaslMechanisms>() - { - - @Override - public ValueWriter<SaslMechanisms> newInstance(final Registry registry, final SaslMechanisms object) - { - return new SaslMechanismsWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(SaslMechanisms.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslOutcomeWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslOutcomeWriter.java index 40b9b2a332..3d336a8122 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslOutcomeWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslOutcomeWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.security.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.security.SaslOutcome; public class SaslOutcomeWriter extends AbstractDescribedTypeWriter<SaslOutcome> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x44); + private static final Factory<SaslOutcome> FACTORY = SaslOutcomeWriter::new; private SaslOutcomeWriter(final Registry registry, final SaslOutcome object) { @@ -104,19 +103,8 @@ public class SaslOutcomeWriter extends AbstractDescribedTypeWriter<SaslOutcome> } } - private static final Factory<SaslOutcome> FACTORY = new Factory<SaslOutcome>() - { - - @Override - public ValueWriter<SaslOutcome> newInstance(final Registry registry, final SaslOutcome object) - { - return new SaslOutcomeWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(SaslOutcome.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslResponseWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslResponseWriter.java index f37413cf0f..6c7d4b24f6 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslResponseWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/security/codec/SaslResponseWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.security.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,7 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.security.SaslResponse; public class SaslResponseWriter extends AbstractDescribedTypeWriter<SaslResponse> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x43); - + private static final Factory<SaslResponse> FACTORY = SaslResponseWriter::new; private SaslResponseWriter(final Registry registry, final SaslResponse object) { @@ -98,19 +96,8 @@ public class SaslResponseWriter extends AbstractDescribedTypeWriter<SaslResponse } } - private static final Factory<SaslResponse> FACTORY = new Factory<SaslResponse>() - { - - @Override - public ValueWriter<SaslResponse> newInstance(final Registry registry, final SaslResponse object) - { - return new SaslResponseWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(SaslResponse.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/CoordinatorWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/CoordinatorWriter.java index e09e6c1600..1e5963f5e2 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/CoordinatorWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/CoordinatorWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.transaction.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,7 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transaction.Coordinator; public class CoordinatorWriter extends AbstractDescribedTypeWriter<Coordinator> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x30); - + private static final Factory<Coordinator> FACTORY = CoordinatorWriter::new; private CoordinatorWriter(final Registry registry, final Coordinator object) { @@ -98,19 +96,8 @@ public class CoordinatorWriter extends AbstractDescribedTypeWriter<Coordinator> } } - private static final Factory<Coordinator> FACTORY = new Factory<Coordinator>() - { - - @Override - public ValueWriter<Coordinator> newInstance(final Registry registry, final Coordinator object) - { - return new CoordinatorWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Coordinator.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclareWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclareWriter.java index 530c899d41..6f6f5f6204 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclareWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclareWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.transaction.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transaction.Declare; public class DeclareWriter extends AbstractDescribedTypeWriter<Declare> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x31); + private static final Factory<Declare> FACTORY = DeclareWriter::new; private DeclareWriter(final Registry registry, final Declare object) { @@ -97,19 +96,8 @@ public class DeclareWriter extends AbstractDescribedTypeWriter<Declare> } } - private static final Factory<Declare> FACTORY = new Factory<Declare>() - { - - @Override - public ValueWriter<Declare> newInstance(final Registry registry, final Declare object) - { - return new DeclareWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Declare.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclaredWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclaredWriter.java index be85da3fbf..b7cbc74386 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclaredWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DeclaredWriter.java @@ -34,7 +34,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transaction.Declared; public class DeclaredWriter extends AbstractDescribedTypeWriter<Declared> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x33); - + private static final Factory<Declared> FACTORY = DeclaredWriter::new; private DeclaredWriter(final Registry registry, final Declared object) { @@ -99,19 +99,8 @@ public class DeclaredWriter extends AbstractDescribedTypeWriter<Declared> } } - private static final Factory<Declared> FACTORY = new Factory<Declared>() - { - - @Override - public ValueWriter<Declared> newInstance(final Registry registry, final Declared object) - { - return new DeclaredWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Declared.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DischargeWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DischargeWriter.java index 9579743ba1..f4eb5ad02d 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DischargeWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/DischargeWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.transaction.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transaction.Discharge; public class DischargeWriter extends AbstractDescribedTypeWriter<Discharge> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x32); + private static final Factory<Discharge> FACTORY = DischargeWriter::new; private DischargeWriter(final Registry registry, final Discharge object) { @@ -106,19 +105,8 @@ public class DischargeWriter extends AbstractDescribedTypeWriter<Discharge> } } - private static final Factory<Discharge> FACTORY = new Factory<Discharge>() - { - - @Override - public ValueWriter<Discharge> newInstance(final Registry registry, final Discharge object) - { - return new DischargeWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Discharge.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/TransactionalStateWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/TransactionalStateWriter.java index 775f5831dc..557d824179 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/TransactionalStateWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transaction/codec/TransactionalStateWriter.java @@ -32,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transaction.TransactionalState; public class TransactionalStateWriter extends AbstractDescribedTypeWriter<TransactionalState> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x34); + private static final Factory<TransactionalState> FACTORY = TransactionalStateWriter::new; private TransactionalStateWriter(final Registry registry, final TransactionalState object) { @@ -104,19 +105,8 @@ public class TransactionalStateWriter extends AbstractDescribedTypeWriter<Transa } } - private static final Factory<TransactionalState> FACTORY = new Factory<TransactionalState>() - { - - @Override - public ValueWriter<TransactionalState> newInstance(final Registry registry, final TransactionalState object) - { - return new TransactionalStateWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(TransactionalState.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/AttachWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/AttachWriter.java index d11569e959..36a878621c 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/AttachWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/AttachWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.transport.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.Attach; public class AttachWriter extends AbstractDescribedTypeWriter<Attach> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x12); + private static final Factory<Attach> FACTORY = AttachWriter::new; private AttachWriter(final Registry registry, final Attach object) { @@ -202,19 +201,8 @@ public class AttachWriter extends AbstractDescribedTypeWriter<Attach> } } - private static final Factory<Attach> FACTORY = new Factory<Attach>() - { - - @Override - public ValueWriter<Attach> newInstance(final Registry registry, final Attach object) - { - return new AttachWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Attach.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/BeginWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/BeginWriter.java index 696fdc801c..6bbb16c4fe 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/BeginWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/BeginWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.transport.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.Begin; public class BeginWriter extends AbstractDescribedTypeWriter<Begin> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x11); + private static final Factory<Begin> FACTORY = BeginWriter::new; private BeginWriter(final Registry registry, Begin object) { @@ -157,19 +156,8 @@ public class BeginWriter extends AbstractDescribedTypeWriter<Begin> } } - private static final Factory<Begin> FACTORY = new Factory<Begin>() - { - - @Override - public ValueWriter<Begin> newInstance(final Registry registry, final Begin object) - { - return new BeginWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Begin.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/CloseWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/CloseWriter.java index a9ca6d1150..038aff452b 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/CloseWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/CloseWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.transport.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,7 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.Close; public class CloseWriter extends AbstractDescribedTypeWriter<Close> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x18); - + private static final Factory<Close> FACTORY = CloseWriter::new; private CloseWriter(final Registry registry, final Close object) { @@ -99,16 +97,6 @@ public class CloseWriter extends AbstractDescribedTypeWriter<Close> } } - private static final Factory<Close> FACTORY = new Factory<Close>() - { - - @Override - public ValueWriter<Close> newInstance(final Registry registry, final Close object) - { - return new CloseWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Close.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DetachWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DetachWriter.java index a76572b742..5ead5386da 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DetachWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DetachWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.transport.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.Detach; public class DetachWriter extends AbstractDescribedTypeWriter<Detach> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x16); + private static final Factory<Detach> FACTORY = DetachWriter::new; private DetachWriter(final Registry registry, final Detach object) { @@ -114,19 +113,8 @@ public class DetachWriter extends AbstractDescribedTypeWriter<Detach> } } - private static final Factory<Detach> FACTORY = new Factory<Detach>() - { - - @Override - public ValueWriter<Detach> newInstance(final Registry registry, final Detach object) - { - return new DetachWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Detach.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DispositionWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DispositionWriter.java index 195b2a27e6..19140e056a 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DispositionWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/DispositionWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.transport.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,7 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.Disposition; public class DispositionWriter extends AbstractDescribedTypeWriter<Disposition> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x15); - + private static final Factory<Disposition> FACTORY = DispositionWriter::new; private DispositionWriter(final Registry registry, final Disposition object) { @@ -140,19 +138,8 @@ public class DispositionWriter extends AbstractDescribedTypeWriter<Disposition> } } - private static final Factory<Disposition> FACTORY = new Factory<Disposition>() - { - - @Override - public ValueWriter<Disposition> newInstance(final Registry registry, final Disposition object) - { - return new DispositionWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Disposition.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/EndWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/EndWriter.java index 2f2697a658..f321e0d15e 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/EndWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/EndWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.transport.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.End; public class EndWriter extends AbstractDescribedTypeWriter<End> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x17); + private static final Factory<End> FACTORY = EndWriter::new; private EndWriter(final Registry registry, final End object) { @@ -97,16 +96,6 @@ public class EndWriter extends AbstractDescribedTypeWriter<End> } } - private static final Factory<End> FACTORY = new Factory<End>() - { - - @Override - public ValueWriter<End> newInstance(final Registry registry, final End object) - { - return new EndWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(End.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/ErrorWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/ErrorWriter.java index 0401ce5692..1111b5e71f 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/ErrorWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/ErrorWriter.java @@ -34,6 +34,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.Error; public class ErrorWriter extends AbstractDescribedTypeWriter<Error> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x1D); + private static final Factory<Error> FACTORY = ErrorWriter::new; private ErrorWriter(final Registry registry, final Error object) { @@ -112,16 +113,6 @@ public class ErrorWriter extends AbstractDescribedTypeWriter<Error> } } - private static final Factory<Error> FACTORY = new Factory<Error>() - { - - @Override - public ValueWriter<Error> newInstance(final Registry registry, final Error object) - { - return new ErrorWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Error.class, FACTORY); diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/FlowWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/FlowWriter.java index 1f40a31a8b..697a0cb3aa 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/FlowWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/FlowWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.transport.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.Flow; public class FlowWriter extends AbstractDescribedTypeWriter<Flow> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x13); + private static final Factory<Flow> FACTORY = FlowWriter::new; private FlowWriter(final Registry registry, final Flow object) { @@ -179,19 +178,8 @@ public class FlowWriter extends AbstractDescribedTypeWriter<Flow> } } - private static final Factory<Flow> FACTORY = new Factory<Flow>() - { - - @Override - public ValueWriter<Flow> newInstance(final Registry registry, final Flow object) - { - return new FlowWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Flow.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/OpenWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/OpenWriter.java index 6fbe97584b..2e36bc5bee 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/OpenWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/OpenWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.transport.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,6 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.Open; public class OpenWriter extends AbstractDescribedTypeWriter<Open> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x10); + private static final Factory<Open> FACTORY = OpenWriter::new; private OpenWriter(final Registry registry, final Open object) { @@ -170,19 +169,8 @@ public class OpenWriter extends AbstractDescribedTypeWriter<Open> } } - private static final Factory<Open> FACTORY = new Factory<Open>() - { - - @Override - public ValueWriter<Open> newInstance(final Registry registry, final Open object) - { - return new OpenWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Open.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/TransferWriter.java b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/TransferWriter.java index 412a00ac4b..4ef23e335b 100644 --- a/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/TransferWriter.java +++ b/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/type/transport/codec/TransferWriter.java @@ -1,4 +1,3 @@ - /* * * Licensed to the Apache Software Foundation (ASF) under one @@ -20,7 +19,6 @@ * */ - package org.apache.qpid.server.protocol.v1_0.type.transport.codec; import org.apache.qpid.server.protocol.v1_0.codec.AbstractDescribedTypeWriter; @@ -34,7 +32,7 @@ import org.apache.qpid.server.protocol.v1_0.type.transport.Transfer; public class TransferWriter extends AbstractDescribedTypeWriter<Transfer> { private static final ValueWriter<UnsignedLong> DESCRIPTOR_WRITER = UnsignedLongWriter.getWriter((byte) 0x14); - + private static final Factory<Transfer> FACTORY = TransferWriter::new; private TransferWriter(final Registry registry, final Transfer object) { @@ -179,19 +177,8 @@ public class TransferWriter extends AbstractDescribedTypeWriter<Transfer> } } - private static final Factory<Transfer> FACTORY = new Factory<Transfer>() - { - - @Override - public ValueWriter<Transfer> newInstance(final Registry registry, final Transfer object) - { - return new TransferWriter(registry, object); - } - }; - public static void register(ValueWriter.Registry registry) { registry.register(Transfer.class, FACTORY); } - } diff --git a/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/SendingLinkEndpointTest.java b/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/SendingLinkEndpointTest.java index 811737fd8e..3673780253 100644 --- a/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/SendingLinkEndpointTest.java +++ b/broker-plugins/amqp-1-0-protocol/src/test/java/org/apache/qpid/server/protocol/v1_0/SendingLinkEndpointTest.java @@ -28,7 +28,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.apache.qpid.server.message.MessageSource; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org