将类型 "String" 转换为类型 "Name"

Convert Type "String" to type "Name"

这是问题所在:

    import lotus.domino.Document;
    import lotus.domino.Name;
    import lotus.domino.NotesException;
    import lotus.domino.Session;
    import de.bcode.utils.Utils;


    public class Example {

    int x;

    Name n = (Name)x.toString(); // i want to do this.


    }

我正在尝试进行上述转换,我也通过 "typecasting" 进行了转换,但一直失败。

感谢您阅读所有问题:-)

IBM Notes的API文档说明了Name对象只能从Session中获取。 "To create a new Name object, use createName in Session. " 参见 this page

   Session s = NotesFactory.createSession();
   Name n = s.getUserNameObject();

我想这会 help.Try 这个

   import lotus.domino.Document;
   import lotus.domino.Name;
   import lotus.domino.Session;


   public class Example {

  int x;
  Name n= createName(x.toString());

  }