Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add accessors on document member visitors #87

Merged
merged 1 commit into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
* TODO: Update this with a mechanism to handle String and Blob shapes with the @mediatype trait.
*/
public class DocumentMemberDeserVisitor implements ShapeVisitor<String> {
private final Format defaultTimestampFormat;
private final GenerationContext context;
private final String dataSource;
private final Format defaultTimestampFormat;

/**
* Constructor.
Expand All @@ -89,16 +89,34 @@ public DocumentMemberDeserVisitor(
this.defaultTimestampFormat = defaultTimestampFormat;
}

/**
* Gets the generation context.
*
* @return The generation context.
*/
protected final GenerationContext getContext() {
return context;
}

/**
* Gets the in-code location of the data to provide an output of
* ({@code output.foo}, {@code entry}, etc.).
*
* @return The data source.
*/
protected String getDataSource() {
protected final String getDataSource() {
return dataSource;
}

/**
* Gets the default timestamp format used in absence of a TimestampFormat trait.
*
* @return The default timestamp format.
*/
protected final Format getDefaultTimestampFormat() {
return defaultTimestampFormat;
}

@Override
public String blobShape(BlobShape shape) {
return "context.base64Decoder(" + dataSource + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
* TODO: Update this with a mechanism to handle String and Blob shapes with the @mediatype trait.
*/
public class DocumentMemberSerVisitor implements ShapeVisitor<String> {
private final Format defaultTimestampFormat;
private final GenerationContext context;
private final String dataSource;
private final Format defaultTimestampFormat;

/**
* Constructor.
Expand All @@ -88,16 +88,34 @@ public DocumentMemberSerVisitor(
this.defaultTimestampFormat = defaultTimestampFormat;
}

/**
* Gets the generation context.
*
* @return The generation context.
*/
protected final GenerationContext getContext() {
return context;
}

/**
* Gets the in-code location of the data to provide an input of
* ({@code input.foo}, {@code entry}, etc.).
*
* @return The data source.
*/
protected String getDataSource() {
protected final String getDataSource() {
return dataSource;
}

/**
* Gets the default timestamp format used in absence of a TimestampFormat trait.
*
* @return The default timestamp format.
*/
protected final Format getDefaultTimestampFormat() {
return defaultTimestampFormat;
}

@Override
public String blobShape(BlobShape shape) {
return "context.base64Encoder(" + dataSource + ")";
Expand Down