Skip to content

Commit

Permalink
javadocs on annotations. fabric8io#4350
Browse files Browse the repository at this point in the history
  • Loading branch information
xRodney committed Aug 26, 2022
1 parent 6834b85 commit 9623265
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
Expand Up @@ -17,13 +17,39 @@

import java.lang.annotation.*;

@Target({ ElementType.ANNOTATION_TYPE, ElementType.TYPE_USE, ElementType.TYPE })
/**
* Annotation that allows replacing a nested schema with one from another class.
*
* This is an alternative to {@link SchemaFrom} for cases when the classes
* are coming from an external source and fields cannot be annotated directly.
*
* @see SchemaFrom
*/
@Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE_USE, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(SchemaSwaps.class)
public @interface SchemaSwap {
/**
* The owning class of the field whose type is to be replaced.
* <p>
* It is an error if the type is not used in the same schema hierarchy where the {@link SchemaSwap} is used.
*/
Class<?> originalType();

/**
* Name of the field whose type is to be replaced.
* <p>
* The name should be specified exactly as defined in the Java class, before any renames
* and transformations ({@code @JsonProperty} and similar) take place.
* <p>
* It is an error if the field does not exist on {@link #originalType()}
*/
String fieldName();

/**
* The replacement schema that will be used for the {@link #fieldName()} instead of its specified type
* <p>
* The default value of {@code void.class} causes the field to be skipped
*/
Class<?> targetType() default void.class;
}
Expand Up @@ -20,6 +20,9 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* A container for multiple {@link SchemaSwap}s
*/
@Target({ ElementType.ANNOTATION_TYPE, ElementType.TYPE_USE, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
public @interface SchemaSwaps {
Expand Down

0 comments on commit 9623265

Please sign in to comment.