Remove the notion of API/SPI when collecting properties
This commit is contained in:
parent
8562e4b947
commit
d770ff1597
|
@ -21,9 +21,6 @@ public class ConfigurationProperty implements Comparable<ConfigurationProperty>
|
|||
private Key key;
|
||||
private String javadoc;
|
||||
private String sourceClass;
|
||||
|
||||
private HibernateOrmConfiguration.Type type;
|
||||
|
||||
private String anchorPrefix;
|
||||
private String moduleName;
|
||||
|
||||
|
@ -54,15 +51,6 @@ public class ConfigurationProperty implements Comparable<ConfigurationProperty>
|
|||
return this;
|
||||
}
|
||||
|
||||
public HibernateOrmConfiguration.Type type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public ConfigurationProperty type(HibernateOrmConfiguration.Type type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String anchorPrefix() {
|
||||
return anchorPrefix;
|
||||
}
|
||||
|
@ -87,7 +75,6 @@ public class ConfigurationProperty implements Comparable<ConfigurationProperty>
|
|||
"key='" + key + '\'' +
|
||||
", javadoc='" + javadoc + '\'' +
|
||||
", sourceClass='" + sourceClass + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
", anchorPrefix='" + anchorPrefix + '\'' +
|
||||
", moduleName='" + moduleName + '\'' +
|
||||
'}';
|
||||
|
@ -110,14 +97,13 @@ public class ConfigurationProperty implements Comparable<ConfigurationProperty>
|
|||
return Objects.equals( key, that.key ) &&
|
||||
Objects.equals( javadoc, that.javadoc ) &&
|
||||
Objects.equals( sourceClass, that.sourceClass ) &&
|
||||
type == that.type &&
|
||||
Objects.equals( anchorPrefix, that.anchorPrefix ) &&
|
||||
Objects.equals( moduleName, that.moduleName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash( key, javadoc, sourceClass, type, anchorPrefix, moduleName );
|
||||
return Objects.hash( key, javadoc, sourceClass, anchorPrefix, moduleName );
|
||||
}
|
||||
|
||||
public static class Key {
|
||||
|
|
|
@ -34,10 +34,6 @@ import org.jsoup.nodes.Document;
|
|||
|
||||
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 ConfigPropertyHolder properties;
|
||||
private final Elements elementUtils;
|
||||
|
@ -106,7 +102,6 @@ public class ConfigurationPropertyCollector {
|
|||
.javadoc( extractJavadoc( constant ) )
|
||||
.key( key )
|
||||
.sourceClass( constant.getEnclosingElement().toString() )
|
||||
.type( extractType( constant ) )
|
||||
.withModuleName( title.orElse( classTitle.orElse( this.title ) ) )
|
||||
.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) {
|
||||
try {
|
||||
Element enclosingClass = constant.getEnclosingElement();
|
||||
|
|
|
@ -18,18 +18,6 @@ import java.lang.annotation.Target;
|
|||
@Target({ ElementType.TYPE, ElementType.FIELD })
|
||||
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.
|
||||
* Also works on a field leve. Setting it to {@code true} on field level will not include that particular constant.
|
||||
|
|
Loading…
Reference in New Issue