Ask Sawal

Discussion Forum
Notification Icon1
Write Answer Icon
Add Question Icon

Geetha Uday




Posted Questions


No Question(s) posted yet!

Posted Answers



Answer


A total of 1.19 crore shares changed hands today on BSE with a turnover of Rs 24.07 crore. The company's market capitalisation or m-cap stood at Rs 2,874.75 crore.

At today's closing level of Rs 19, HCC has fallen 16.30 per cent compared to its one-year high of Rs 22.70, hit in the previous session. That said, the stock has gained 80.27 per cent from its 52-week low of Rs 10.54, hit in June this year.

Also Read | Suzlon Energy shares extend fall, dive 11% amid heavy volumes

The stock has declined 12.44 per cent in the previous five sessions. On a year-to-date (YTD) basis, it has moved 11.76 per cent higher.

Further, credit rating agency ICRA has given B (Stable) rating for HCC's non-convertible debentures amounting to Rs 823.9 crore. As per ICRA, B rating (with outlook stable) is assigned to those instruments considered to have a high risk of default regarding the timely servicing of financial obligations.

Analysts largely remained mixed on the counter. They said traders could play the stock, placing stop loss at Rs 14.

Osho Krishan, Senior Analyst - Technical & Derivative Research at Angel One, said, "HCC has witnessed a stellar rally in the last one month and has recently seen a breakout from Rs 19 odd levels. At present, the stock has corrected from a high of Rs 22.70 and is hovering near the breakout zone. The support for the counter is placed near Rs 18-18.50, followed by Rs 17. While on the higher end, any breach above the mentioned swing high could only trigger the next leg of the rally."

Manoj Dalmia, Founder and Director, Proficient Equities, said, "Promoter share holding in the company decreased by 6.60 per cent in the most recent quarter. Investors can avoid buying this stock as these are some red signals."

Ravi Singhal, CEO, GCL, said, "HCC has given strong break out above Rs 17 after that it is in bull run. Over a few months, it can touch Rs 44 levels. Keep stop loss of Rs 14."

A R Ramachandran from Tips2trades, said, "Currently HCC stock faces a negative divergence on the Daily charts. Investors should exit buy positions and wait for a dip till Rs 14.5-15 to initiate fresh buy positions."

Also Read | Tata Power shares clock flat returns in 2022; here’s the new target price


Answer is posted for the following question.

will hcc share price increase?

Answer


Google Gson is a simple Java-based library to serialize Java objects to JSON and vice versa. It is an open-source library developed by Google.

The following points highlight why you should be using this library −

Here is a list of some of the most prominent features of Gson −

Gson provides three alternative ways to process JSON −

It reads and writes JSON content as discrete events. JsonReader and JsonWriter read/write the data as token, referred as JsonToken.

It is the most powerful approach among the three approaches to process JSON. It has the lowest overhead and it is quite fast in read/write operations. It is analogous to Stax parser for XML.

It prepares an in-memory tree representation of the JSON document. It builds a tree of JsonObject nodes. It is a flexible approach and is analogous to DOM parser for XML.

It converts JSON to and from POJO (Plain Old Java Object) using property accessor. Gson reads/writes JSON using data type adapters. It is analogous to JAXB parser for XML.

If you still want to set up a local environment for Java programming language, then this section will guide you on how to download and set up Java on your machine. Please follow the steps given below, to set up the environment.

Java SE is freely available from the link Download Java. So you download a version based on your operating system.

Follow the instructions to download Java and run the .exe to install Java on your machine. Once you have installed Java on your machine, you would need to set the environment variables to point to their correct installation directories.

Assuming you have installed Java in c:\Program Files\java\jdk directory −

Assuming you have installed Java in c:\Program Files\java\jdk directory −

The environment variable PATH should be set to point to where the Java binaries have been installed. Refer to your shell documentation if you have trouble doing this.

For example, if you use bash as your shell, then you would add the following line to the end of your '.bashrc: export PATH=/path/to/java:$PATH'

To write your Java programs, you will need a text editor. There are quite a few sophisticated IDEs available in the market. But for now, you can consider one of the following −

Download the latest version of Gson jar file from gson-2.3.1.jar. At the time of writing this tutorial, we downloaded gson-2.3.1.jar and copied it into C:\>gson folder.

Set the GSON_HOME environment variable to point to the base directory location where Gson jar is stored on your machine.

Set the CLASSPATH environment variable to point to the Gson jar location.

Before going into the details of the Google Gson library, let's see an application in action. In this example, we've created a Student class. We'll create a JSON string with student details and deserialize it to student object and then serialize it to an JSON String.

Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

File − GsonTester.java

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output.

Following are the important steps to be considered here.

Create a Gson object. It is a reusable object.

Use fromJson() method to get the Object from the JSON. Pass Json string / source of Json string and object type as parameter.

Use toJson() method to get the JSON string representation of an object.

Gson is the main actor class of Google Gson library. It provides functionalities to convert Java objects to matching JSON constructs and vice versa. Gson is first constructed using GsonBuilder and then, toJson(Object) or fromJson(String, Class) methods are used to read/write JSON constructs.

Following is the declaration for com.google.gson.Gson class −

This class inherits methods from the following class −

Create the following Java program using any editor of your choice, and save it at, say, C:/> GSON_WORKSPACE

File − GsonTester.java

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output

Let's serialize a Java object to a Json file and then read that Json file to get the object back. In this example, we've created a Student class. We'll create a student.json file which will have a json representation of Student object.

Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the Output

Data Binding API is used to convert JSON to and from POJO (Plain Old Java Object) using property accessor or using annotations. It is of two types.

Gson reads/writes JSON for both types of data bindings. Data Binding is analogous to JAXB parser for XML.

Primitives data binding refers to mapping of JSON to JAVA Core data types and inbuilt collections. Gson provides various inbuilt adapters which can be used to serialize/deserialize primitive data types.

Let's see primitive data binding in action. Here we'll map JAVA basic types directly to JSON and vice versa.

Create a Java class file named GsonTester in C:\>Gson_WORKSPACE.

File − GsonTester.java

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output.

Object data binding refers to mapping of JSON to any JAVA Object.

Let's see object data binding in action. Here we'll map JAVA Object directly to JSON and vice versa.

Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output.

Tree Model prepares an in-memory tree representation of the JSON document. It builds a tree of JsonObject nodes. It is a flexible approach and is analogous to DOM parser for XML.

JsonParser provides a pointer to the root node of the tree after reading the JSON. Root Node can be used to traverse the complete tree. Consider the following code snippet to get the root node of a provided JSON String.

Get each node using relative path to the root node while traversing the tree and process the data. The following code snippet shows how you can traverse a tree.

Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

File − GsonTester.java

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output.

Streaming API is used to read JSON token by token. It reads and writes JSON content as discrete events. JsonReader and JsonWriter read/write the data as token, referred as JsonToken.

It is the most powerful approach among the three approaches to process JSON. It has the lowest overhead and it is quite fast in read/write operations. It is analogous to Stax parser for XML.

In this chapter, we will showcase the usage of GSON streaming APIs to read JSON data. Streaming API works with the concept of token and every details of Json is to be handled carefully.

Let's see JsonReader in action. Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output.

In this chapter, we will discuss the serialization/deserialization of arrays, collections, and generics.

Let's see Array serialization/de-serialization in action. Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

File − GsonTester.java

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output.

Let's see Collection serialization/de-serialization in action. Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

File − GsonTester.java

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output.

Gson uses Java reflection API to get the type of the object to which a Json text is to be mapped. But with generics, this information is lost during serialization. To counter this problem, Gson provides a class com.google.gson.reflect.TypeToken to store the type of the generic object.

Let's see Generics serialization/de-serialization in action. Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

File − GsonTester.java

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output.

In this chapter, we will explain serialization/deserialization of classes having inner classes.

Let's see an example of serialization/de-serialization of class with an inner class in action. Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

File − GsonTester.java

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output.

Let's see an example of serialization/de-serialization of class with a static inner class in action. Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

File − GsonTester.java

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output.

Gson performs the serialization/deserialization of objects using its inbuilt adapters. It also supports custom adapters. Let’s discuss how you can create a custom adapter and how you can use it.

Create a custom adapter by extending the TypeAdapter class and passing it the type of object targeted. Override the read and write methods to do perform custom deserialization and serialization respectively.

Register the custom adapter using GsonBuilder and create a Gson instance using GsonBuilder.

Gson will now use the custom adapter to convert Json text to object and vice versa.

Let's see an example of custom type adapter in action. Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

File − GsonTester.java

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output.

Gson by default generates optimized Json content ignoring the NULL values. But GsonBuilder provides flags to show NULL values in the Json output using the GsonBuilder.serializeNulls() method.

Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output.

Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output.

Gson provides @Since annotation to control the Json serialization/deserialization of a class based on its various versions. Consider the following class with versioning support. In this class, we've initially defined two variables rollNo and name and later on, we added verified as a new variable. Using @Since, we've defined rollNo and name as of version 1.0 and verified to be of version 1.1.

GsonBuilder provides the setVersion() method to serialize such versioned class.

Let's see an example of versioning support in action. Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output.

By default, GSON excludes transient and static fields from the serialization/deserialization process. Let’s take a look at the following example.

Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

File − GsonTester.java

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output

GsonBuilder provides control over excluding fields with particular modifier using excludeFieldsWithModifiers() method from serialization/deserialization process. See the following example.

Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

File − GsonTester.java

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output

Gson provides @Expose annotation to control the Json serialization/deserialization of a class based on its scope. Consider the following class with a variable having @Expose support. In this class, name and rollno variables are to be exposed for serialization. Then we've used the GsonBuilder.excludeFieldsWithoutExposeAnnotation() method to indicate that only exposed variables are to be serialized/deserialized. See the following example.

Create a Java class file named GsonTester in C:\>GSON_WORKSPACE.

File − GsonTester.java

Compile the classes using javac compiler as follows −

Now run the GsonTester to see the result −

Verify the output


Answer is posted for the following question.

when to use gson?

Answer


· by RJ Henning · 2020 · Cited by 16 Medical treatment in HFpEF patients with non-


Answer is posted for the following question.

How to treat hfpef?

Answer


But it was when people started calling them “ Ghana must go ” bags that the young man knew it was time to leave The bags followed him home, as he crossed two


Answer is posted for the following question.

What is a ghana must go bag?


Wait...