/** * User email * */ public PathSpec email() { return new PathSpec(getPathComponents(), "email"); }
private void writeIncludes(RecordDataSchema recordDataSchema) throws IOException { _builder.writeFieldName(INCLUDE_KEY); _builder.writeStartArray(); for (NamedDataSchema includedSchema : recordDataSchema.getInclude()) { encode(includedSchema); } _builder.writeEndArray(); }
private RecordDataSchema.Field buildDiscriminatorEnumField( String parentRecordFullName, List<String> memberKeys, StringBuilder errorMessageBuilder) { Name enumName = new Name(parentRecordFullName + SchemaTranslator.CONTAINER_RECORD_DISCRIMINATOR_ENUM_SUFFIX, errorMessageBuilder); EnumDataSchema enumDataSchema = new EnumDataSchema(enumName); enumDataSchema.setSymbols(memberKeys, errorMessageBuilder); RecordDataSchema.Field field = new RecordDataSchema.Field(enumDataSchema); field.setName(DataSchemaConstants.DISCRIMINATOR_FIELD, errorMessageBuilder); field.setDoc("Contains the name of the field that has its value set."); field.setDeclaredInline(true); field.setOptional(false); return field; } }
/** * Encode a field's type (i.e. {@link DataSchema}. * * @param field providing the type to encode. * @throws IOException if there is an error while encoding. */ protected void encodeFieldType(RecordDataSchema.Field field) throws IOException { _builder.writeFieldName(TYPE_KEY); DataSchema fieldSchema = field.getType(); encode(fieldSchema, field.isDeclaredInline()); }
private void writeTyperef(TyperefDataSchema schema) throws IOException { writeDoc(schema.getDoc()); writeProperties(schema.getProperties()); write("typeref "); write(toTypeIdentifier(schema)); write(" = "); DataSchema ref = schema.getRef(); writeReferenceOrInline(ref, schema.isRefDeclaredInline()); }
private void writeArray(ArrayDataSchema schema) throws IOException { write("array["); writeReferenceOrInline(schema.getItems(), schema.isItemsDeclaredInline()); write("]"); }
private void writeMap(MapDataSchema schema) throws IOException { write("map[string, "); writeReferenceOrInline(schema.getValues(), schema.isValuesDeclaredInline()); write("]"); }
/** * Encode the properties of the {@link DataSchema} * * @param schema the {@link DataSchema} being encoded. * @throws IOException if there is an error while encoding. */ protected void encodeProperties(DataSchema schema) throws IOException { _builder.writeProperties(schema.getProperties()); }
/** * Returns the java class representing the de-referenced type of the input schema. */ public static Class<?> getDataClassFromSchema(DataSchema schema) { if (schema == null) { return null; } return dataSchemaTypeToPrimitiveDataSchemaClass(schema.getDereferencedType()); }
/** * Returns the key that will be used for this member while serializing the Union. If an alias * is available for this member, the alias will be returned else the default union member key * of the member's type will be returned. * * @return The union member key for this member */ public String getUnionMemberKey() { return hasAlias() ? _alias : _type.getUnionMemberKey(); }
/** * Look for {@link DataSchema} with the specified name. * * @param fullName to lookup. * @return the {@link DataSchema} if lookup was successful else return null. */ public DataSchema lookupName(String fullName) { DataSchema schema = DataSchemaUtil.typeStringToPrimitiveDataSchema(fullName); if (schema == null) { schema = getResolver().findDataSchema(fullName, errorMessageBuilder()); } return schema; }
protected void encodeFieldProperties(RecordDataSchema.Field field) throws IOException { _builder.writeProperties(field.getProperties()); }
/** * Dump the top level schemas. * * @return a textual dump of the top level schemas. */ public String schemasToString() { return SchemaToJsonEncoder.schemasToJson(topLevelDataSchemas(), JsonBuilder.Pretty.SPACES); }
/** * Return the {@link DataSchema}'s unqualified name. * * @return the {@link DataSchema}'s unqualified name. */ @Override public String getName() { return _name.getName(); }
/** * The username this session * */ public PathSpec userId() { return new PathSpec(getPathComponents(), "userId"); }