private void addComponent(
     Map<RoleHint<?>, ComponentDescriptor<?>> descriptorMap,
     Map<RoleHint<?>, Integer> priorityMap,
     RoleHint<?> roleHint,
     ComponentDescriptor<?> componentDescriptor,
     ComponentDeclaration componentDeclaration,
     boolean warn) {
   if (descriptorMap.containsKey(roleHint)) {
     // Compare priorities
     int currentPriority = priorityMap.get(roleHint);
     if (componentDeclaration.getPriority() < currentPriority) {
       // Override!
       descriptorMap.put(roleHint, componentDescriptor);
       priorityMap.put(roleHint, componentDeclaration.getPriority());
     } else if (componentDeclaration.getPriority() == currentPriority) {
       if (warn) {
         // Warning that we're not overwriting since they have the same priorities
         getLogger()
             .warn(
                 "Component [{}] which implements [{}] tried to overwrite component "
                     + "[{}]. However, no action was taken since both components have the same priority "
                     + "level of [{}].",
                 new Object[] {
                   componentDeclaration.getImplementationClassName(),
                   roleHint,
                   descriptorMap.get(roleHint).getImplementation().getName(),
                   currentPriority
                 });
       }
     } else {
       getLogger()
           .debug(
               "Ignored component [{}] since its priority level of [{}] is lower "
                   + "than the currently registered component [{}] which has a priority of [{}]",
               new Object[] {
                 componentDeclaration.getImplementationClassName(),
                 componentDeclaration.getPriority(),
                 currentPriority
               });
     }
   } else {
     descriptorMap.put(roleHint, componentDescriptor);
     priorityMap.put(roleHint, componentDeclaration.getPriority());
   }
 }
 @Override
 public boolean equals(Object object) {
   if (object == null) {
     return false;
   }
   if (object == this) {
     return true;
   }
   if (object.getClass() != getClass()) {
     return false;
   }
   ComponentDeclaration rhs = (ComponentDeclaration) object;
   return new EqualsBuilder()
       .append(getImplementationClassName(), rhs.getImplementationClassName())
       .append(getPriority(), rhs.getPriority())
       .isEquals();
 }