The @JsonAnyGetter annotation enables to use a Map as a container for properties that we want to serialize to JSON and @JsonAnySetter annotation instructs Jackson to call the same setter method for all unrecognized fields in the JSON object, which means that all fields that are not already mapped to a property or setter method in the Java object.Syntaxpublic @interface JsonAnyGetter public @interface JsonAnyGetterExampleimport java.io.*; import java.util.*; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.annotation.*; public class JsonAnyGetterAndJsonAnySetterTest { public static void main(String args[]) throws JsonGenerationException, JsonMappingException, IOException { Employee emp1 = new Employee(); emp1.setFirstName("Adithya"); emp1.setLastName("Sai"); ... Read More
The Jackson API provides a number of methods to work with JSON data. By using Jackson API, we can convert Java objects to JSON string and reform the object from the JSON string. We can implement a custom serializer using the StdSerializer class and need to override the serialize(T value, JsonGenerator gen, SerializerProvider provider) method, the first argument value represents value to serialize(can not be null), the second argument gen represents generator used to output resulting Json content and the third argument provider represents provider that can be used to get serializers for serializing objects value.Syntaxpublic abstract void serialize(T value, JsonGenerator gen, SerializerProvider provider) throws IOExceptionExampleimport java.io.*; ... Read More
A Jackson is a Java JSON API that provides several different ways to work with JSON. We can convert CSV data to JSON data using the CsvMapper class, it is specialized ObjectMapper, with extended functionality to produce CsvSchema instances out of POJOs. We can use the reader() method for constructing ObjectReader with default settings. In order to convert this, we need to import the com.fasterxml.jackson.dataformat.csv package.In the below example, convert a CSV to JSON.Exampleimport java.io.*; import java.util.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.dataformat.csv.*; public class CsvToJsonTest { public static void main(String args[]) throws Exception { File input = new File("input.csv"); try { ... Read More
The rest property is a shorthand property for rest-before and rest-after properties. Set a pause before or after the element.The following is the syntax:rest: rest-before rest-afterHere,rest-before: Rest for some seconds beforerest-after: Rest for some seconds afterExampleThe following is an example of rest speech media property:h1 { rest: 15ms 20ms; }
Use the align-content property with value space-between to add space between the flex lines.ExampleYou can try to run the following code to implement the space-between valueLive Demo .mycontainer { display: flex; height: 200px; background-color: #5D6D7E; align-content: space-between; flex-wrap: wrap; } .mycontainer > div { background-color: #EBF5FB; text-align: center; line-height: 60px; font-size: 30px; width: 100px; margin: 5px; } Queue Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8
To implement animation on line-height property with CSS, you can try to run the following code −ExampleLive Demo p { animation: mymove 3s infinite; line-height: 20px; } @keyframes mymove { 70% { line-height: 50px; } } This is demo text! This is demo text! This is demo text! This is demo text! This is demo text! This is demo text! This is demo text! This is demo text! This is demo text! This is demo text! This is demo text! This is demo text!
Let us first see an example and create a table −mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentName varchar(40), StudentAge int, StudentMarks int ); Query OK, 0 rows affected (0.76 sec)Following is the query to know the database structure −mysql> show create table DemoTable;This will produce the following output −+---------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table ... Read More
The Gson library provides a class called com.google.gson.reflect.TypeToken to store generic types by creating a Gson TypeToken class and pass the class type. Using this type, Gson can able to know the class passed in the generic class.Syntaxpublic class TypeToken extends ObjectWe can deserialize a JSON array to a generic type of list in the below exampleExampleimport java.lang.reflect.Type; import java.util.*; import com.google.gson.*; import com.google.gson.reflect.*; public class JSONArrayToListTest { public static void main(String args[]) throws Exception { String jsonStr = "[{\"name\":\"Adithya\", \"course\":\"Java\"}, " + "{\"name\":\"Ravi\", \"course\":\"Python\"}]"; Type listType = new TypeToken() {}.getType(); List students = ... Read More
Use the all property to reset all the properties. Set all property to initial, inherit or unset.ExampleYou can try to run the following code to implement the CSS all propertyLive Demo html { color: blue; } #demo { background-color: yellow; color: red; all: inherit; } CSS all property This is demo text.
Use the align-content property with value flex-start to set the flex lines in the beginning.ExampleYou can try to run the following code to implement the flex-start value:Live Demo .mycontainer { display: flex; height: 300px; background-color: blue; align-content: flex-start; flex-wrap: wrap; } .mycontainer > div { background-color: orange; text-align: center; line-height: 60px; font-size: 30px; width: 100px; margin: 5px; } Queue Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP