com.intershop.oms.rest.shared.StringUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of iom-test-framework Show documentation
Show all versions of iom-test-framework Show documentation
An "SDK"-style library improving test automation for Intershop Order Management.
/*
* IOM Order API
* The IOM Order API allows to create orders, view orders, create change requests and view change requests for an order. Furthermore, it is possible to search for order states. ## Changelog - - - ### Version 2.4 * Added new end point `/shops/{shopId}/order-states/modified`. - - - ### Version 2.3 * Added optional search filter `emails` to retrieve `order-states`. - - - ### Version 2.2 * Added operation `getOrder`. * Added operations `createChangeRequest`, `getChangeRequest` and `getChangeRequestViewList`. * Added undocumented constraints to `Price`, `ListPrice`, `UnitPrice`. `net` must not be greater than `gross`, `amountDiscounted` must not be greater than `amount`. * Added undocumented constraint to `OrderPosition`. Optional `number` must not be negative. * Added undocumented attributes to `OrderPositionReturned`. Added `OrderPositionReturnedQuantities` and `OrderPositionReturnedUnits`. - - - ### Version 2.1 * Extended `Tax`. An unknown `type` can be submitted when adding `rate` and `location`. * Added undocumented constraint to `Tax`. `type` has a max length of 512 characters. * Added undocumented constraint. In a list of `Tax` (taxes), each type is allowed once only. * Exceeded length of attributes in `Promotion`. `id` has a max length of 512 `characters`. `name`, `descriptorId`, `code` and `budgetSourceId` have a max length of 1024 characters.
*
* The version of the OpenAPI document: 2.4
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.intershop.oms.rest.shared;
import java.util.Collection;
import java.util.Iterator;
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).
*
* @param array The array
* @param value The value to search
* @return true if the array contains the value
*/
public static boolean containsIgnoreCase(String[] array, String value) {
for (String str : array) {
if (value == null && str == null) {
return true;
}
if (value != null && value.equalsIgnoreCase(str)) {
return true;
}
}
return false;
}
/**
* Join an array of strings with the given separator.
*
* Note: This might be replaced by utility method from commons-lang or guava someday
* if one of those libraries is added as dependency.
*
*
* @param array The array of strings
* @param separator The separator
* @return the resulting string
*/
public static String join(String[] array, String separator) {
int len = array.length;
if (len == 0) {
return "";
}
StringBuilder out = new StringBuilder();
out.append(array[0]);
for (int i = 1; i < len; i++) {
out.append(separator).append(array[i]);
}
return out.toString();
}
/**
* Join a list of strings with the given separator.
*
* @param list The list of strings
* @param separator The separator
* @return the resulting string
*/
public static String join(Collection list, String separator) {
Iterator iterator = list.iterator();
StringBuilder out = new StringBuilder();
if (iterator.hasNext()) {
out.append(iterator.next());
}
while (iterator.hasNext()) {
out.append(separator).append(iterator.next());
}
return out.toString();
}
}