# Java Filter

## ![](/files/abUf8QhiMQMZpKyaCDKM) Java Filter

### Description <a href="#description" id="description"></a>

The Java Filter transform allows the stream to be filtered using a user defined Java expressions.

The input stream, coming from one or more transforms, can be redirected to two different transforms based on the evaluation of the written expression.

In other words, the user is able to perform an if-statement to filter the data stream with pure java expressions:

```
if( Condition )
  {matching-transform}
else
  {non-matching transform}
```

| Hop Engine | <sup>✓</sup> |
| ---------- | ------------ |
| Spark      | ?            |
| Flink      | ?            |
| Dataflow   | ?            |

### Options

| Option                                                 | Description                                                                                |
| ------------------------------------------------------ | ------------------------------------------------------------------------------------------ |
| Transform name                                         | Name of the transform this name has to be unique in a single pipeline.                     |
| Destination transform for matching rows (optional)     | The rows for which the written condition is evaluated to true are sent to this transform.  |
| Destination transform for non-matching rows (optional) | The rows for which the written condition is evaluated to false are sent to this transform. |
| Condition (Java Expression)                            | Defines the Java condition on which to filter the data. See examples below.                |

#### Examples

These code samples applies to the Condition (Java Expression) field.

Filters a string that contains white space

```highlight
field.contains(" ");
```

Filters a string that is identical to a constant string

```highlight
field.equals("Positive");
```

Filters a boolean value

```highlight
field == Boolean.TRUE
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.primeur.com/data-shaper-1.21/knowing-the-data-shaper-designer/pipelines/transforms/javafilter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
