Package com.linkedin.data.schema

Examples of com.linkedin.data.schema.Name


    return params;
  }

  private List<Parameter<?>> getEnumParams()
  {
    EnumDataSchema simpleEnumSchema = new EnumDataSchema(new Name("com.linkedin.restli.common.test.SimpleEnum"));
    simpleEnumSchema.setSymbols(Arrays.asList(new String[]{"A", "B", "C"}), null);
    List<Parameter<?>> enumParams = new ArrayList<Parameter<?>>();
    enumParams.add(new Parameter<SimpleEnum>(
        "simpleEnum",
        SimpleEnum.class,
View Full Code Here


  {
    final DataSchemaResolver resolver = CompatibilityUtil.getDataSchemaResolver(resolverPath);

    for(Map.Entry<String, NamedDataSchema> entry: snapshot.getModels().entrySet())
    {
      Name name = new Name(entry.getKey());
      NamedDataSchema schema = entry.getValue();
      resolver.bindNameToSchema(name, schema, DataSchemaLocation.NO_LOCATION);
    }

    return resolver;
View Full Code Here

  public CollectionResponse(DataMap data, Class<T> elementClass)
  {
    super(data, null);
    _elementClass = elementClass;
    StringBuilder errorMessageBuilder = new StringBuilder(10);
    Name elementSchemaName = new Name(elementClass.getSimpleName());
    _arraySchema = new ArrayDataSchema(new RecordDataSchema(elementSchemaName, RecordDataSchema.RecordType.RECORD));
    _arrayField = new RecordDataSchema.Field(_arraySchema);
    _arrayField.setName(ELEMENTS, errorMessageBuilder);

    if (data().get(ELEMENTS) == null)
View Full Code Here

  private BatchRequest(DataMap data, TypeSpec<T> valueType, int capacity)
  {
    super(data, null);
    _valueType = valueType;
    StringBuilder errorMessageBuilder = new StringBuilder(10);
    Name elementSchemaName = new Name(valueType.getType().getSimpleName());
    _entitiesSchema = new MapDataSchema(new RecordDataSchema(elementSchemaName, RecordDataSchema.RecordType.RECORD));
    _entitiesField = new RecordDataSchema.Field(_entitiesSchema);
    _entitiesField.setName(ENTITIES, errorMessageBuilder);

    if (data().get(ENTITIES) == null)
View Full Code Here

  }

  private static RecordDataSchema generateSchema()
  {
    StringBuilder errorMessageBuilder = new StringBuilder(10);
    ArrayDataSchema arraySchema = new ArrayDataSchema(new RecordDataSchema(new Name(CreateStatus.class.getSimpleName()), RecordDataSchema.RecordType.RECORD));
    RecordDataSchema.Field arrayField = new RecordDataSchema.Field(arraySchema);
    arrayField.setName(CollectionResponse.ELEMENTS, errorMessageBuilder);
    RecordDataSchema schema = new RecordDataSchema(new Name(BatchCreateIdResponse.class.getSimpleName()), RecordDataSchema.RecordType.RECORD);
    schema.setFields(Arrays.asList(arrayField), errorMessageBuilder);
    return schema;
  }
View Full Code Here

  public CollectionRequest(DataMap data, Class<T> elementClass)
  {
    super(data, null);
    _elementClass = elementClass;
    StringBuilder errorMessageBuilder = new StringBuilder(10);
    Name elementSchemaName = new Name(elementClass.getSimpleName());
    _arraySchema = new ArrayDataSchema(new RecordDataSchema(elementSchemaName, RecordDataSchema.RecordType.RECORD));
    _arrayField = new RecordDataSchema.Field(_arraySchema);
    _arrayField.setName(ELEMENTS, errorMessageBuilder);

    if (data().get(ELEMENTS) == null)
View Full Code Here

  private BatchResponse(DataMap data, Class<T> valueClass, int resultsCapacity, int errorsCapacity)
  {
    super(data, null);
    _valueClass = valueClass;
    StringBuilder errorMessageBuilder = new StringBuilder(10);
    Name elementSchemaName = new Name(valueClass.getSimpleName());
    _resultsSchema = new MapDataSchema(new RecordDataSchema(elementSchemaName, RecordDataSchema.RecordType.RECORD));
    _resultsField = new RecordDataSchema.Field(_resultsSchema);
    _resultsField.setName(RESULTS, errorMessageBuilder);

    Name errorSchemaName = new Name(ErrorResponse.class.getSimpleName());
    _errorsSchema = new MapDataSchema(new RecordDataSchema(errorSchemaName, RecordDataSchema.RecordType.RECORD));
    _errorsField = new RecordDataSchema.Field(_errorsSchema);
    _errorsField.setName(ERRORS, errorMessageBuilder);
   
    if (data().get(RESULTS) == null)
View Full Code Here

  protected void createSchema(Class<V> valueClass)
  {
    _valueClass = valueClass;

    final StringBuilder errorMessageBuilder = new StringBuilder(10);
    final Name elementSchemaName = new Name(valueClass.getSimpleName(), errorMessageBuilder);
    final MapDataSchema resultsSchema = new MapDataSchema(new RecordDataSchema(elementSchemaName, RecordDataSchema.RecordType.RECORD));
    final RecordDataSchema.Field resultsField = new RecordDataSchema.Field(resultsSchema);
    resultsField.setName(RESULTS, errorMessageBuilder);

    final Name errorSchemaName = new Name(ErrorResponse.class.getSimpleName(), errorMessageBuilder);
    final MapDataSchema errorsSchema = new MapDataSchema(new RecordDataSchema(errorSchemaName, RecordDataSchema.RecordType.RECORD));
    final RecordDataSchema.Field errorsField = new RecordDataSchema.Field(errorsSchema);
    errorsField.setName(ERRORS, errorMessageBuilder);

    final Name name = new Name(BatchKVResponse.class.getSimpleName(), errorMessageBuilder);
    _schema = new RecordDataSchema(name, RecordDataSchema.RecordType.RECORD);
    _schema.setFields(Arrays.asList(resultsField, errorsField), errorMessageBuilder);
  }
View Full Code Here

   *                                  are already set.
   */
  public static RecordDataSchema buildSchema(String name, Collection<? extends FieldDef<?>> fieldDefs)
  {
    StringBuilder errorMessageBuilder = new StringBuilder();
    RecordDataSchema schema = new RecordDataSchema(new Name(name, errorMessageBuilder), RecordDataSchema.RecordType.RECORD);

    List<RecordDataSchema.Field> fields = new ArrayList<RecordDataSchema.Field>(fieldDefs.size());
    for (FieldDef<?> fieldDef: fieldDefs)
    {
      RecordDataSchema.Field paramField = fieldDef.getField();
View Full Code Here

  private void bindSchemaResolvers()
  {
    StringBuilder errors = new StringBuilder();

    Name toneName = new Name("com.linkedin.greetings.api.Tone");
    EnumDataSchema tone = new EnumDataSchema(toneName);
    List<String> symbols = new ArrayList<String>();
    symbols.add("FRIENDLY");
    symbols.add("SINCERE");
    symbols.add("INSULTING");
    tone.setSymbols(symbols, errors);

    Name greetingName = new Name("com.linkedin.greetings.api.Greeting");
    RecordDataSchema prevGreeting = new RecordDataSchema(greetingName, RecordDataSchema.RecordType.RECORD);
    List<RecordDataSchema.Field> oldFields = new ArrayList<RecordDataSchema.Field>();
    RecordDataSchema.Field id = new RecordDataSchema.Field(new LongDataSchema());
    id.setName("id", errors);
    oldFields.add(id);
View Full Code Here

TOP

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

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.