Skip to content
Marten Prieß edited this page Aug 14, 2019 · 1 revision

Additionally to the already mentioned RunTimeException and PageableResults + ErrorResponses the api contains some extra utils.

AbstractCrudRestResource

Provides a preconfigured REST-client for the CrudController. Internally it uses the spring RestTemplate.

You only need to provide the baseApiUrl where the service is deployed. All CRUD opertations are already integrated.

AbstractCrudChildRestResource

Same as the CrudRestResource. Additionally you need to specify the path name of the child.

Translation

Is an object to deal with translations. It extends a Map<Locale, String> and provides jacksons De/Serializer.

{
  "en": "Welcome",
  "de": "Willkommen"
}

Additionally a ValidationAnnotation is available that checks if within the Translation the Englisch language is present. @HasDefaultLocale

Nulls

It's a short null check util with some static methods:

  • notNull(value, fallback)

    • in case the value is null it will retun the fallback
  • notEmpty(value, fallback)

    • in case the value is null or empty - return the fallback
  • notNull(value, provider, fallback)

    • the value is any object and with the given provider you specify the property of the value you would like to get returend

    • this method checks if object or property is null and will return fallback otherwise

    • Nulls.notEmpty(user, AppUserRead::getUsername, "unkown")
Clone this wiki locally