55.4. Nullable Options

download PDF


In some cases, it can make sense to let method arguments default to null. But this is not allowed by default. If you want to allow some of your method arguments from the Java API to take null values, you must declare this explicitly using the nullableOptions element.


The nullableOptions element can be defined with one or more nullableOption child elements, as follows:
Where ArgumentName is the name of a method argument from the Java API.


As shown in the following extract, the nullableOptions element can optionally appear as a child of the apis element and/or as a child of api elements:
You can define the nullableOptions element at the following scopes:
  • As a child of an api element—the nullableOptions mappings apply only to the API class specified by the api element.
  • As a child of the apis element—the nullableOptions mappings apply to all API classes by default, but can be overridden at the api level.


The following example shows the nullable options declared for the CompaniesResource proxy class from the Apache Camel LinkedIn component:
Red Hat logoGithubRedditYoutubeTwitter


Try, buy, & sell


About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.