001/******************************************************************************* 002 * Copyright (c) 2017 Red Hat Inc and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Red Hat Inc - initial API and implementation 011 *******************************************************************************/ 012package org.eclipse.kapua.gateway.client.utils; 013 014public final class Strings { 015 016 private Strings() { 017 } 018 019 public static String nonEmptyText(final String string, final String fieldName) { 020 if (string == null || string.isEmpty()) { 021 throw new IllegalArgumentException(String.format("'%s' must not be null or empty", fieldName)); 022 } 023 return string; 024 } 025 026}