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 StringCHARSET_UTF8static StringCONTENT_TYPEstatic StringCONTENT_TYPE_APPLICATION_GEOJSONstatic StringCONTENT_TYPE_APPLICATION_HTTPstatic StringCONTENT_TYPE_APPLICATION_JSONstatic StringCONTENT_TYPE_APPLICATION_JSONPATCHstatic StringCONTENT_TYPE_APPLICATION_XMLstatic StringCONTENT_TYPE_TEXT_HTMLstatic StringHEADER_ACCEPTstatic StringHEADER_LOCATIONstatic StringHEADER_PREFERstatic StringREQUEST_PARAM_FORMATstatic StringTAG_PREFER_RETURNstatic StringVALUE_ID_TYPE_LONGstatic StringVALUE_ID_TYPE_STRINGstatic StringVALUE_ID_TYPE_UUIDstatic StringVALUE_RETURN_MINIMALstatic StringVALUE_RETURN_REPRESENTATION
-
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
-
CONTENT_TYPE
public static final String CONTENT_TYPE
- See Also:
- Constant Field Values
-
CONTENT_TYPE_APPLICATION_GEOJSON
public static final String CONTENT_TYPE_APPLICATION_GEOJSON
- See Also:
- Constant Field Values
-
CONTENT_TYPE_APPLICATION_HTTP
public static final String CONTENT_TYPE_APPLICATION_HTTP
- See Also:
- Constant Field Values
-
CONTENT_TYPE_APPLICATION_JSON
public static final String CONTENT_TYPE_APPLICATION_JSON
- See Also:
- Constant Field Values
-
CONTENT_TYPE_APPLICATION_JSONPATCH
public static final String CONTENT_TYPE_APPLICATION_JSONPATCH
- See Also:
- Constant Field Values
-
CONTENT_TYPE_APPLICATION_XML
public static final String CONTENT_TYPE_APPLICATION_XML
- See Also:
- Constant Field Values
-
CONTENT_TYPE_TEXT_HTML
public static final String CONTENT_TYPE_TEXT_HTML
- See Also:
- Constant Field Values
-
CHARSET_UTF8
public static final String CHARSET_UTF8
- See Also:
- Constant Field Values
-
HEADER_ACCEPT
public static final String HEADER_ACCEPT
- See Also:
- Constant Field Values
-
HEADER_LOCATION
public static final String HEADER_LOCATION
- See Also:
- Constant Field Values
-
HEADER_PREFER
public static final String HEADER_PREFER
- See Also:
- Constant Field Values
-
TAG_PREFER_RETURN
public static final String TAG_PREFER_RETURN
- See Also:
- Constant Field Values
-
REQUEST_PARAM_FORMAT
public static final String REQUEST_PARAM_FORMAT
- See Also:
- Constant Field Values
-
VALUE_ID_TYPE_LONG
public static final String VALUE_ID_TYPE_LONG
- See Also:
- Constant Field Values
-
VALUE_ID_TYPE_STRING
public static final String VALUE_ID_TYPE_STRING
- See Also:
- Constant Field Values
-
VALUE_ID_TYPE_UUID
public static final String VALUE_ID_TYPE_UUID
- See Also:
- Constant Field Values
-
VALUE_RETURN_REPRESENTATION
public static final String VALUE_RETURN_REPRESENTATION
- See Also:
- Constant Field Values
-
VALUE_RETURN_MINIMAL
public static final String VALUE_RETURN_MINIMAL
- See Also:
- Constant Field Values
-
-
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.
-
-