Package com.linkedin.data.schema

Examples of com.linkedin.data.schema.DataSchemaTraverse


      private void connectSchemaToResource(VisitContext visitContext, final NamedDataSchema schema)
      {
        final Node<NamedDataSchema> schemaNode = _relationships.get(schema);
        _dataModels.put(schema.getFullName(), schema);

        final DataSchemaTraverse traveler = new DataSchemaTraverse();
        traveler.traverse(schema, new DataSchemaTraverse.Callback()
        {
          @Override
          public void callback(List<String> path, DataSchema nestedSchema)
          {
            if (nestedSchema instanceof RecordDataSchema && nestedSchema != schema)
View Full Code Here


   */
  private IdentityHashMap<Object, List<Validator>> cacheValidators(DataSchema schema)
  {
    final IdentityHashMap<Object, List<Validator>> map = new IdentityHashMap<Object, List<Validator>>();

    DataSchemaTraverse traverse = new DataSchemaTraverse();
    traverse.traverse(schema, new DataSchemaTraverse.Callback()
    {
      @Override
      public void callback(List<String> path, DataSchema schema)
      {
        List<Validator> validatorList = map.get(schema);
View Full Code Here

    }
    if (resultDataSchema == null)
    {
      // translationMode == TRANSLATE or no embedded schema

      DataSchemaTraverse traverse = new DataSchemaTraverse();
      traverse.traverse(dataSchema, AvroToDataSchemaConvertCallback.INSTANCE);
      // convert default values
      traverse.traverse(dataSchema, DefaultAvroToDataConvertCallback.INSTANCE);
      // make sure it can round-trip
      String dataSchemaJson = dataSchema.toString();
      resultDataSchema = DataTemplateUtil.parseSchema(dataSchemaJson);
    }
    return resultDataSchema;
View Full Code Here

   * @throws IllegalArgumentException if the {@link DataSchema} cannot be translated.
   */
  public static String dataToAvroSchemaJson(DataSchema dataSchema, DataToAvroSchemaTranslationOptions options) throws IllegalArgumentException
  {
    // convert default values
    DataSchemaTraverse postOrderTraverse = new DataSchemaTraverse(DataSchemaTraverse.Order.POST_ORDER);
    final DefaultDataToAvroConvertCallback defaultConverter = new DefaultDataToAvroConvertCallback(options);
    postOrderTraverse.traverse(dataSchema, defaultConverter);
    // convert schema
    String schemaJson = SchemaToAvroJsonEncoder.schemaToAvro(dataSchema, defaultConverter.fieldDefaultValueProvider(), options);
    return schemaJson;
  }
View Full Code Here

TOP

Related Classes of com.linkedin.data.schema.DataSchemaTraverse

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.