Add Component from Class?

I’m working on a project where I’m adding actorComponents to actors in order to give them various properties. My current process (blueprint) is just matching branches like: IF class = A_node, add A Node(component), if false, check against next class and so on.

The problem with this is that the list gets long. Is there a way to do this much like one would spawn an actor from a class? I would like to be able to just input a class variable and programmatically add components - but I can’t find a way to do so without just making a huge if/else chain.

Iam not entirely sure what you exactly try to achieve… Do you want to add components to your BluePrintClass or spawn actors in the world?
The latter is easily achieved by the SpawnActorFromClass node…

I’m very well aware of that.
I have three types of actors:
I have a generic actor class where each actor has only a static mesh.
I have a class of actor components called 'behaviors.
I have other ‘application’ actors.

In game, the player can use the application actor to apply the behavior to the generic actor by adding the component to it.
My parent class (pic) for the application actor looks at: " Is my behavior class to apply in the array of total possible behavior classes, and if so, is it type A (branch), type B(branch), type C(branch), Type D(branch) . In the case of true, A,B,C or D is added.

The problem is that I can only add components that do specific things. I can’t seem to create a method to spawn a parent class, and then change the class to spawn the component. If I were do do this with actors, I would be able to do spawn actors as class with a parent class var specified and all children would spawn fine if i changed the value of the class variable. I don’t need to specify each one, only making sure that the children spawn. For instance, spawning a projectile I can change the value of the spawned class to be a number of projectile child actors.

Why is it different for actorComponents? Is there a way to do this without ending up with a massively branched out tree of specifically defined components?

I also really need an answer to this question.

Unfortunately the only thing i could find is this:

And i have very little experience with c++ and don’t know how to set this up properly. Previous attempts to try and use this have just left me with a “cast to” node and not an actual usable node in blueprints.