Right now, for using Enums within annotation like the Spring boot cache ones, you can't unless you declare the enum field.
This right now can be done with the combination of @FieldNameConstnats and @FieldNameConstants.Include
example of usage of this annotation in an Enum
@CacheEvict(value = Colors.Fields.Red)
and there are also a lot of cases for using enums within some other annotations
The problem is that in a Enum you cannot use just one annotation at the class level for creating the fields to ALL the enum values.
You have to annotate the class with the @FieldNameConstnats and each param with @FieldNameConstants.Include.
@FieldNameConstants
public class CacheNames {
@FieldNameConstants.INCLUDE
ColorsCache,
@FieldNameConstants.INCLUDE
TShirstCache,
@FieldNameConstants.INCLUDE
CountriesCache;
}
it will be easier to be able to do something like this:
@FieldNameConstants
public class Colors {
ColorsCache,
TShirstCache,
CountriesCache;
}
and just use the exclusion when needed.
This will benefit all people developers of java that are using this type of annotations with enums.
In the previous example the enum only had 3 fields but imagine an enum with 20 having to add all of this field-by-field annotation.
Right now, for using Enums within annotation like the Spring boot cache ones, you can't unless you declare the enum field. This right now can be done with the combination of @FieldNameConstnats and @FieldNameConstants.Include
example of usage of this annotation in an Enum
@CacheEvict(value = Colors.Fields.Red)
and there are also a lot of cases for using enums within some other annotations
The problem is that in a Enum you cannot use just one annotation at the class level for creating the fields to ALL the enum values. You have to annotate the class with the @FieldNameConstnats and each param with @FieldNameConstants.Include.
it will be easier to be able to do something like this:
and just use the exclusion when needed.
This will benefit all people developers of java that are using this type of annotations with enums. In the previous example the enum only had 3 fields but imagine an enum with 20 having to add all of this field-by-field annotation.
Thanks a lot