cancel
Showing results for 
Search instead for 
Did you mean: 

PI 7.1 Adapter Module - meaning of VERSION_ID and serialVersionUID?

Former Member
0 Kudos

Hi!

I am currently developing my first PI Adapter Module. In SAP sample coding GetHostName I find the following declarations and I ask me what's the meaning and/or purpose of these declarations:

public static final String VERSION_ID = "$Id://tc/aii/30_REL/src/_adapters/_sample/java/user/module/GetHostName.java#1 $";

satic final long serialVersionUID = 7435850550539048631L;

And additionally how I have to declare these two variables for my adapter module ... This comes true especially for VERSION_ID, because serialVersionUID can be generated by NWDS using quick fix feature. It then declares such a variable ...

Thanxs for any hint in advance!

Regards,

Volker

Accepted Solutions (0)

Answers (2)

Answers (2)

Bhargavakrishna
Active Contributor
0 Kudos

Hi Pavel,

public - this is the visibility modifier (it means that the body method can be call by any outside method)

static - the method is a static instance of the class. Not sure what exactly it does though.


final indicates that the value of the variable won't change - in other words, a variable who's value can't be modified after it is declared.

Use public final static String when you want to create a String that belongs to the class (no instance necessary to use it), and that won't change, for instance when you want to define a Stringconstant that will be available to all instances of the class, and to other objects using the class, depending on the access modifier:

public final static String MY_CONSTANT = "SomeValue";  // ... in some other code, possibly in another object, use the constant: if (input.equals(MyClass.MY_CONSTANT)

All the variables are implicitly public static final in a Java Interface.
Is it a good coding practice to use public static final in constant variable although it is declared inside an Interface.

For example :

public interface TestInterface{  public static final String EX_CONSTANT = "ABC"; public static final int EX_INT_CONSTANT = 5; public static final double EX_DOUBLE = "5.0"; public static final Integer EX_INTEGER = 10;  }

Refer below links

http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/09/24/setting-queue-dynamically-using-a...

http://f0j00fec.benxbrain.com/en(bD1lbiZjPTAwMQ==)/index.do?onInputProcessing(brai_object_thread)&00...

Hope it will helpful..

Regards

Bhargava krishna

Former Member
0 Kudos

Hi Volker,

please how do you resolved it?

I have the same problem.

Thx.

Pavel.