Skip to content

Commit bc13b80

Browse files
committed
refactor: move Settings processor to factory
Also move mustaches templates. Dependency on restx-core will be no more needed to use the @Settings mechanism. WIP: test are not yet working
1 parent ffbda71 commit bc13b80

6 files changed

Lines changed: 9 additions & 21 deletions

File tree

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
restx.annotations.processor.RestxAnnotationProcessor
22
restx.exceptions.processor.ErrorAnnotationProcessor
3-
restx.config.processor.SettingsAnnotationProcessor

restx-core/src/main/java/restx/security/SecurityModule.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import org.slf4j.Logger;
44
import org.slf4j.LoggerFactory;
5-
import restx.common.RestxConfig;
65
import restx.config.Settings;
76
import restx.config.SettingsKey;
87
import restx.factory.AutoStartable;
@@ -33,17 +32,6 @@ public String disableBareFilter() {
3332
return "false";
3433
}
3534

36-
// @Settings is not processed as long as this is part of core itself
37-
@Provides
38-
public SecuritySettings securitySettings(final RestxConfig config) {
39-
return new SecuritySettings() {
40-
@Override
41-
public int sessionsLimit() {
42-
return config.getInt("restx.sessions.stats.limit").or(100);
43-
}
44-
};
45-
}
46-
4735
@Provides @Named("Sessions")
4836
public Sessions session(SecuritySettings settings) {
4937
return new Sessions(settings.sessionsLimit());

restx-core-annotation-processor/src/main/java/restx/config/processor/SettingsAnnotationProcessor.java renamed to restx-factory/src/main/java/restx/config/processor/SettingsAnnotationProcessor.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
import com.google.common.base.Strings;
55
import com.google.common.collect.ImmutableMap;
66
import com.samskivert.mustache.Template;
7-
import restx.common.Mustaches;
8-
import restx.common.processor.RestxAbstractProcessor;
9-
import restx.config.Settings;
10-
import restx.config.SettingsKey;
117

8+
import java.util.ArrayList;
9+
import java.util.List;
10+
import java.util.Set;
1211
import javax.annotation.processing.RoundEnvironment;
1312
import javax.annotation.processing.SupportedAnnotationTypes;
1413
import javax.annotation.processing.SupportedOptions;
@@ -18,9 +17,10 @@
1817
import javax.lang.model.element.TypeElement;
1918
import javax.lang.model.type.DeclaredType;
2019
import javax.lang.model.type.TypeMirror;
21-
import java.util.ArrayList;
22-
import java.util.List;
23-
import java.util.Set;
20+
import restx.common.Mustaches;
21+
import restx.common.processor.RestxAbstractProcessor;
22+
import restx.config.Settings;
23+
import restx.config.SettingsKey;
2424

2525
/**
2626
*/
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
restx.factory.processor.FactoryAnnotationProcessor
1+
restx.factory.processor.FactoryAnnotationProcessor
2+
restx.config.processor.SettingsAnnotationProcessor

restx-core-annotation-processor/src/main/resources/restx/config/processor/SettingsConfig.mustache renamed to restx-factory/src/main/resources/restx/config/processor/SettingsConfig.mustache

File renamed without changes.

restx-core-annotation-processor/src/main/resources/restx/config/processor/SettingsProvider.mustache renamed to restx-factory/src/main/resources/restx/config/processor/SettingsProvider.mustache

File renamed without changes.

0 commit comments

Comments
 (0)