Skip to content

Commit

Permalink
Added "clearItems()" to MappedNode
Browse files Browse the repository at this point in the history
  • Loading branch information
EricWittmann committed Jan 6, 2025
1 parent fa0767d commit 24e64c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,16 @@ protected void createMappedNodeMethods(JavaSource<?> javaEntity, PropertyModelWi
body.append("return this._items.remove(name);");
method.setBody(body.toString());
}

// void clearItems()
{
MethodSource<?> method = ((MethodHolderSource<?>) javaEntity).addMethod().setName("clearItems").setPublic();
method.addAnnotation(Override.class);
method.setReturnTypeVoid();
BodyBuilder body = new BodyBuilder();
body.append("this._items.clear();");
method.setBody(body.toString());
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,9 @@ public interface MappedNode<T> {
*/
public T removeItem(String name);

/**
* Removes all children.
*/
public void clearItems();

}

0 comments on commit 24e64c3

Please sign in to comment.