Skip to content

Commit

Permalink
disambiguite internal annotation type names (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher authored Feb 25, 2022
1 parent dc3e128 commit 60804aa
Show file tree
Hide file tree
Showing 28 changed files with 168 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
@Target(ElementType.ANNOTATION_TYPE)
@Inherited
public @interface SerdeConfig {
/**
* The meta annotation for property.
*/
String META_ANNOTATION_PROPERTY = "Property";

/**
* The meta annotation for property order.
*/
String META_ANNOTATION_PROPERTY_ORDER = "PropertyOrder";

/**
* Used to store the type that will serialize this type.
*/
Expand Down Expand Up @@ -151,8 +161,8 @@
* Internal metadata type for wrapped settings.
*/
@Internal
@interface Unwrapped {
String NAME = Unwrapped.class.getName();
@interface SerUnwrapped {
String NAME = SerUnwrapped.class.getName();
String PREFIX = "prefix";
String SUFFIX = "suffix";
}
Expand All @@ -162,37 +172,37 @@
*/
@Internal
@Executable
@interface Getter {
@interface SerGetter {
}

/**
* Ignore handling meta annotation.
*/
@Internal
@interface Ignored {
@interface Type { }
@interface SerIgnored {
@interface SerType { }
}

/**
* Include property meta annotation.
*/
@interface Included {
@interface SerIncluded {
}

/**
* Internal metadata for a JSON any getter.
*/
@Internal
@Executable
@interface AnyGetter {
@interface SerAnyGetter {
}

/**
* Internal metadata for a setter.
*/
@Internal
@Executable
@interface Setter {
@interface SerSetter {
}

/**
Expand All @@ -201,53 +211,39 @@
@Internal
@Executable
@SerdeConfig
@interface AnySetter {
@interface SerAnySetter {
}

/**
* Used to store errors.
*/
@Internal
@interface SerdeError {
}

/**
* Used to store order information.
*/
@Internal
@interface PropertyOrder {
}

/**
* For case where property is defined with no name.
*/
@Internal
@interface Property {
@interface SerError {
}

/**
* Managed reference.
*/
@Internal
@interface ManagedRef {
@interface SerManagedRef {
}

/**
* Back reference.
*/
@Internal
@interface BackRef {
@interface SerBackRef {
}

/**
* Meta annotations for subtyped mapping.
*/
@Internal
@interface Subtyped {
@interface SerSubtyped {
/**
* @return the subtypes
*/
Subtype[] value() default {};
SerSubtype[] value() default {};
/**
* The discriminator to use.
*/
Expand All @@ -274,8 +270,8 @@ enum DiscriminatorValueKind {
/**
* Meta annotation for a mapped subtype.
*/
@Repeatable(Subtyped.class)
@interface Subtype {
@Repeatable(SerSubtyped.class)
@interface SerSubtype {
}
}

Expand Down Expand Up @@ -330,7 +326,7 @@ enum SerInclude {
/**
* Creator mode used when invoking the {@link io.micronaut.core.annotation.Creator}.
*/
enum CreatorMode {
enum SerCreatorMode {
/**
* Use a single argument as the value.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ record Test(
.getSerializableIntrospection(argument)

then:
introspection.getRequiredProperty("attributes", Map).isAnnotationPresent(SerdeConfig.AnySetter)
introspection.getRequiredProperty("attributes", Map).isAnnotationPresent(SerdeConfig.AnyGetter)
introspection.getRequiredProperty("attributes", Map).isAnnotationPresent(SerdeConfig.SerAnySetter)
introspection.getRequiredProperty("attributes", Map).isAnnotationPresent(SerdeConfig.SerAnyGetter)

when:
def bean = newInstance(context, 'jsongetterrecord.Test', "Fred", [foo:'bar', age: 10])
Expand Down
Loading

0 comments on commit 60804aa

Please sign in to comment.