Communication between different ProgramNodeContribution Classes

I have a URCap which generates child nodes, which I have built to have their own view/service/contribution classes, but I am struggling to get the contribution class of the child node to access variables and methods in the contribution class of the parent node. I am simply trying to write the title of the children nodes to be ChildNode1, ChildNode2 etc, depending on how many children there are. The relevant code is below

Child contribution class:

public class ChildContribution implements ProgramNodeContribution
{
    private ContributionProvider<ParentNodeContribution> contributor;

//some code

public String getTitle()
{
    int children = contributor.get().childrenCount();
    return("ChildNode" + children);
}

//more code

}

Parent Contribution class:

public class ParentContribution implements ProgramNodeContribution
{
    public int childrenCount()
    {
    ProgramAPI programAPI = apiProvider.getProgramAPI();
    ProgramModel programModel = programAPI.getProgramModel();
	model.set("children", programModel.getRootTreeNode(this).getChildren().size());
	return programModel.getRootTreeNode(this).getChildren().size();
    }
}

However whenever I run the code and generate a new child node, it tells my that getTitle has a null pointer exception error.

I know the childrenCount () method runs as intended because i can access it and print its results to JLabels in the ParentNodeView class.

Can anyone offer a solution?
Thanks in advance.

Generally speaking, the parent node can access the child nodes.
But the child nodes cannot get or modify parents or siblings.

In order for the parent node to get the child nodes, you should use the ProgramNodeVisitor to visit any URCap program node child.
Then, each of these children should implement a URCap proprietary API.
And if the parent canGetAs() on these child URCap nodes, they are an instance of the desired child node type.
The nodes can then be configured using the methods provided by this proprietary API.

An example of this implementation can be found in this example:

Btw, I am a bit in doubt of the usage of your ContributionProvider in the child node contribution.
The purpose of the ContributionProvider, is to provide access to an active contribution from the View-class.
And the usage displayed here, is probably not supported.