0

MVel 式が true の場合、属性の値を設定する必要があります。誰でも私を助けてくれませんか、それを行う方法。

以下のようなコード例:

      LineItem lineItem = new LineItem();

      Address address = new Address();
        address.setAddress1("ABC");
        address.setAddress2("PA");

      lineItem.setShipFromAddress(address);

    ParserContext parserContext = ParserContext.create();
    parserContext.stronglyTyped().withInput("lineItem",LineItem.class)
          .withInput("shipFromAddress", Address.class);

        Object compiledWithSet = MVEL.compileExpression("( shipFromAddress.address1 contains 'ABC' || shipFromAddress.address1 contains 'ABC DEF' ) && (shipFromAddress.address2 contains 'PA') ? setShipFromLocation('PA1') : ",parserContext);
        MVEL.executeExpression(compiledWithSet, lineItem);
4

1 に答える 1