com.ibm.rfid.epc.validation
Class EncodingValidator

java.lang.Object
  extended by com.ibm.rfid.epc.validation.EncodingValidator
All Implemented Interfaces:
Epc

public class EncodingValidator
extends java.lang.Object
implements Epc

This validator class is used to validate certain properties of encoding types. For instance, you can check whether or not a particular input type is a valid input type for a given encoding type. This class is also used to get a list of supported encoding types, and also how many fields are contained within each encoding type.


Field Summary
 
Fields inherited from interface com.ibm.rfid.epc.validation.Epc
EPC_GLOBAL_ENCODING_DOD64, EPC_GLOBAL_ENCODING_DOD96, EPC_GLOBAL_ENCODING_GIAI64, EPC_GLOBAL_ENCODING_GIAI96, EPC_GLOBAL_ENCODING_GID96, EPC_GLOBAL_ENCODING_GRAI64, EPC_GLOBAL_ENCODING_GRAI96, EPC_GLOBAL_ENCODING_SGLN64, EPC_GLOBAL_ENCODING_SGLN96, EPC_GLOBAL_ENCODING_SGTIN64, EPC_GLOBAL_ENCODING_SGTIN96, EPC_GLOBAL_ENCODING_SSCC64, EPC_GLOBAL_ENCODING_SSCC96, PS_ENCODING_DOD64, PS_ENCODING_DOD96, PS_ENCODING_GIAI64, PS_ENCODING_GIAI96, PS_ENCODING_GID96, PS_ENCODING_GRAI64, PS_ENCODING_GRAI96, PS_ENCODING_SGLN64, PS_ENCODING_SGLN96, PS_ENCODING_SGTIN64, PS_ENCODING_SGTIN96, PS_ENCODING_SSCC64, PS_ENCODING_SSCC96, PS_INPUT_DOD, PS_INPUT_GIAI, PS_INPUT_GID, PS_INPUT_GLN, PS_INPUT_GRAI, PS_INPUT_GTIN14, PS_INPUT_NCD10, PS_INPUT_SSCC18
 
Constructor Summary
EncodingValidator()
           
 
Method Summary
static int calculateCheckSum(java.lang.String str)
          Calculates checksum based on modulo10 arithmetic.
static java.lang.String formatInput(java.lang.String upc, java.lang.String data, java.lang.String companyPrefix, java.lang.String indicatorDigit, java.lang.String[] inputTypes)
          checks to see if input (calculated from parameters) is SSCC18 or GTIN14 and reformats the global identifier (either SSCC18 or GTIN14 value).
static java.util.Enumeration getEncodingTypeNames()
          gets the list of supported encoding types
static java.lang.String[] getEncodingTypesByInput(java.lang.String inputType)
          This method returns a list of encoding types for a given input type.
static int getNumEncodingTypeFields(java.lang.String encodingType)
          gets the number of fields found within a given encoding type
static boolean isItemLevel(java.lang.String encoding)
          checks to see if this encoding type is an item-level.
static boolean isNonItemLevel(java.lang.String encoding)
          checks to see if this encoding type is an item-level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncodingValidator

public EncodingValidator()
Method Detail

getEncodingTypesByInput

public static java.lang.String[] getEncodingTypesByInput(java.lang.String inputType)
This method returns a list of encoding types for a given input type.

Parameters:
inputType - given input type
Returns:
String[] of encoding types. returns null if input type not found

getEncodingTypeNames

public static java.util.Enumeration getEncodingTypeNames()
gets the list of supported encoding types

Returns:
an Enumeration of String objects representing encoding types

getNumEncodingTypeFields

public static int getNumEncodingTypeFields(java.lang.String encodingType)
gets the number of fields found within a given encoding type

Parameters:
encodingType - given encoding type
Returns:
the number of fields found within the specified encoding type. Returns -1 if the encoding type isn't found or supported.

isItemLevel

public static boolean isItemLevel(java.lang.String encoding)
checks to see if this encoding type is an item-level. Examples of item-level encodings are sgtin-96 and GID96. An example of a non-item-level encoding is sscc-96.

NOTE: isItemLevel is *NOT* the opposite of isNonItemLevel. An encoding can be an item level and non item level (e.g., DOD64/96).

Parameters:
encoding - encoding type String
Returns:
false if isn't item-level encoding, true otherwise
See Also:
isNonItemLevel(String)

isNonItemLevel

public static boolean isNonItemLevel(java.lang.String encoding)
checks to see if this encoding type is an item-level. Examples of item-level encodings are sgtin-96 and GID96. An example of a non-item-level encoding is sscc-96.

NOTE: isItemLevel is *NOT* the opposite of isNonItemLevel. An encoding can be an item level and non item level (e.g., DOD64/96).

Parameters:
encoding - encoding type String
Returns:
true if isn't item-level encoding, false otherwise
See Also:
isItemLevel(String)

calculateCheckSum

public static int calculateCheckSum(java.lang.String str)
Calculates checksum based on modulo10 arithmetic. This method assumes last character is checksum digit and doesn't take that into consideration.

Parameters:
str - input numeric string
Returns:
check digit

formatInput

public static java.lang.String formatInput(java.lang.String upc,
                                           java.lang.String data,
                                           java.lang.String companyPrefix,
                                           java.lang.String indicatorDigit,
                                           java.lang.String[] inputTypes)
                                    throws PremisesAccessException
checks to see if input (calculated from parameters) is SSCC18 or GTIN14 and reformats the global identifier (either SSCC18 or GTIN14 value). If its not SSCC18 or GTIN14, return unchanged global identifier.

Parameters:
data - global product identifier used to uniquely identify a product or item
companyPrefix - company prefix of product or item
Returns:
the newly formated global identifier
Throws:
PremisesAccessException


Copyright © 2005 - 2009 IBM Corp. All Rights Reserved.