Class Constants
- java.lang.Object
-
- de.fraunhofer.iosb.ilt.frostserver.util.Constants
-
public class Constants extends Object
- Author:
- scf
-
-
Field Summary
Fields Modifier and Type Field Description static String[]HTTP_URL_PATTERNSThis semi-constant (arrays are not real constants) MUST be kept aligned with the WebServlet annotations!static ZoneOffsetUTC
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TthrowIfNullOrTypeNot(Object entity, Class<T> targetClass)Throws an IllegalArgumentException if entity is not an instance of targetClass, or if entity is null.static <T> TthrowIfTypeNot(Object entity, Class<T> targetClass)Throws an IllegalArgumentException if entity is not an instance of targetClass.
-
-
-
Field Detail
-
UTC
public static final ZoneOffset UTC
-
HTTP_URL_PATTERNS
public static final String[] HTTP_URL_PATTERNS
This semi-constant (arrays are not real constants) MUST be kept aligned with the WebServlet annotations!
-
-
Method Detail
-
throwIfNullOrTypeNot
public static <T> T throwIfNullOrTypeNot(Object entity, Class<T> targetClass)
Throws an IllegalArgumentException if entity is not an instance of targetClass, or if entity is null. Returns the entity so calls can be chained.- Type Parameters:
T- The type of the entity (auto detected)- Parameters:
entity- The entity to check the class of.targetClass- The class to check the entity against.- Returns:
- The entity to check.
-
throwIfTypeNot
public static <T> T throwIfTypeNot(Object entity, Class<T> targetClass)
Throws an IllegalArgumentException if entity is not an instance of targetClass. Does not throw if entity is null. Returns the entity so calls can be chained.- Type Parameters:
T- The type of the entity (auto detected)- Parameters:
entity- The entity to check the class of.targetClass- The class to check the entity against.- Returns:
- The entity to check.
-
-