Package com.linkedin.data.schema

Examples of com.linkedin.data.schema.RecordDataSchema


    checkRequestBuilder(request, ResourceMethod.ACTION, ActionResponseDecoder.class, expectedUri, requestInput, version);
  }

  private static DynamicRecordTemplate createDynamicRecordTemplate(String schemaName, Map<FieldDef<?>, Object> fieldDefs)
  {
    RecordDataSchema recordDataSchema = DynamicRecordMetadata.buildSchema(schemaName, fieldDefs.keySet());
    return new DynamicRecordTemplate(recordDataSchema, fieldDefs);
  }
View Full Code Here


      {
        foundTypes.put(namedDataSchema.getFullName(), namedDataSchema);

        if (schema instanceof RecordDataSchema) // recurse into record, record any contained types.
        {
          RecordDataSchema recordDataSchema = (RecordDataSchema)schema;
          for (NamedDataSchema includedSchema : recordDataSchema.getInclude())
          {
            recordType(includedSchema, foundTypes, typeOrder);
          }
          for(RecordDataSchema.Field field : recordDataSchema.getFields())
          {
            recordType(field.getType(), foundTypes, typeOrder);
          }
        }
        else if (schema instanceof TyperefDataSchema)
View Full Code Here

          @Override
          public void callback(List<String> path, DataSchema nestedSchema)
          {
            if (nestedSchema instanceof RecordDataSchema && nestedSchema != schema)
            {
              final RecordDataSchema nestedRecordSchema = (RecordDataSchema) nestedSchema;
              _dataModels.put(nestedRecordSchema.getFullName(), nestedRecordSchema);
              final Node<RecordDataSchema> node = _relationships.get(nestedRecordSchema);
              schemaNode.addAdjacentNode(node);
            }
          }
        });
View Full Code Here

      if (_sourceLocations.contains(location) || _sources.contains(fullName))
      {
        NamedDataSchema schema = nameToSchema.get(fullName);
        if (schema instanceof RecordDataSchema)
        {
          RecordDataSchema recordDataSchema = (RecordDataSchema) schema;
          File generatedFile = fileForAvroSchema(fullName, targetDirectory);
          generatedFiles.add(generatedFile);

          String preTranslateSchemaText = recordDataSchema.toString();
          String avroSchemaText = SchemaTranslator.dataToAvroSchemaJson(recordDataSchema, _options);
          _fileToAvroSchemaMap.put(generatedFile, avroSchemaText);
          String postTranslateSchemaText = recordDataSchema.toString();
          assert(preTranslateSchemaText.equals(postTranslateSchemaText));
        }
      }
    }
View Full Code Here

    ResourceModel model = RestLiTestHelper.buildResourceModel(StatusCollectionResource.class);

    String actionName = "return" + actionReturnType.getSimpleName();
    List<Parameter<?>> parameters = Collections.<Parameter<?>>emptyList();

    RecordDataSchema actionReturnRecordDataSchema;
    FieldDef<?> returnFieldDef;
    if (actionReturnType != Void.TYPE)
    {
      @SuppressWarnings({"unchecked","rawtypes"})
      FieldDef<?> nonVoidFieldDef = new FieldDef(ActionResponse.VALUE_NAME,
View Full Code Here

            validatorList = buildValidatorList(validateObject, path, schema);
          }
          map.put(schema, validatorList);
          if (schema.getType() == DataSchema.Type.RECORD)
          {
            RecordDataSchema recordDataSchema = (RecordDataSchema) schema;
            for (RecordDataSchema.Field field : recordDataSchema.getFields())
            {
              validateObject = field.getProperties().get(VALIDATE);
              if (validateObject == null)
              {
                validatorList = NO_VALIDATORS;
View Full Code Here

      if (parentSchema != null && parentSchema.getType() == DataSchema.Type.RECORD)
      {
        Object name = element.getName();
        if (name.getClass() == String.class)
        {
          RecordDataSchema recordDataSchema = (RecordDataSchema) parentSchema;
          RecordDataSchema.Field field = recordDataSchema.getField((String) name);
          if (field != null)
          {
            getAndInvokeValidatorList(context, field);
          }
        }
View Full Code Here

    }
  }

  public static FieldInfo fieldInfo(RecordTemplate recordTemplate, String fieldName)
  {
    RecordDataSchema schema = recordTemplate.schema();
    RecordDataSchema.Field field = schema.getField(fieldName);
    String getterName = methodName(field.getType().getDereferencedType() == DataSchema.Type.BOOLEAN ? "is" : "get", fieldName);
    try
    {
      Method method = recordTemplate.getClass().getMethod(getterName);
      Class<?> fieldClass = method.getReturnType();
View Full Code Here

    final ActionResponse<RecordTemplateWithDefaultValue> response = MockActionResponseFactory.create(RecordTemplateWithDefaultValue.class, record);

    Assert.assertEquals(response.getValue(), record);

    final RecordDataSchema schema = response.schema();
    Assert.assertEquals(schema.getName(), ActionResponse.class.getSimpleName());
    Assert.assertEquals(schema.getField(ActionResponse.VALUE_NAME).getType(), DataTemplateUtil.getSchema(RecordTemplateWithDefaultValue.class));
  }
View Full Code Here

      (ActionResponse<CollectionResponse<RecordTemplateWithDefaultValue>>) (Object)
          MockActionResponseFactory.create(CollectionResponse.class, collectionResponse.schema(), collectionResponse);

    Assert.assertEquals(response.getValue(), collectionResponse);

    final RecordDataSchema schema = response.schema();
    Assert.assertEquals(schema.getName(), ActionResponse.class.getSimpleName());
    Assert.assertEquals(schema.getField(ActionResponse.VALUE_NAME).getType(), collectionResponse.schema());
  }
View Full Code Here

TOP

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

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.