Package com.linkedin.data.message

Examples of com.linkedin.data.message.Message


   * @param format format of a message
   * @param args arguments for a message
   */
  public void addErrorMessage(final String format, final Object... args) throws FastFailException
  {
    _errorMessages.add(new Message(getPath().toArray(), format, args));
    if (isFastFail())
      throw new FastFailException();
  }
View Full Code Here


    boolean thrown = false;
    try {
      processor.run(true);
    } catch (DataProcessingException e) {
      assertEquals(e.getMessages().size(), 1, "expected exactly 1 error");
      Message m = e.getMessages().get(0);
      assertNotNull(m.getPath(), "path should be set on a message");
      assertEquals(m.getPath(), new Object[] {"a", "x"});
      thrown = true;
    }
    assertEquals(thrown, true, "exception should have been thrown");
  }
View Full Code Here

    Object value = element.getValue();
    String str = String.valueOf(value);
    int strlen = str.length();
    if ((strlen < _min) || (strlen > _max))
    {
      ctx.addResult(new Message(element.path(), "length of \"%1$s\" is out of range %2$d...%3$d", str, _min, _max));
    }
  }
View Full Code Here

    Object value = element.getValue();
    String str = String.valueOf(value);
    boolean matches = _pattern.matcher(str).matches();
    if (! matches)
    {
      ctx.addResult(new Message(element.path(), "\"%1$s\" does not match %2$s", str, _regex));
    }
  }
View Full Code Here

    public void validate(ValidatorContext ctx)
    {
      DataElement element = ctx.dataElement();
      if (element.getChild("debug") != null)
      {
        ctx.addResult(new Message(element.path(), false, " = %1$s", element.getValue()));
      }
    }
View Full Code Here

      DataElement element = context.dataElement();
      Object value = element.getValue();
      if (debug) out.println("InstanceOf: value=" + value + "(" + value.getClass().getSimpleName() + ")");
      if (_class.isInstance(value) == false)
      {
        context.addResult(new Message(element.path(), "is not a %1$s", _class.getSimpleName()));
      }
    }
View Full Code Here

      }
    }
   
    protected void addMessage(DataElement element, String format, Object... args)
    {
      _messages.add(new Message(element.path(), format, args));
      _valid = false;
    }
View Full Code Here

      _valid = false;
    }

    protected void addIsRequiredMessage(DataElement element, RecordDataSchema.Field field, String msg)
    {
      _messages.add(new Message(element.path(field.getName()), msg));
      _valid = false;
    }
View Full Code Here

    }

    @Override
    public void emitMessage(String format, Object... args)
    {
      _messageList.add(new Message(_path, format, args));
    }
View Full Code Here

    };
  }

  private void addMessage(List<String> path, String format, Object... args)
  {
    _initMessages.add(new Message(path.toArray(), format, args));
  }
View Full Code Here

TOP

Related Classes of com.linkedin.data.message.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.