When you have finished defining the inputs and output for the custom
visual snippet, you must add the required elements.
In this topic, you learn how to add the required elements to the
IsListEmpty custom visual snippet. When you have finished adding the elements,
the visual snippet editor should resemble the following figure:

To add the required elements to the custom visual snippet:
- Add the list variable:
- In the visual snippet editor tray, click the list input
as shown in the following figure:

- Hold the mouse button down on the list input
and drag it to the upper left corner of the visual snippet editor canvas.
- Release the mouse button. The list input is added to
the canvas.
Note: When you add an element to the visual snippet editor canvas, you
can hover over the element to display its properties in hover help text, as
shown in the following figure:

- Add the size Java visual snippet to return
the number of elements in the list:
- In the visual snippet editor palette, click the Java icon
.
The Select a Java Visual Snippet window opens.
- In the Specify a type (? = any character, * = any
String) field, type java.util.list.
- In the Matching types list, select List.
- In the Qualifier list, select java.util
- installDir/runtimes/bi_v6/java/jre/lib/core.jar (where installDir is
the install path of WebSphere Integration Developer).
- In the Select a visual snippet list,
scroll down and select size().
- Click OK.
- Click the canvas under the list variable.
The size Java visual snippet is added to the canvas.
Note: You can add a Java visual snippet directly to the visual snippet
editor canvas or you can add it to an existing element in the visual snippet
editor canvas.
- Add the length expression:
- In the palette, click the Expression icon
.
- Click the canvas under the size Java
visual snippet. The expression is added to the canvas.
- In the expression, type length.
Note: Expressions pass a variety of user-defined values to custom visual
snippets. An expression can be visually composed using the expression builder.
- Add another length expression:
- In the palette, click the Expression icon
.
- Click the canvas under the existing length expression.
The new expression is added to the canvas.
- In the expression, type length.
- Add the equal to standard visual snippet:
- In the palette, click the Standard icon
. The Add a Standard
Visual Snippet window opens.
- In the Standard Visual Snippets list,
expand the math folder and select equal
to.
- Click OK.
- Click the canvas under the bottom length expression.
The equal to standard visual snippet is added to the
canvas.
Note: Standard visual snippets are comprised of predefined visual snippets
from the visual snippets library plus user-defined custom visual snippets.
When you add a standard visual snippet to the visual snippet editor canvas,
you will find that you cannot edit a predefined visual snippet from the visual
snippets library but you can edit a user-defined custom visual snippet by
double-clicking it.
- Add the 0 (zero) expression:
- In the palette, click the Expression icon
.
- Click the canvas under the equal to standard
visual snippet. The expression is added to the canvas.
- In the expression, type the number 0.
- Add the return node to return the result
for the custom visual snippet:
- In the palette, click the Return icon
.
- Click the canvas area under the 0 expression.
The Return node is added to the canvas.
The required elements have now been added to the custom visual snippet.