In various scenarios, POJOs need to be defined with too many fields. Initializing such fields can be done in multiple ways as mentioned below –
Jackson is the de-facto standard in the Java world for working with JSONs. JSON, being the widely accepted and appreciated format for data transfer across different web services, most of the web service providers and consumers in the Java platform tend to use the Jackson API. Here are few of the use cases to serialize and deserialize Enums.
For analysis, the below object is used in all examples. The containing enums are defined as and when considered.
@JsonInclude annotation used here simplifies the serialized JSON by ignoring the null values.
public static class ObjectWithEnum
private int someInteger = 100;
private SimpleEnum simpleEnum;
private WithIntField withIntField;
private WithStringField withStringField;
private WithMultiFields withMultiFields;
private PrimaryColor primaryColor;
ObjectMapper, initialized as below is used in all examples:
ObjectMapper objectMapper = new ObjectMapper();
Continue reading “Java Enum Serialization / Deserialization with Jackson API”
Google’s Picasa Web Albums Data API is the approach one can take to programmatically play with content on the Google Photos. Be it browsing the content of the album or upload a new photo from the mobile application, all has to be done through this API if not preferred to be done through the Google’s native apps or web browser. Continue reading “Google Photos / Picasa Web Albums Data API Beginner’s Guide”
Google Guava library supports various String Operations to speed up common operations in day to day programming. Below is a list that can help.
ASCII Operations –
- ASCII constants including various types of white spaces like carriage return, new line, space etc, Signals like escape, delete etc, other communication signals and more.
equalsIgnoreCase – Much faster than implementation in
java.lang.String. Works well for ASCII strings. Read the documentation and analyze your use case before using this.
- Other common String operations like
Continue reading “String Utility Operations On Google Guava”