Remove the notion of API/SPI when collecting properties

This commit is contained in:
marko-bekhta 2023-01-25 14:49:28 +01:00 committed by Steve Ebersole
parent 8562e4b947
commit d770ff1597
3 changed files with 1 additions and 39 deletions

View File

@ -21,9 +21,6 @@ public class ConfigurationProperty implements Comparable<ConfigurationProperty>
private Key key; private Key key;
private String javadoc; private String javadoc;
private String sourceClass; private String sourceClass;
private HibernateOrmConfiguration.Type type;
private String anchorPrefix; private String anchorPrefix;
private String moduleName; private String moduleName;
@ -54,15 +51,6 @@ public class ConfigurationProperty implements Comparable<ConfigurationProperty>
return this; return this;
} }
public HibernateOrmConfiguration.Type type() {
return type;
}
public ConfigurationProperty type(HibernateOrmConfiguration.Type type) {
this.type = type;
return this;
}
public String anchorPrefix() { public String anchorPrefix() {
return anchorPrefix; return anchorPrefix;
} }
@ -87,7 +75,6 @@ public class ConfigurationProperty implements Comparable<ConfigurationProperty>
"key='" + key + '\'' + "key='" + key + '\'' +
", javadoc='" + javadoc + '\'' + ", javadoc='" + javadoc + '\'' +
", sourceClass='" + sourceClass + '\'' + ", sourceClass='" + sourceClass + '\'' +
", type='" + type + '\'' +
", anchorPrefix='" + anchorPrefix + '\'' + ", anchorPrefix='" + anchorPrefix + '\'' +
", moduleName='" + moduleName + '\'' + ", moduleName='" + moduleName + '\'' +
'}'; '}';
@ -110,14 +97,13 @@ public class ConfigurationProperty implements Comparable<ConfigurationProperty>
return Objects.equals( key, that.key ) && return Objects.equals( key, that.key ) &&
Objects.equals( javadoc, that.javadoc ) && Objects.equals( javadoc, that.javadoc ) &&
Objects.equals( sourceClass, that.sourceClass ) && Objects.equals( sourceClass, that.sourceClass ) &&
type == that.type &&
Objects.equals( anchorPrefix, that.anchorPrefix ) && Objects.equals( anchorPrefix, that.anchorPrefix ) &&
Objects.equals( moduleName, that.moduleName ); Objects.equals( moduleName, that.moduleName );
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash( key, javadoc, sourceClass, type, anchorPrefix, moduleName ); return Objects.hash( key, javadoc, sourceClass, anchorPrefix, moduleName );
} }
public static class Key { public static class Key {

View File

@ -34,10 +34,6 @@ import org.jsoup.nodes.Document;
public class ConfigurationPropertyCollector { public class ConfigurationPropertyCollector {
// assume that spi/impl/internal packages are not for public use and consider all of them as SPI:
private static final Pattern SPI_PATTERN = Pattern.compile(
"(.*\\.spi$)|(.*\\.spi\\..*)|(.*\\.impl$)|(.*\\.impl\\..*)|(.*\\.internal$)|(.*\\.internal\\..*)" );
private final Set<Name> processedTypes = new HashSet<>(); private final Set<Name> processedTypes = new HashSet<>();
private final ConfigPropertyHolder properties; private final ConfigPropertyHolder properties;
private final Elements elementUtils; private final Elements elementUtils;
@ -106,7 +102,6 @@ public class ConfigurationPropertyCollector {
.javadoc( extractJavadoc( constant ) ) .javadoc( extractJavadoc( constant ) )
.key( key ) .key( key )
.sourceClass( constant.getEnclosingElement().toString() ) .sourceClass( constant.getEnclosingElement().toString() )
.type( extractType( constant ) )
.withModuleName( title.orElse( classTitle.orElse( this.title ) ) ) .withModuleName( title.orElse( classTitle.orElse( this.title ) ) )
.withAnchorPrefix( anchorPrefix.orElse( classAnchorPrefix.orElse( this.anchor ) ) ) .withAnchorPrefix( anchorPrefix.orElse( classAnchorPrefix.orElse( this.anchor ) ) )
); );
@ -133,13 +128,6 @@ public class ConfigurationPropertyCollector {
); );
} }
private HibernateOrmConfiguration.Type extractType(VariableElement constant) {
String packageName = packageElement( constant ).getQualifiedName().toString();
return SPI_PATTERN.matcher( packageName ).matches() ?
HibernateOrmConfiguration.Type.SPI :
HibernateOrmConfiguration.Type.API;
}
private String extractJavadoc(VariableElement constant) { private String extractJavadoc(VariableElement constant) {
try { try {
Element enclosingClass = constant.getEnclosingElement(); Element enclosingClass = constant.getEnclosingElement();

View File

@ -18,18 +18,6 @@ import java.lang.annotation.Target;
@Target({ ElementType.TYPE, ElementType.FIELD }) @Target({ ElementType.TYPE, ElementType.FIELD })
public @interface HibernateOrmConfiguration { public @interface HibernateOrmConfiguration {
/**
* Describes to which type the configuration property belongs to - API/SPI.
*/
enum Type {
/**
* Configuration property type API/SPI will be determined by inspecting the package in which a class is located.
* In case package contains {@code spi} package at any upper levels the type will be {@code SPI}, otherwise - {@code API}
*/
API,
SPI
}
/** /**
* Set to {@code true} in case we have a {@code *Settings} class that we want to ignore in config processing. * Set to {@code true} in case we have a {@code *Settings} class that we want to ignore in config processing.
* Also works on a field leve. Setting it to {@code true} on field level will not include that particular constant. * Also works on a field leve. Setting it to {@code true} on field level will not include that particular constant.