示例#1
0
  /**
   * Returns a subclass of GenericMessage corresponding to a certain version. This is needed so that
   * version-specific segments can be added as the message is parsed.
   */
  public static Class<? extends Message> getGenericMessageClass(String version) {
    if (!Version.supportsVersion(version))
      throw new IllegalArgumentException("The version " + version + " is not recognized");

    if ("2.1".equals(version)) {
      return V21.class;
    }

    if ("2.2".equals(version)) {
      return V22.class;
    }

    if ("2.3".equals(version)) {
      return V23.class;
    }

    if ("2.3.1".equals(version)) {
      return V231.class;
    }

    if ("2.4".equals(version)) {
      return V24.class;
    }

    if ("2.5.1".equals(version)) {
      return V25.class;
    }

    if ("2.5.1".equals(version)) {
      return V251.class;
    }

    if ("2.6".equals(version)) {
      return V26.class;
    }

    Log.d(Constants.TAG, "Unknown version for generic type {" + version + "}");

    return UnknownVersion.class;
  }
示例#2
0
 public String getVersion() {
   return Version.latestVersion().getVersion();
 }