Skip Navigation

Using the Encode/Decode Service

  1. Add the com.sabre.edge.platform.optional.encodedecode dependency to your plug-in.

  2. Obtain a reference to the IEncodeDecodeService service from the OSGI environment. If your Red App has an activator that inherits from AbstractEdgeBaseNonUIPlugin or AbstractEdgeBasePlugin, you only need the following line of code:

IEncodeDecodeService encodeDecodeService = Activator.getDefault().getServiceReference(IEncodeDecodeService.class);

  1. Call either the encode or decode method, depending on what you want to achieve.

        Pass the desired category and string to encode or decode. Both methods will return a list of string objects that represent matching entries.

List <String> result = encodeDecodeService.encode(Category.CITY_NAMES, "London");

List <String> result = encodeDecodeService.decode(Category.CITY_NAMES, "LON");

Sample Code

 

IEncodeDecodeService encodeDecodeService =
Activator.getDefault().getServiceReference(IEncodeDecodeService.class);

encodeDecodeService.encode(Category.CITY_NAMES, "London");
encodeDecodeService.decode(Category.CITY_NAMES, "LON");