Memorynotfound Java Programming Tutorials
GSON Format Date in JSON object
You can globally specify how to format dates in JSON objects using GSON. Very easy, you will only have to declare your custom date once. GSON Format Date method setDateFormat() witch takes an int...
GSON Excluding fields with modifiers from JSON
By default, if you mark a field as transient, it will be excluded. As well, if a field is marked as “static” then by default it will be excluded. Here is another way you...
Excluding field from JSON with @Expose GSON
GSON provides a way where you can mark certain fields of your objects to be excluded for consideration for serialization and deserialization to JSON. To use this @Expose GSON annotation, you must create Gson...
Custom JSON field naming using GSON
Gson supports custom naming for JSON fields. You can annotate your fields with @SerializedName to provide this functionality. If there is an error in the naming of the field, it’ll throw a Runtime exception....
Deserialise JSON to Java Object using GSON
Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Gson can...
Serialise Java Object to JSON using GSON
Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Gson can...
Remove an object/a person from a background in Photoshop
Remove an object/a person from a background. It could occur that you want to remove a person or an object from a background in Photoshop. The background can simply be distracting or unnecessary to...
Convert XML to Polymorphic Object using JAX-B
Here is an example of how you can convert XML to polymorphic objects using JAX-B. Abstract Animal Class package com.memorynotfound.xml.jaxb; public abstract class Animal { } Cat Inherits from Animal package com.memorynotfound.xml.jaxb; import javax.xml.bind.annotation.XmlRootElement;...
Convert Polymorphic Object to XML using JAX-B
When you use polymorphism in your classes and you want to convert your object to XML using JAX-B, here is an example how to. Abstract Animal Class package com.memorynotfound.xml.jaxb; public abstract class Animal {...