Package com.linkedin.data.element

Examples of com.linkedin.data.element.SimpleDataElement


  }

  @Deprecated
  public static ValidationResult validate(Object value, DataSchema schema, Validator validator)
  {
    return validate(new SimpleDataElement(value, schema), validator);
  }
View Full Code Here


    return validate(object, schema, options, null);
  }

  public static ValidationResult validate(Object object, DataSchema schema, ValidationOptions options, Validator validator)
  {
    return validate(new SimpleDataElement(object, schema), options, validator);
  }
View Full Code Here

          ((MutableDataElement) element).setValue(fixed);
          validatorElement = element;
        }
        else
        {
           validatorElement = new SimpleDataElement(fixed, element.getName(), schema, element.getParent());
        }
        _context._dataElement = validatorElement;
        _validator.validate(_context);
      }
      return fixed;
View Full Code Here

    return s.toString();
  }

  public void traverseAndCheck(Object root, String preExpected, String postExpected)
  {
    DataElement element = new SimpleDataElement(root, null);
    traverseAndCheckWithDataElement(element, preExpected, postExpected, false);
  }
View Full Code Here

    DataMap grandParent = new DataMap();
    DataMap parent = new DataMap();
    grandParent.put("child", parent);
    parent.put("child", root);

    DataElement grandParentElement = new SimpleDataElement(grandParent, null);
    DataElement parentElement = new SimpleDataElement(parent, "child", null, grandParentElement);
    DataElement element = new SimpleDataElement(root, "child", null, parentElement);

    String preExpected =
      "  path=/child/child, class=com.linkedin.data.DataMap\n" +
      "   path=/child/child/bytes, class=com.linkedin.data.ByteString, value=abc\n" +
      "   path=/child/child/int, class=java.lang.Integer, value=1\n" +
View Full Code Here

   
    public SimpleTestData() throws IOException
    {
      value = TestUtil.dataMapFromString(dataJson);
      schema = (RecordDataSchema) TestUtil.dataSchemaFromString(schemaJson);
      data = new SimpleDataElement(value, schema);
    }
View Full Code Here

  @Test
  public void testRemoveByPredicateAtPath() throws Exception
  {
    SimpleTestData data = IteratorTestData.createSimpleTestData();
   
    SimpleDataElement el = data.getDataElement();
    Builder.create(el.getValue(), el.getSchema(), IterationOrder.PRE_ORDER)
        .filterBy(Predicates.and(Predicates.pathMatchesPathSpec(IteratorTestData.PATH_TO_ID), IteratorTestData.LESS_THAN_3_CONDITION))
        .remove();
   
    assertTrue(data.getValue().getDataList("foo").getDataMap(0).getInteger("id") == null);
    assertTrue(data.getValue().getDataList("foo").getDataMap(1).getInteger("id") == null);
View Full Code Here

  @Test
  public void testRemoveByPredicate() throws Exception
  {
    SimpleTestData data = IteratorTestData.createSimpleTestData();
   
    SimpleDataElement el = data.getDataElement();
    Builder.create(el.getValue(), el.getSchema(), IterationOrder.PRE_ORDER)
    .filterBy(Predicates.pathMatchesPathSpec(IteratorTestData.PATH_TO_ID))
    .remove();

    assertTrue(data.getValue().getDataList("foo").getDataMap(0).getInteger("id") == null);
    assertTrue(data.getValue().getDataList("foo").getDataMap(1).getInteger("id") == null);
View Full Code Here

  @Test
  public void testRemoveByPredicateWithPostOrder() throws Exception
  {
    SimpleTestData data = IteratorTestData.createSimpleTestData();
   
    SimpleDataElement el = data.getDataElement();
    Builder.create(el.getValue(), el.getSchema(), IterationOrder.POST_ORDER)
    .filterBy(Predicates.pathMatchesPathSpec(IteratorTestData.PATH_TO_ID))
    .remove();

    assertTrue(data.getValue().getDataList("foo").getDataMap(0).getInteger("id") == null);
    assertTrue(data.getValue().getDataList("foo").getDataMap(1).getInteger("id") == null);
View Full Code Here

        String anySchemaName = entry.getKey();
        Object anyValue = entry.getValue();
        DataSchema anySchema = schemaFromName(context, anySchemaName);
        if (anySchema != null)
        {
          DataElement anyElement = new SimpleDataElement(anyValue, entry.getKey(), anySchema, dataElement);
          // do we want to have cache for anySchemaName to validator
          // do we care about classMap argument to DataSchemaAnnotationValidator
          DataSchemaAnnotationValidator validator = new DataSchemaAnnotationValidator(anySchema);
          if (validator.isInitOk() == false)
          {
View Full Code Here

TOP

Related Classes of com.linkedin.data.element.SimpleDataElement

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.