code: private GeneralNameInterface getGNI(ObjectIdentifier oid, byte[] nameValue)
              throws IOException {
          try {
              Class<?> extClass = OIDMap.getClass(oid);
              if (extClass == null) {   // Unsupported OtherName
                  return null;
              }
              Class<?>[] params = { Object.class };
              Constructor<?> cons = extClass.getConstructor(params);
  
              Object[] passed = new Object[] { nameValue };
              GeneralNameInterface gni =
                         (GeneralNameInterface)cons.newInstance(passed);
              return gni;
          } catch (Exception e) {
              throw new IOException("Instantiation error: " + e, e);
          }
      }
docs: Get GeneralNameInterface