OracleDbSupport

(Difference between revisions)
Line 16: Line 16:
Also NetBeans knows that that the ''OracleDb.getConnection()'' method has second parameter, which is a callback. So when you invoke code completion on the argument place, NetBeans offers a template, which corresponds to the known callback function. See picture below.  
Also NetBeans knows that that the ''OracleDb.getConnection()'' method has second parameter, which is a callback. So when you invoke code completion on the argument place, NetBeans offers a template, which corresponds to the known callback function. See picture below.  
-
[[image:OracleDb_connectionCallback.png]]
+
[[image:OracleDb_connectionCallBack_CC_01.png]]
As is displayed on the picture, the template is offers as an item of code completion. This item is displayed only at position after '(' or ',' chars and if the function call contains known callback. Again the callback can be defined  in the source file through @callback tag in Js Documentation.  
As is displayed on the picture, the template is offers as an item of code completion. This item is displayed only at position after '(' or ',' chars and if the function call contains known callback. Again the callback can be defined  in the source file through @callback tag in Js Documentation.  
Line 25: Line 25:
The template adds JsDoc defining types of the callback parameters. This is a way how the IDE can recognize what should be offered for the parameters.
The template adds JsDoc defining types of the callback parameters. This is a way how the IDE can recognize what should be offered for the parameters.
 +
 +
[[image:OracleDb_connection_CC_result.png]]
 +
 +
In this case Connection object (parameter of the callback) has method ''release'', which has another callback as parameter.
[[image:OracleDb_releaseCallBack_CC_result.png]]
[[image:OracleDb_releaseCallBack_CC_result.png]]
-
And again it can be applied
+
And after applying this template the result looks in this way:
 +
 
 +
[[image: OracleDb_releaseCallBack_result.png]]
 +
 
-
For example in the case of ''OracleDb.getConnection()'' method JsDoc it can look like this:
+
There is example of part of the OracleDb file. In the case of ''OracleDb.getConnection()'' method JsDoc it can look like this:
[[image:OracleDb_SignatureFile_Example.png]]
[[image:OracleDb_SignatureFile_Example.png]]

Revision as of 11:18, 5 February 2015

OracleDb is a Node.js module, which provides functionality to work with Oracle DB.

NetBeans doesn't have a special support for OracleDb module, but NetBeans should offer to write the code quickly. There are a few screenshot:

image:OracleDbCC_01.png

The code completion for OracleDb object with documentation. The code completion offers properties and methods of OracleDb class.

image:OracleDb_connAttrs_CC_01.png image:OracleDb_connAttrs_CC_02.png

The two pictures above show the code completion for property names of object, which is a argument of an function call.

In this case NetBeans knows (it can be based on a signature file or file with JS Doc documentation) that OracleDb.getConnection() method has two parameters. One of the parameter can be an anonymous object literal, which si defined in a signature file in this case. So if NetBeans find out, that the code completion is called in an object literal, which is used as an argument of an function, and NetBeans knows the right types, then the IDE offers the names of properties in the right place.

Also NetBeans knows that that the OracleDb.getConnection() method has second parameter, which is a callback. So when you invoke code completion on the argument place, NetBeans offers a template, which corresponds to the known callback function. See picture below.

image:OracleDb_connectionCallBack_CC_01.png

As is displayed on the picture, the template is offers as an item of code completion. This item is displayed only at position after '(' or ',' chars and if the function call contains known callback. Again the callback can be defined in the source file through @callback tag in Js Documentation.

When is callback template code completion item applied, the result looks like on the picture below.

image:OracleDb_connectionCallBack_CC_result.png

The template adds JsDoc defining types of the callback parameters. This is a way how the IDE can recognize what should be offered for the parameters.

File:OracleDb connection CC result.png

In this case Connection object (parameter of the callback) has method release, which has another callback as parameter.

image:OracleDb_releaseCallBack_CC_result.png

And after applying this template the result looks in this way:

image: OracleDb_releaseCallBack_result.png


There is example of part of the OracleDb file. In the case of OracleDb.getConnection() method JsDoc it can look like this: image:OracleDb_SignatureFile_Example.png

As you can see on the picture above there are defined both types of the OracleDb.getConnection() method. The first attribute has defined type OracleDb~connectionAttrs through @typedef annotation in JsDoc. The callback function is described as OracleDb~getConnectionCallback type that is defined in JsDoc through the @callback annotation.

On the picture above, you can also notice that NetBeans marks occurrences of the getConnectionCallback. In NetBeans the type OracleDb~getConnectionCallback is internally in NetBeans translated as OracleDb.getConnectionCallback so user can easily rename the OracleDb object or getConnectionCallback for example.

Also on the picture there is navigator, which shows the getConnectionCallback and connectionAttrs as property of OracleDb. The callback getConnectionCallback has special icon. The same icon has code completion item offering the callback item.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo