📄 tag.java
字号:
package ie.omk.smpp.message.tlv;import java.util.BitSet;import java.util.HashMap;import java.util.Map;/** * Enumeration class for optional parameter tag values. * * @author Oran Kelly * @version $Id: Tag.java 299 2006-08-10 19:33:16Z orank $ */public final class Tag implements java.io.Serializable { /** * Look-up table of statically defined tags. This <b>must</b> be defined * before all the tags as the Tag constructor expects this object to exist. */ private static Map tagTable = new HashMap(); static final long serialVersionUID = -418561932897398277L; public static final Tag DEST_ADDR_SUBUNIT = new Tag(0x05, Number.class, 1); public static final Tag DEST_NETWORK_TYPE = new Tag(0x06, Number.class, 1); public static final Tag DEST_BEARER_TYPE = new Tag(0x07, Number.class, 1); public static final Tag DEST_TELEMATICS_ID = new Tag(0x08, Number.class, 2); public static final Tag SOURCE_ADDR_SUBUNIT = new Tag(0x0d, Number.class, 1); public static final Tag SOURCE_NETWORK_TYPE = new Tag(0x0e, Number.class, 1); public static final Tag SOURCE_BEARER_TYPE = new Tag(0x0f, Number.class, 1); public static final Tag SOURCE_TELEMATICS_ID = new Tag(0x10, Number.class, 1); public static final Tag QOS_TIME_TO_LIVE = new Tag(0x17, Number.class, 4); public static final Tag PAYLOAD_TYPE = new Tag(0x19, Number.class, 1); public static final Tag ADDITIONAL_STATUS_INFO_TEXT = new Tag(0x1d, String.class, 1, 256); public static final Tag RECEIPTED_MESSAGE_ID = new Tag(0x1e, String.class, 1, 65); public static final Tag MS_MSG_WAIT_FACILITIES = new Tag(0x30, BitSet.class, 1); public static final Tag PRIVACY_INDICATOR = new Tag(0x201, Number.class, 1); public static final Tag SOURCE_SUBADDRESS = new Tag(0x202, byte[].class, 2, 23); public static final Tag DEST_SUBADDRESS = new Tag(0x203, byte[].class, 2, 23); public static final Tag USER_MESSAGE_REFERENCE = new Tag(0x204, Number.class, 2); public static final Tag USER_RESPONSE_CODE = new Tag(0x205, Number.class, 2); public static final Tag SOURCE_PORT = new Tag(0x20a, Number.class, 2); public static final Tag DESTINATION_PORT = new Tag(0x20b, Number.class, 2); public static final Tag SAR_MSG_REF_NUM = new Tag(0x20c, Number.class, 2); public static final Tag LANGUAGE_INDICATOR = new Tag(0x20d, Number.class, 1); public static final Tag SAR_TOTAL_SEGMENTS = new Tag(0x20e, Number.class, 1); public static final Tag SAR_SEGMENT_SEQNUM = new Tag(0x20f, Number.class, 1); public static final Tag SC_INTERFACE_VERSION = new Tag(0x210, Number.class, 1); public static final Tag CALLBACK_NUM_PRES_IND = new Tag(0x302, BitSet.class, 1); public static final Tag CALLBACK_NUM_ATAG = new Tag(0x303, byte[].class, 0, 65); public static final Tag NUMBER_OF_MESSAGES = new Tag(0x304, Number.class, 1); public static final Tag CALLBACK_NUM = new Tag(0x381, byte[].class, 4, 19); public static final Tag DPF_RESULT = new Tag(0x420, Number.class, 1); public static final Tag SET_DPF = new Tag(0x421, Number.class, 1); public static final Tag MS_AVAILABILITY_STATUS = new Tag(0x422, Number.class, 1); public static final Tag NETWORK_ERROR_CODE = new Tag(0x423, byte[].class, 3); public static final Tag MESSAGE_PAYLOAD = new Tag(0x424, byte[].class, -1); public static final Tag DELIVERY_FAILURE_REASON = new Tag(0x425, Number.class, 1); public static final Tag MORE_MESSAGES_TO_SEND = new Tag(0x426, Number.class, 1); public static final Tag MESSAGE_STATE = new Tag(0x427, Number.class, 1); public static final Tag USSD_SERVICE_OP = new Tag(0x501, byte[].class, 1); public static final Tag DISPLAY_TIME = new Tag(0x1201, Number.class, 1); public static final Tag SMS_SIGNAL = new Tag(0x1203, Number.class, 2); public static final Tag MS_VALIDITY = new Tag(0x1204, Number.class, 1); public static final Tag ALERT_ON_MESSAGE_DELIVERY = new Tag(0x130c, null, 0); public static final Tag ITS_REPLY_TYPE = new Tag(0x1380, Number.class, 1); public static final Tag ITS_SESSION_INFO = new Tag(0x1383, byte[].class, 2); /** * Integer value of this tag. */ private Integer tag; /** * The minimum length a value of this tag type can be. */ private int minLength = -1; /** * The maximum length a value of this tag type can be. */ private int maxLength = -1; /** * The Java type a value of this tag type must be. */ private Class type; /** * The class used for encoding and decoding values of this tag type. * * @see ie.omk.smpp.message.tlv.Encoder */ private Encoder encoder; /** * Create a new Tag. The encoder type will be chosen from the set of known * built-in encoders. * * @param tag * The integer value of the tag. * @param type * The allowed Java type for the value. * @param fixedLength * The fixed length allowed for the value. * @throws ie.omk.smpp.message.tlv.TagDefinedException * If a tag with integer value <code>tag</code> has already * been defined. */ private Tag(int tag, Class type, int fixedLength) throws TagDefinedException { this(tag, type, null, fixedLength, fixedLength); } /** * Create a new Tag. he encoder type will be chosen from the set of known * built-in encoders. * * @param tag * The integer value of the tag. * @param type * The allowed Java type of the value. * @param minLength * The minimum length allowed for the value. * @param maxLength * The maximum length allowed for the value. * @throws ie.omk.smpp.message.tlv.TagDefinedException * If a tag with integer value <code>tag</code> has already * been defined. */ private Tag(int tag, Class type, int minLength, int maxLength) throws TagDefinedException { this(tag, type, null, minLength, maxLength); } /** * Create a new Tag. * * @param tag * The integer value of the tag. * @param type * The allowed Java type for the value * @param enc * The encoding class to use to encode and decode values. * @param fixedLength * The fixed length allowed for the value. * @throws ie.omk.smpp.message.tlv.TagDefinedException * If a tag with integer value <code>tag</code> has already * been defined. */ private Tag(int tag, Class type, Encoder enc, int fixedLength) throws TagDefinedException { this(tag, type, enc, fixedLength, fixedLength); } /** * Create a new Tag. * * @param tag * The integer value of the tag. * @param type * The allowed Java type for the value * @param enc * The encoding class to use to encode and decode values. * @param minLength * The minimum length allowed for the value. * @param maxLength * The maximum length allowed for the value. * @throws ie.omk.smpp.message.tlv.TagDefinedException * If a tag with integer value <code>tag</code> has already * been defined. */ private Tag(int tag, Class type, Encoder enc, int minLength, int maxLength) throws TagDefinedException { this.tag = new Integer(tag); this.type = type; this.minLength = minLength; this.maxLength = maxLength; if (enc == null) { this.encoder = getEncoderForType(type); } else { this.encoder = enc; } synchronized (tagTable) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -