WIP: add Message-Components handling/registry #21
| @@ -1,6 +1,5 @@ | |||||||
| package net.tomatentum.marinara.registry; | package net.tomatentum.marinara.registry; | ||||||
|  |  | ||||||
| import java.util.Arrays; |  | ||||||
| import java.util.HashSet; | import java.util.HashSet; | ||||||
| import java.util.Optional; | import java.util.Optional; | ||||||
| import java.util.Set; | import java.util.Set; | ||||||
| @@ -35,15 +34,13 @@ public class InteractionEntry { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public InteractionEntry addMethod(InteractionMethod method) { |     public InteractionEntry addMethod(InteractionMethod method) { | ||||||
|         Optional<InteractionIdentifier> methodId = Arrays.stream(method.identifier()) |         InteractionIdentifier identifier = method.identifier(); | ||||||
|             .filter(x -> x.name().equals(identifier().name())) |  | ||||||
|             .findFirst(); |  | ||||||
|  |  | ||||||
|         if (methodId.isEmpty()) |         if (this.identifier().equals(identifier)) | ||||||
|             throw new IllegalArgumentException("Method's identifiers did not contain the entry's identifier"); |             throw new IllegalArgumentException("Method's identifier did not equal the entry's identifier"); | ||||||
|  |  | ||||||
|         this.methods.add(method); |         this.methods.add(method); | ||||||
|         InteractionIdentifier.tryAddDescriptions(identifier, methodId.get()); |         InteractionIdentifier.tryAddDescriptions(identifier, identifier); | ||||||
|         logger.debug("Added method {} to entry {}", method.method().getName(), this.identifier); |         logger.debug("Added method {} to entry {}", method.method().getName(), this.identifier); | ||||||
|         return this; |         return this; | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user