1 package com.atlassian.plugin.osgi.loader;
2
3 import com.atlassian.plugin.AutowireCapablePlugin;
4
5
6
7
8
9 public enum AutowireStrategy {
10
11
12
13 AUTOWIRE_NO(AutowireCapablePlugin.AUTOWIRE_NO),
14
15
16
17 AUTOWIRE_BY_NAME(AutowireCapablePlugin.AUTOWIRE_BY_NAME),
18
19
20
21
22 AUTOWIRE_BY_TYPE(AutowireCapablePlugin.AUTOWIRE_BY_TYPE),
23
24
25
26
27 AUTOWIRE_BY_CONSTRUCTOR(AutowireCapablePlugin.AUTOWIRE_BY_CONSTRUCTOR),
28
29
30
31
32
33 AUTOWIRE_AUTODETECT(AutowireCapablePlugin.AUTOWIRE_AUTODETECT);
34
35 private final int index;
36
37 AutowireStrategy(int index) {
38 this.index = index;
39 }
40
41 public int getIndex() {
42 return index;
43 }
44
45 public static AutowireStrategy fromIndex(int index) {
46 for (AutowireStrategy s : AutowireStrategy.values()) {
47 if (s.getIndex() == index) {
48 return s;
49 }
50 }
51 throw new IllegalArgumentException("The index " + index + " does not match any value of " + AutowireStrategy.class);
52 }
53 }