ParserUtility Class
- java.
lang. Object - com.
microsoft. azure. sdk. iot. provisioning. service. configs. ParserUtility
- com.
public class ParserUtility
Set of static functions to help the serializer.
Method Summary
Modifier and Type | Method and Description |
---|---|
String |
dateTimeUtcToString(Date date)
Helper to convert the provided Date UTC into String. Expected result: "2016-06-01T21:22:43.799Z" |
Date |
getDateTimeUtc(String dataTime)
Helper to convert the provided string in a UTC Date. Expected format: "2016-06-01T21:22:43.7996883Z" |
Map<String, Object> | getJsonObjectValue(JsonObject jsonObject) |
String |
getUTCDateStringFromDate(Date date)
Convert from a date object back into a string representation Expected format of returned string: "2016-01-21T11:05:21" |
JsonElement |
mapToJsonElement(Map<String, Object> map)
Helper to convert a provided map in to a JsonElement, including sub-maps. |
Object | resolveJsonElement(JsonElement jsonElement) |
Date |
stringToDateTimeOffset(String dateTime)
Helper to convert the provided string in a offset Date. Expected format: "2016-06-01T21:22:41+00:00" |
void |
validateBlobName(String blobName)
Helper to validate if the provided blob name is not null, empty, and valid. |
void |
validateMap(Map<String, Object> map)
Helper to validate if the provided map in terms of maximum levels and optionally if the keys ar not metadata. |
void |
validateObject(Object val)
Helper to validate if the provided object is not null. |
void |
validateQuery(String query)
Validates if query contains select and from keywords and also if it is a valid utf-8 string |
void |
validateStringUTF8(String str)
Helper to validate if the provided string is not null, empty, and all characters are UTF-8. |
Method Details
dateTimeUtcToString
public static String dateTimeUtcToString(Date date)
Helper to convert the provided Date UTC into String. Expected result: "2016-06-01T21:22:43.799Z"
Parameters:
is theDate
</code> with the date and time </p>
Returns:
theString
</code> with the date and time using the UTC format. </p>
Throws:
if the provided date isnull
</code> . </p>
getDateTimeUtc
public static Date getDateTimeUtc(String dataTime)
Helper to convert the provided string in a UTC Date. Expected format: "2016-06-01T21:22:43.7996883Z"
Parameters:
Returns:
Throws:
getJsonObjectValue
public static Map
Parameters:
getUTCDateStringFromDate
public static String getUTCDateStringFromDate(Date date)
Convert from a date object back into a string representation Expected format of returned string: "2016-01-21T11:05:21"
Parameters:
Returns:
Throws:
mapToJsonElement
public static JsonElement mapToJsonElement(Map
Helper to convert a provided map in to a JsonElement, including sub-maps.
Parameters:
Returns:
Throws:
resolveJsonElement
public static Object resolveJsonElement(JsonElement jsonElement)
Parameters:
stringToDateTimeOffset
public static Date stringToDateTimeOffset(String dateTime)
Helper to convert the provided string in a offset Date. Expected format: "2016-06-01T21:22:41+00:00"
Parameters:
Returns:
Throws:
validateBlobName
public static void validateBlobName(String blobName)
Helper to validate if the provided blob name is not null, empty, and valid.
Parameters:
Throws:
validateMap
public static void validateMap(Map
Helper to validate if the provided map in terms of maximum levels and optionally if the keys ar not metadata.
Parameters:
theMap
</code> to be validate. It can be<code>null
</code> , and it will succeed in this case. </p>
Throws:
validateObject
public static void validateObject(Object val)
Helper to validate if the provided object is not null.
Parameters:
Throws:
validateQuery
public static void validateQuery(String query)
Validates if query contains select and from keywords and also if it is a valid utf-8 string
Parameters:
Throws:
validateStringUTF8
public static void validateStringUTF8(String str)
Helper to validate if the provided string is not null, empty, and all characters are UTF-8.
Parameters:
Throws:
Applies to
Azure SDK for Java
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for