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

AVRO-4040: [java] @AvroInternal annotation for getSchema() and getSpecificData() methods #3124

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
@@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.avro.specific;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Indicates that an annotated accessor is an Avro internal and should be
* ignored when introspecting @AvroGenerated classes.
bgalek marked this conversation as resolved.
Show resolved Hide resolved
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface AvroInternal {
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public FooBarSpecificRecord(java.lang.Integer id, java.lang.String name, java.ut
}

@Override
@org.apache.avro.specific.AvroInternal
public org.apache.avro.Schema getSchema() {
return SCHEMA$;
}
Expand Down
1 change: 1 addition & 0 deletions lang/java/avro/src/test/java/org/apache/avro/TypeEnum.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static org.apache.avro.Schema getClassSchema() {
return SCHEMA$;
}

@org.apache.avro.specific.AvroInternal
public org.apache.avro.Schema getSchema() {
return SCHEMA$;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public TestRecordWithLogicalTypes(java.lang.Boolean b, java.lang.Integer i32, ja
}

@Override
@org.apache.avro.specific.AvroInternal
public org.apache.avro.Schema getSchema() {
return SCHEMA$;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static org.apache.avro.Schema getClassSchema() {

/**
* Return the BinaryMessageEncoder instance used by this class.
*
*
* @return the message encoder used by this class
*/
public static BinaryMessageEncoder<TestRecordWithMapsAndArrays> getEncoder() {
Expand All @@ -54,7 +54,7 @@ public static BinaryMessageEncoder<TestRecordWithMapsAndArrays> getEncoder() {

/**
* Return the BinaryMessageDecoder instance used by this class.
*
*
* @return the message decoder used by this class
*/
public static BinaryMessageDecoder<TestRecordWithMapsAndArrays> getDecoder() {
Expand All @@ -64,7 +64,7 @@ public static BinaryMessageDecoder<TestRecordWithMapsAndArrays> getDecoder() {
/**
* 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
* @return a BinaryMessageDecoder instance for this class backed by the given
* SchemaStore
Expand All @@ -75,7 +75,7 @@ public static BinaryMessageDecoder<TestRecordWithMapsAndArrays> createDecoder(Sc

/**
* Serializes this TestRecordWithMapsAndArrays to a ByteBuffer.
*
*
* @return a buffer holding the serialized data for this instance
* @throws java.io.IOException if this instance could not be serialized
*/
Expand All @@ -85,7 +85,7 @@ public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException {

/**
* Deserializes a TestRecordWithMapsAndArrays from a ByteBuffer.
*
*
* @param b a byte buffer holding serialized data for an instance of this class
* @return a TestRecordWithMapsAndArrays instance decoded from the given buffer
* @throws java.io.IOException if the given bytes could not be deserialized into
Expand All @@ -110,7 +110,7 @@ public TestRecordWithMapsAndArrays() {

/**
* All-args constructor.
*
*
* @param arr The new value for arr
* @param map The new value for map
* @param nested_arr The new value for nested_arr
Expand All @@ -126,11 +126,13 @@ public TestRecordWithMapsAndArrays(java.util.List<String> arr, java.util.Map<Str
}

@Override
@org.apache.avro.specific.AvroInternal
public SpecificData getSpecificData() {
return MODEL$;
}

@Override
@org.apache.avro.specific.AvroInternal
public org.apache.avro.Schema getSchema() {
return SCHEMA$;
}
Expand Down Expand Up @@ -176,7 +178,7 @@ public void put(int field$, Object value$) {

/**
* Gets the value of the 'arr' field.
*
*
* @return The value of the 'arr' field.
*/
public java.util.List<String> getArr() {
Expand All @@ -185,7 +187,7 @@ public java.util.List<String> getArr() {

/**
* Sets the value of the 'arr' field.
*
*
* @param value the value to set.
*/
public void setArr(java.util.List<String> value) {
Expand All @@ -194,7 +196,7 @@ public void setArr(java.util.List<String> value) {

/**
* Gets the value of the 'map' field.
*
*
* @return The value of the 'map' field.
*/
public java.util.Map<String, Long> getMap() {
Expand All @@ -203,7 +205,7 @@ public java.util.Map<String, Long> getMap() {

/**
* Sets the value of the 'map' field.
*
*
* @param value the value to set.
*/
public void setMap(java.util.Map<String, Long> value) {
Expand All @@ -212,7 +214,7 @@ public void setMap(java.util.Map<String, Long> value) {

/**
* Gets the value of the 'nested_arr' field.
*
*
* @return The value of the 'nested_arr' field.
*/
public java.util.List<java.util.List<String>> getNestedArr() {
Expand All @@ -221,7 +223,7 @@ public java.util.List<java.util.List<String>> getNestedArr() {

/**
* Sets the value of the 'nested_arr' field.
*
*
* @param value the value to set.
*/
public void setNestedArr(java.util.List<java.util.List<String>> value) {
Expand All @@ -230,7 +232,7 @@ public void setNestedArr(java.util.List<java.util.List<String>> value) {

/**
* Gets the value of the 'nested_map' field.
*
*
* @return The value of the 'nested_map' field.
*/
public java.util.Map<String, java.util.Map<String, Long>> getNestedMap() {
Expand All @@ -239,7 +241,7 @@ public java.util.Map<String, java.util.Map<String, Long>> getNestedMap() {

/**
* Sets the value of the 'nested_map' field.
*
*
* @param value the value to set.
*/
public void setNestedMap(java.util.Map<String, java.util.Map<String, Long>> value) {
Expand All @@ -248,7 +250,7 @@ public void setNestedMap(java.util.Map<String, java.util.Map<String, Long>> valu

/**
* Creates a new TestRecordWithMapsAndArrays RecordBuilder.
*
*
* @return A new TestRecordWithMapsAndArrays RecordBuilder
*/
public static Builder newBuilder() {
Expand All @@ -258,7 +260,7 @@ public static Builder newBuilder() {
/**
* Creates a new TestRecordWithMapsAndArrays RecordBuilder by copying an
* existing Builder.
*
*
* @param other The existing builder to copy.
* @return A new TestRecordWithMapsAndArrays RecordBuilder
*/
Expand All @@ -273,7 +275,7 @@ public static Builder newBuilder(Builder other) {
/**
* Creates a new TestRecordWithMapsAndArrays RecordBuilder by copying an
* existing TestRecordWithMapsAndArrays instance.
*
*
* @param other The existing instance to copy.
* @return A new TestRecordWithMapsAndArrays RecordBuilder
*/
Expand Down Expand Up @@ -304,7 +306,7 @@ private Builder() {

/**
* Creates a Builder by copying an existing Builder.
*
*
* @param other The existing Builder to copy.
*/
private Builder(Builder other) {
Expand All @@ -329,7 +331,7 @@ private Builder(Builder other) {

/**
* Creates a Builder by copying an existing TestRecordWithMapsAndArrays instance
*
*
* @param other The existing instance to copy.
*/
private Builder(TestRecordWithMapsAndArrays other) {
Expand All @@ -354,7 +356,7 @@ private Builder(TestRecordWithMapsAndArrays other) {

/**
* Gets the value of the 'arr' field.
*
*
* @return The value.
*/
public java.util.List<String> getArr() {
Expand All @@ -363,7 +365,7 @@ public java.util.List<String> getArr() {

/**
* Sets the value of the 'arr' field.
*
*
* @param value The value of 'arr'.
* @return This builder.
*/
Expand All @@ -376,7 +378,7 @@ public Builder setArr(java.util.List<String> value) {

/**
* Checks whether the 'arr' field has been set.
*
*
* @return True if the 'arr' field has been set, false otherwise.
*/
public boolean hasArr() {
Expand All @@ -385,7 +387,7 @@ public boolean hasArr() {

/**
* Clears the value of the 'arr' field.
*
*
* @return This builder.
*/
public Builder clearArr() {
Expand All @@ -396,7 +398,7 @@ public Builder clearArr() {

/**
* Gets the value of the 'map' field.
*
*
* @return The value.
*/
public java.util.Map<String, Long> getMap() {
Expand All @@ -405,7 +407,7 @@ public java.util.Map<String, Long> getMap() {

/**
* Sets the value of the 'map' field.
*
*
* @param value The value of 'map'.
* @return This builder.
*/
Expand All @@ -418,7 +420,7 @@ public Builder setMap(java.util.Map<String, Long> value) {

/**
* Checks whether the 'map' field has been set.
*
*
* @return True if the 'map' field has been set, false otherwise.
*/
public boolean hasMap() {
Expand All @@ -427,7 +429,7 @@ public boolean hasMap() {

/**
* Clears the value of the 'map' field.
*
*
* @return This builder.
*/
public Builder clearMap() {
Expand All @@ -438,7 +440,7 @@ public Builder clearMap() {

/**
* Gets the value of the 'nested_arr' field.
*
*
* @return The value.
*/
public java.util.List<java.util.List<String>> getNestedArr() {
Expand All @@ -447,7 +449,7 @@ public java.util.List<java.util.List<String>> getNestedArr() {

/**
* Sets the value of the 'nested_arr' field.
*
*
* @param value The value of 'nested_arr'.
* @return This builder.
*/
Expand All @@ -460,7 +462,7 @@ public Builder setNestedArr(java.util.List<java.util.List<String>> value) {

/**
* Checks whether the 'nested_arr' field has been set.
*
*
* @return True if the 'nested_arr' field has been set, false otherwise.
*/
public boolean hasNestedArr() {
Expand All @@ -469,7 +471,7 @@ public boolean hasNestedArr() {

/**
* Clears the value of the 'nested_arr' field.
*
*
* @return This builder.
*/
public Builder clearNestedArr() {
Expand All @@ -480,7 +482,7 @@ public Builder clearNestedArr() {

/**
* Gets the value of the 'nested_map' field.
*
*
* @return The value.
*/
public java.util.Map<String, java.util.Map<String, Long>> getNestedMap() {
Expand All @@ -489,7 +491,7 @@ public java.util.Map<String, java.util.Map<String, Long>> getNestedMap() {

/**
* Sets the value of the 'nested_map' field.
*
*
* @param value The value of 'nested_map'.
* @return This builder.
*/
Expand All @@ -502,7 +504,7 @@ public Builder setNestedMap(java.util.Map<String, java.util.Map<String, Long>> v

/**
* Checks whether the 'nested_map' field has been set.
*
*
* @return True if the 'nested_map' field has been set, false otherwise.
*/
public boolean hasNestedMap() {
Expand All @@ -511,7 +513,7 @@ public boolean hasNestedMap() {

/**
* Clears the value of the 'nested_map' field.
*
*
* @return This builder.
*/
public Builder clearNestedMap() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public TestRecordWithoutLogicalTypes(java.lang.Boolean b, java.lang.Integer i32,
this.dec = dec;
}

@org.apache.avro.specific.AvroInternal
public org.apache.avro.Schema getSchema() {
return SCHEMA$;
}
Expand Down
Loading
Loading