Commit 5aa88fbf authored by Prakash Pariki's avatar Prakash Pariki

Initial Commit

parent 3954bc89
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
</code_scheme>
</component>
\ No newline at end of file
plugins {
id 'com.commercehub.gradle.plugin.avro' version '0.16.0'
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven {
url 'http://packages.confluent.io/maven/'
}
}
dependencies {
implementation 'io.confluent:kafka-avro-serializer:5.3.0'
implementation 'org.apache.avro:avro:1.8.2'
implementation 'org.apache.avro:avro-compiler:1.8.2'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
#Tue Apr 07 13:26:42 IST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
pluginManagement {
repositories {
gradlePluginPortal()
jcenter()
maven {
name "JCenter Gradle Plugins"
url "https://dl.bintray.com/gradle/gradle-plugins"
}
}
}
rootProject.name = 'AvroConfluentSchema'
\ No newline at end of file
[
{
"type":"record",
"namespace":"com.example",
"name":"Reward",
"fields":[
{"name":"type","type":"string"},
{"name":"value","type":"int"},
{"name":"currency","type":"string"},
{"name":"discount_type","type":"string"}
]
},
{
"type":"record",
"namespace":"com.example",
"name":"Offer",
"doc":"This is Offer Information",
"fields":[
{ "name":"offer_id","type":"long"},
{ "name":"offer_type","type":"int"},
{ "name":"offer_name","type":"string"},
{ "name":"store","type":"string" ,"default":"ANY"},
{ "name":"customerGroup","type":"string" ,"default":"ANY"},
{"name":"Reward","type":"com.example.Reward"}
]
}
]
\ No newline at end of file
/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package com.safeway.offerData.model;
import org.apache.avro.specific.SpecificData;
import org.apache.avro.message.BinaryMessageEncoder;
import org.apache.avro.message.BinaryMessageDecoder;
import org.apache.avro.message.SchemaStore;
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class OfferMetaData extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
private static final long serialVersionUID = -8201908970359334344L;
public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"OfferMetaData\",\"namespace\":\"com.safeway.offerData.model\",\"fields\":[{\"name\":\"offerId\",\"type\":\"int\"},{\"name\":\"eligibility\",\"type\":\"string\"},{\"name\":\"discountType\",\"type\":\"string\"},{\"name\":\"status\",\"type\":\"string\"},{\"name\":\"startTime\",\"type\":\"string\"},{\"name\":\"endTime\",\"type\":\"string\"},{\"name\":\"offerDescription\",\"type\":\"string\"},{\"name\":\"offerType\",\"type\":\"string\"},{\"name\":\"rcptText\",\"type\":\"string\"}]}");
public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
private static SpecificData MODEL$ = new SpecificData();
private static final BinaryMessageEncoder<OfferMetaData> ENCODER =
new BinaryMessageEncoder<OfferMetaData>(MODEL$, SCHEMA$);
private static final BinaryMessageDecoder<OfferMetaData> DECODER =
new BinaryMessageDecoder<OfferMetaData>(MODEL$, SCHEMA$);
/**
* Return the BinaryMessageDecoder instance used by this class.
*/
public static BinaryMessageDecoder<OfferMetaData> getDecoder() {
return DECODER;
}
/**
* Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}.
* @param resolver a {@link SchemaStore} used to find schemas by fingerprint
*/
public static BinaryMessageDecoder<OfferMetaData> createDecoder(SchemaStore resolver) {
return new BinaryMessageDecoder<OfferMetaData>(MODEL$, SCHEMA$, resolver);
}
/** Serializes this OfferMetaData to a ByteBuffer. */
public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException {
return ENCODER.encode(this);
}
/** Deserializes a OfferMetaData from a ByteBuffer. */
public static OfferMetaData fromByteBuffer(
java.nio.ByteBuffer b) throws java.io.IOException {
return DECODER.decode(b);
}
@Deprecated public int offerId;
@Deprecated public java.lang.CharSequence eligibility;
@Deprecated public java.lang.CharSequence discountType;
@Deprecated public java.lang.CharSequence status;
@Deprecated public java.lang.CharSequence startTime;
@Deprecated public java.lang.CharSequence endTime;
@Deprecated public java.lang.CharSequence offerDescription;
@Deprecated public java.lang.CharSequence offerType;
@Deprecated public java.lang.CharSequence rcptText;
/**
* Default constructor. Note that this does not initialize fields
* to their default values from the schema. If that is desired then
* one should use <code>newBuilder()</code>.
*/
public OfferMetaData() {}
/**
* All-args constructor.
* @param offerId The new value for offerId
* @param eligibility The new value for eligibility
* @param discountType The new value for discountType
* @param status The new value for status
* @param startTime The new value for startTime
* @param endTime The new value for endTime
* @param offerDescription The new value for offerDescription
* @param offerType The new value for offerType
* @param rcptText The new value for rcptText
*/
public OfferMetaData(java.lang.Integer offerId, java.lang.CharSequence eligibility, java.lang.CharSequence discountType, java.lang.CharSequence status, java.lang.CharSequence startTime, java.lang.CharSequence endTime, java.lang.CharSequence offerDescription, java.lang.CharSequence offerType, java.lang.CharSequence rcptText) {
this.offerId = offerId;
this.eligibility = eligibility;
this.discountType = discountType;
this.status = status;
this.startTime = startTime;
this.endTime = endTime;
this.offerDescription = offerDescription;
this.offerType = offerType;
this.rcptText = rcptText;
}
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
switch (field$) {
case 0: return offerId;
case 1: return eligibility;
case 2: return discountType;
case 3: return status;
case 4: return startTime;
case 5: return endTime;
case 6: return offerDescription;
case 7: return offerType;
case 8: return rcptText;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
// Used by DatumReader. Applications should not call.
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
case 0: offerId = (java.lang.Integer)value$; break;
case 1: eligibility = (java.lang.CharSequence)value$; break;
case 2: discountType = (java.lang.CharSequence)value$; break;
case 3: status = (java.lang.CharSequence)value$; break;
case 4: startTime = (java.lang.CharSequence)value$; break;
case 5: endTime = (java.lang.CharSequence)value$; break;
case 6: offerDescription = (java.lang.CharSequence)value$; break;
case 7: offerType = (java.lang.CharSequence)value$; break;
case 8: rcptText = (java.lang.CharSequence)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'offerId' field.
* @return The value of the 'offerId' field.
*/
public java.lang.Integer getOfferId() {
return offerId;
}
/**
* Sets the value of the 'offerId' field.
* @param value the value to set.
*/
public void setOfferId(java.lang.Integer value) {
this.offerId = value;
}
/**
* Gets the value of the 'eligibility' field.
* @return The value of the 'eligibility' field.
*/
public java.lang.CharSequence getEligibility() {
return eligibility;
}
/**
* Sets the value of the 'eligibility' field.
* @param value the value to set.
*/
public void setEligibility(java.lang.CharSequence value) {
this.eligibility = value;
}
/**
* Gets the value of the 'discountType' field.
* @return The value of the 'discountType' field.
*/
public java.lang.CharSequence getDiscountType() {
return discountType;
}
/**
* Sets the value of the 'discountType' field.
* @param value the value to set.
*/
public void setDiscountType(java.lang.CharSequence value) {
this.discountType = value;
}
/**
* Gets the value of the 'status' field.
* @return The value of the 'status' field.
*/
public java.lang.CharSequence getStatus() {
return status;
}
/**
* Sets the value of the 'status' field.
* @param value the value to set.
*/
public void setStatus(java.lang.CharSequence value) {
this.status = value;
}
/**
* Gets the value of the 'startTime' field.
* @return The value of the 'startTime' field.
*/
public java.lang.CharSequence getStartTime() {
return startTime;
}
/**
* Sets the value of the 'startTime' field.
* @param value the value to set.
*/
public void setStartTime(java.lang.CharSequence value) {
this.startTime = value;
}
/**
* Gets the value of the 'endTime' field.
* @return The value of the 'endTime' field.
*/
public java.lang.CharSequence getEndTime() {
return endTime;
}
/**
* Sets the value of the 'endTime' field.
* @param value the value to set.
*/
public void setEndTime(java.lang.CharSequence value) {
this.endTime = value;
}
/**
* Gets the value of the 'offerDescription' field.
* @return The value of the 'offerDescription' field.
*/
public java.lang.CharSequence getOfferDescription() {
return offerDescription;
}
/**
* Sets the value of the 'offerDescription' field.
* @param value the value to set.
*/
public void setOfferDescription(java.lang.CharSequence value) {
this.offerDescription = value;
}
/**
* Gets the value of the 'offerType' field.
* @return The value of the 'offerType' field.
*/
public java.lang.CharSequence getOfferType() {
return offerType;
}
/**
* Sets the value of the 'offerType' field.
* @param value the value to set.
*/
public void setOfferType(java.lang.CharSequence value) {
this.offerType = value;
}
/**
* Gets the value of the 'rcptText' field.
* @return The value of the 'rcptText' field.
*/
public java.lang.CharSequence getRcptText() {
return rcptText;
}
/**
* Sets the value of the 'rcptText' field.
* @param value the value to set.
*/
public void setRcptText(java.lang.CharSequence value) {
this.rcptText = value;
}
/**
* Creates a new OfferMetaData RecordBuilder.
* @return A new OfferMetaData RecordBuilder
*/
public static com.safeway.offerData.model.OfferMetaData.Builder newBuilder() {
return new com.safeway.offerData.model.OfferMetaData.Builder();
}
/**
* Creates a new OfferMetaData RecordBuilder by copying an existing Builder.
* @param other The existing builder to copy.
* @return A new OfferMetaData RecordBuilder
*/
public static com.safeway.offerData.model.OfferMetaData.Builder newBuilder(com.safeway.offerData.model.OfferMetaData.Builder other) {
return new com.safeway.offerData.model.OfferMetaData.Builder(other);
}
/**
* Creates a new OfferMetaData RecordBuilder by copying an existing OfferMetaData instance.
* @param other The existing instance to copy.
* @return A new OfferMetaData RecordBuilder
*/
public static com.safeway.offerData.model.OfferMetaData.Builder newBuilder(com.safeway.offerData.model.OfferMetaData other) {
return new com.safeway.offerData.model.OfferMetaData.Builder(other);
}
/**
* RecordBuilder for OfferMetaData instances.
*/
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<OfferMetaData>
implements org.apache.avro.data.RecordBuilder<OfferMetaData> {
private int offerId;
private java.lang.CharSequence eligibility;
private java.lang.CharSequence discountType;
private java.lang.CharSequence status;
private java.lang.CharSequence startTime;
private java.lang.CharSequence endTime;
private java.lang.CharSequence offerDescription;
private java.lang.CharSequence offerType;
private java.lang.CharSequence rcptText;
/** Creates a new Builder */
private Builder() {
super(SCHEMA$);
}
/**
* Creates a Builder by copying an existing Builder.
* @param other The existing Builder to copy.
*/
private Builder(com.safeway.offerData.model.OfferMetaData.Builder other) {
super(other);
if (isValidValue(fields()[0], other.offerId)) {
this.offerId = data().deepCopy(fields()[0].schema(), other.offerId);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.eligibility)) {
this.eligibility = data().deepCopy(fields()[1].schema(), other.eligibility);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.discountType)) {
this.discountType = data().deepCopy(fields()[2].schema(), other.discountType);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.status)) {
this.status = data().deepCopy(fields()[3].schema(), other.status);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.startTime)) {
this.startTime = data().deepCopy(fields()[4].schema(), other.startTime);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.endTime)) {
this.endTime = data().deepCopy(fields()[5].schema(), other.endTime);
fieldSetFlags()[5] = true;
}
if (isValidValue(fields()[6], other.offerDescription)) {
this.offerDescription = data().deepCopy(fields()[6].schema(), other.offerDescription);
fieldSetFlags()[6] = true;
}
if (isValidValue(fields()[7], other.offerType)) {
this.offerType = data().deepCopy(fields()[7].schema(), other.offerType);
fieldSetFlags()[7] = true;
}
if (isValidValue(fields()[8], other.rcptText)) {
this.rcptText = data().deepCopy(fields()[8].schema(), other.rcptText);
fieldSetFlags()[8] = true;
}
}
/**
* Creates a Builder by copying an existing OfferMetaData instance
* @param other The existing instance to copy.
*/
private Builder(com.safeway.offerData.model.OfferMetaData other) {
super(SCHEMA$);
if (isValidValue(fields()[0], other.offerId)) {
this.offerId = data().deepCopy(fields()[0].schema(), other.offerId);
fieldSetFlags()[0] = true;
}
if (isValidValue(fields()[1], other.eligibility)) {
this.eligibility = data().deepCopy(fields()[1].schema(), other.eligibility);
fieldSetFlags()[1] = true;
}
if (isValidValue(fields()[2], other.discountType)) {
this.discountType = data().deepCopy(fields()[2].schema(), other.discountType);
fieldSetFlags()[2] = true;
}
if (isValidValue(fields()[3], other.status)) {
this.status = data().deepCopy(fields()[3].schema(), other.status);
fieldSetFlags()[3] = true;
}
if (isValidValue(fields()[4], other.startTime)) {
this.startTime = data().deepCopy(fields()[4].schema(), other.startTime);
fieldSetFlags()[4] = true;
}
if (isValidValue(fields()[5], other.endTime)) {
this.endTime = data().deepCopy(fields()[5].schema(), other.endTime);
fieldSetFlags()[5] = true;
}
if (isValidValue(fields()[6], other.offerDescription)) {
this.offerDescription = data().deepCopy(fields()[6].schema(), other.offerDescription);
fieldSetFlags()[6] = true;
}
if (isValidValue(fields()[7], other.offerType)) {
this.offerType = data().deepCopy(fields()[7].schema(), other.offerType);
fieldSetFlags()[7] = true;
}
if (isValidValue(fields()[8], other.rcptText)) {
this.rcptText = data().deepCopy(fields()[8].schema(), other.rcptText);
fieldSetFlags()[8] = true;
}
}
/**
* Gets the value of the 'offerId' field.
* @return The value.
*/
public java.lang.Integer getOfferId() {
return offerId;
}
/**
* Sets the value of the 'offerId' field.
* @param value The value of 'offerId'.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder setOfferId(int value) {
validate(fields()[0], value);
this.offerId = value;
fieldSetFlags()[0] = true;
return this;
}
/**
* Checks whether the 'offerId' field has been set.
* @return True if the 'offerId' field has been set, false otherwise.
*/
public boolean hasOfferId() {
return fieldSetFlags()[0];
}
/**
* Clears the value of the 'offerId' field.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder clearOfferId() {
fieldSetFlags()[0] = false;
return this;
}
/**
* Gets the value of the 'eligibility' field.
* @return The value.
*/
public java.lang.CharSequence getEligibility() {
return eligibility;
}
/**
* Sets the value of the 'eligibility' field.
* @param value The value of 'eligibility'.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder setEligibility(java.lang.CharSequence value) {
validate(fields()[1], value);
this.eligibility = value;
fieldSetFlags()[1] = true;
return this;
}
/**
* Checks whether the 'eligibility' field has been set.
* @return True if the 'eligibility' field has been set, false otherwise.
*/
public boolean hasEligibility() {
return fieldSetFlags()[1];
}
/**
* Clears the value of the 'eligibility' field.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder clearEligibility() {
eligibility = null;
fieldSetFlags()[1] = false;
return this;
}
/**
* Gets the value of the 'discountType' field.
* @return The value.
*/
public java.lang.CharSequence getDiscountType() {
return discountType;
}
/**
* Sets the value of the 'discountType' field.
* @param value The value of 'discountType'.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder setDiscountType(java.lang.CharSequence value) {
validate(fields()[2], value);
this.discountType = value;
fieldSetFlags()[2] = true;
return this;
}
/**
* Checks whether the 'discountType' field has been set.
* @return True if the 'discountType' field has been set, false otherwise.
*/
public boolean hasDiscountType() {
return fieldSetFlags()[2];
}
/**
* Clears the value of the 'discountType' field.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder clearDiscountType() {
discountType = null;
fieldSetFlags()[2] = false;
return this;
}
/**
* Gets the value of the 'status' field.
* @return The value.
*/
public java.lang.CharSequence getStatus() {
return status;
}
/**
* Sets the value of the 'status' field.
* @param value The value of 'status'.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder setStatus(java.lang.CharSequence value) {
validate(fields()[3], value);
this.status = value;
fieldSetFlags()[3] = true;
return this;
}
/**
* Checks whether the 'status' field has been set.
* @return True if the 'status' field has been set, false otherwise.
*/
public boolean hasStatus() {
return fieldSetFlags()[3];
}
/**
* Clears the value of the 'status' field.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder clearStatus() {
status = null;
fieldSetFlags()[3] = false;
return this;
}
/**
* Gets the value of the 'startTime' field.
* @return The value.
*/
public java.lang.CharSequence getStartTime() {
return startTime;
}
/**
* Sets the value of the 'startTime' field.
* @param value The value of 'startTime'.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder setStartTime(java.lang.CharSequence value) {
validate(fields()[4], value);
this.startTime = value;
fieldSetFlags()[4] = true;
return this;
}
/**
* Checks whether the 'startTime' field has been set.
* @return True if the 'startTime' field has been set, false otherwise.
*/
public boolean hasStartTime() {
return fieldSetFlags()[4];
}
/**
* Clears the value of the 'startTime' field.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder clearStartTime() {
startTime = null;
fieldSetFlags()[4] = false;
return this;
}
/**
* Gets the value of the 'endTime' field.
* @return The value.
*/
public java.lang.CharSequence getEndTime() {
return endTime;
}
/**
* Sets the value of the 'endTime' field.
* @param value The value of 'endTime'.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder setEndTime(java.lang.CharSequence value) {
validate(fields()[5], value);
this.endTime = value;
fieldSetFlags()[5] = true;
return this;
}
/**
* Checks whether the 'endTime' field has been set.
* @return True if the 'endTime' field has been set, false otherwise.
*/
public boolean hasEndTime() {
return fieldSetFlags()[5];
}
/**
* Clears the value of the 'endTime' field.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder clearEndTime() {
endTime = null;
fieldSetFlags()[5] = false;
return this;
}
/**
* Gets the value of the 'offerDescription' field.
* @return The value.
*/
public java.lang.CharSequence getOfferDescription() {
return offerDescription;
}
/**
* Sets the value of the 'offerDescription' field.
* @param value The value of 'offerDescription'.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder setOfferDescription(java.lang.CharSequence value) {
validate(fields()[6], value);
this.offerDescription = value;
fieldSetFlags()[6] = true;
return this;
}
/**
* Checks whether the 'offerDescription' field has been set.
* @return True if the 'offerDescription' field has been set, false otherwise.
*/
public boolean hasOfferDescription() {
return fieldSetFlags()[6];
}
/**
* Clears the value of the 'offerDescription' field.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder clearOfferDescription() {
offerDescription = null;
fieldSetFlags()[6] = false;
return this;
}
/**
* Gets the value of the 'offerType' field.
* @return The value.
*/
public java.lang.CharSequence getOfferType() {
return offerType;
}
/**
* Sets the value of the 'offerType' field.
* @param value The value of 'offerType'.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder setOfferType(java.lang.CharSequence value) {
validate(fields()[7], value);
this.offerType = value;
fieldSetFlags()[7] = true;
return this;
}
/**
* Checks whether the 'offerType' field has been set.
* @return True if the 'offerType' field has been set, false otherwise.
*/
public boolean hasOfferType() {
return fieldSetFlags()[7];
}
/**
* Clears the value of the 'offerType' field.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder clearOfferType() {
offerType = null;
fieldSetFlags()[7] = false;
return this;
}
/**
* Gets the value of the 'rcptText' field.
* @return The value.
*/
public java.lang.CharSequence getRcptText() {
return rcptText;
}
/**
* Sets the value of the 'rcptText' field.
* @param value The value of 'rcptText'.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder setRcptText(java.lang.CharSequence value) {
validate(fields()[8], value);
this.rcptText = value;
fieldSetFlags()[8] = true;
return this;
}
/**
* Checks whether the 'rcptText' field has been set.
* @return True if the 'rcptText' field has been set, false otherwise.
*/
public boolean hasRcptText() {
return fieldSetFlags()[8];
}
/**
* Clears the value of the 'rcptText' field.
* @return This builder.
*/
public com.safeway.offerData.model.OfferMetaData.Builder clearRcptText() {
rcptText = null;
fieldSetFlags()[8] = false;
return this;
}
@Override
@SuppressWarnings("unchecked")
public OfferMetaData build() {
try {
OfferMetaData record = new OfferMetaData();
record.offerId = fieldSetFlags()[0] ? this.offerId : (java.lang.Integer) defaultValue(fields()[0]);
record.eligibility = fieldSetFlags()[1] ? this.eligibility : (java.lang.CharSequence) defaultValue(fields()[1]);
record.discountType = fieldSetFlags()[2] ? this.discountType : (java.lang.CharSequence) defaultValue(fields()[2]);
record.status = fieldSetFlags()[3] ? this.status : (java.lang.CharSequence) defaultValue(fields()[3]);
record.startTime = fieldSetFlags()[4] ? this.startTime : (java.lang.CharSequence) defaultValue(fields()[4]);
record.endTime = fieldSetFlags()[5] ? this.endTime : (java.lang.CharSequence) defaultValue(fields()[5]);
record.offerDescription = fieldSetFlags()[6] ? this.offerDescription : (java.lang.CharSequence) defaultValue(fields()[6]);
record.offerType = fieldSetFlags()[7] ? this.offerType : (java.lang.CharSequence) defaultValue(fields()[7]);
record.rcptText = fieldSetFlags()[8] ? this.rcptText : (java.lang.CharSequence) defaultValue(fields()[8]);
return record;
} catch (java.lang.Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
}
}
}
@SuppressWarnings("unchecked")
private static final org.apache.avro.io.DatumWriter<OfferMetaData>
WRITER$ = (org.apache.avro.io.DatumWriter<OfferMetaData>)MODEL$.createDatumWriter(SCHEMA$);
@Override public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException {
WRITER$.write(this, SpecificData.getEncoder(out));
}
@SuppressWarnings("unchecked")
private static final org.apache.avro.io.DatumReader<OfferMetaData>
READER$ = (org.apache.avro.io.DatumReader<OfferMetaData>)MODEL$.createDatumReader(SCHEMA$);
@Override public void readExternal(java.io.ObjectInput in)
throws java.io.IOException {
READER$.read(this, SpecificData.getDecoder(in));
}
}
package com.safeway.schemaToObject;
import org.apache.avro.Schema;
import org.apache.avro.compiler.specific.SpecificCompiler;
import java.io.File;
import java.io.IOException;
public class SchemaToObject {
public static void main(String[] args) {
try {
String schemaString = "{\"type\":\"record\",\"name\":\"OfferMetaData\",\"namespace\":\"com.safeway.offerData.model\"," +
"\"fields\":[{\"name\":\"offerId\",\"type\":\"int\"},{\"name\":\"eligibility\",\"type\":\"string\"}," +
"{\"name\":\"discountType\",\"type\":\"string\"},{\"name\":\"status\",\"type\":\"string\"}," +
"{\"name\":\"startTime\",\"type\":\"string\"},{\"name\":\"endTime\",\"type\":\"string\"}," +
" {\"name\":\"offerDescription\",\"type\":\"string\"},{\"name\":\"offerType\",\"type\":\"string\"}," +
"{\"name\":\"rcptText\",\"type\":\"string\"}" +
"]}";
SpecificCompiler compiler = new SpecificCompiler(new Schema.Parser().parse(schemaString));
compiler.compileToDestination(new File(""),new File("src/main/java"));
} catch (IOException e) {
e.printStackTrace();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment