forked from sermakov/JavaPatternMirea
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsk10.java
More file actions
Latest commit
81 lines (63 loc) · 2.49 KB
/
Copy pathtsk10.java
File metadata and controls
81 lines (63 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
packagesome;
importorg.springframework.context.annotation.*;
importorg.springframework.core.type.AnnotatedTypeMetadata;
/*
* Libraries to make this #grazie suppression# shit work:
* apache:commons-logging:1.2,
* spring:spring-aop:5.3.16,
* spring:spring-beans:5.3.16,
* spring:spring-context:5.3.16,
* spring:spring-core:5.3.16,
* spring:spring-expression:5.3.16
* */
@SuppressWarnings("GrazieInspection")
publicclasstsk10 {
staticvoidprt(Objecta) { System.out.println(a); }
/////////////////////////////////////////////////////
staticfinalString__KINDA_APP_ARGUMENT__ = bxr.class.getSimpleName();
publicstaticvoidmain(String[] args) {
newAnnotationConfigApplicationContext(bncnf.class)
.getBean(rnr.class)
.fgh();
}
staticclassrnr {
privatefinalfghf;
rnr(fgh_f) { f = _f; }
voidfgh() { f.fgh(); }
}
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Configuration
staticclassbncnf {
@Bean@Conditional(stc.class) fghstf() { returnnewstf(); }
@Bean@Conditional(bxc.class) fghbxr() { returnnewbxr(); }
@Bean@Conditional(jdc.class) fghjdk() { returnnewjdk(); }
@Beanrnrrnr(/*suppression*/fgha) { returnnewrnr(a); }
}
staticabstractclasscndimplementsCondition {
privatefinalClass<? extendsfgh> a;
cnd(Class<? extendsfgh> b) { a = b; }
@SuppressWarnings("NullableProblems")
@Override
publicbooleanmatches(
ConditionContextc, // suppression
AnnotatedTypeMetadatad// suppression
) { return__KINDA_APP_ARGUMENT__.equals(a.getSimpleName()); }
}
staticclassstcextendscnd { stc() { super(stf.class); } }
staticclassbxcextendscnd { bxc() { super(bxr.class); } }
staticclassjdcextendscnd { jdc() { super(jdk.class); } }
/////////////////////////////////////////////////////
@FunctionalInterface
interfaceF<T> { voida(Ta); }
staticfinal
F<Class<? extendsfgh>> nm = a -> prt(a.getSimpleName());
@SuppressWarnings("MethodNameSameAsClassName")
interfacefgh
{ voidfgh(); }
staticclassstfimplementsfgh
{ @Overridepublicvoidfgh() { nm.a(getClass()); } }
staticclassbxrimplementsfgh
{ @Overridepublicvoidfgh() { nm.a(getClass()); } }
staticclassjdkimplementsfgh
{ @Overridepublicvoidfgh() { nm.a(getClass()); } }
}