File tree Expand file tree Collapse file tree 10 files changed +285
-0
lines changed
initializr-generator/src/main
java/io/spring/initializr/generator/configuration/format Expand file tree Collapse file tree 10 files changed +285
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2012 - present the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package io .spring .initializr .generator .configuration .format ;
18
+
19
+ public interface ConfigurationFileFormat {
20
+
21
+ /**
22
+ * Return the id of the packaging.
23
+ * @return the id
24
+ */
25
+ String id ();
26
+
27
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2012 - present the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package io .spring .initializr .generator .configuration .format ;
18
+
19
+ /**
20
+ * A factory for creating a {@link ConfigurationFileFormat}.
21
+ *
22
+ * @author Sijun Yang
23
+ */
24
+ public interface ConfigurationFileFormatFactory {
25
+
26
+ /**
27
+ * Creates and returns a {@link ConfigurationFileFormat} for the given id. If the
28
+ * factory does not recognise the given {@code id}, {@code null} should be returned.
29
+ * @param id the id of the configuration file format
30
+ * @return the configuration file format or {@code null}
31
+ */
32
+ ConfigurationFileFormat createConfigurationFileFormat (String id );
33
+
34
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2012 - present the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ /**
18
+ * Configuration file format abstraction.
19
+ */
20
+ package io .spring .initializr .generator .configuration .format ;
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2012 - present the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package io .spring .initializr .generator .configuration .format .properties ;
18
+
19
+ import io .spring .initializr .generator .configuration .format .ConfigurationFileFormat ;
20
+
21
+ /**
22
+ * Properties {@link ConfigurationFileFormat}.
23
+ *
24
+ * @author Sijun Yang
25
+ */
26
+ public final class PropertiesFormat implements ConfigurationFileFormat {
27
+
28
+ /**
29
+ * Properties {@link ConfigurationFileFormat} identifier.
30
+ */
31
+ public static final String ID = "properties" ;
32
+
33
+ @ Override
34
+ public String id () {
35
+ return ID ;
36
+ }
37
+
38
+ @ Override
39
+ public String toString () {
40
+ return id ();
41
+ }
42
+
43
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2012 - present the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package io .spring .initializr .generator .configuration .format .properties ;
18
+
19
+ import io .spring .initializr .generator .configuration .format .ConfigurationFileFormat ;
20
+ import io .spring .initializr .generator .configuration .format .ConfigurationFileFormatFactory ;
21
+
22
+ /**
23
+ * {@link ConfigurationFileFormat Factory} for {@link PropertiesFormat}.
24
+ *
25
+ * @author Sijun Yang
26
+ */
27
+ class PropertiesFormatFactory implements ConfigurationFileFormatFactory {
28
+
29
+ @ Override
30
+ public ConfigurationFileFormat createConfigurationFileFormat (String id ) {
31
+ if (PropertiesFormat .ID .equals (id )) {
32
+ return new PropertiesFormat ();
33
+ }
34
+ return null ;
35
+ }
36
+
37
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2012 - present the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ /**
18
+ * Properties configuration file format.
19
+ */
20
+ package io .spring .initializr .generator .configuration .format .properties ;
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2012 - present the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package io .spring .initializr .generator .configuration .format .yaml ;
18
+
19
+ import io .spring .initializr .generator .configuration .format .ConfigurationFileFormat ;
20
+
21
+ /**
22
+ * YAML {@link ConfigurationFileFormat}.
23
+ *
24
+ * @author Sijun Yang
25
+ */
26
+ public final class YamlFormat implements ConfigurationFileFormat {
27
+
28
+ /**
29
+ * YAML {@link ConfigurationFileFormat} identifier.
30
+ */
31
+ public static final String ID = "yml" ;
32
+
33
+ @ Override
34
+ public String id () {
35
+ return ID ;
36
+ }
37
+
38
+ @ Override
39
+ public String toString () {
40
+ return id ();
41
+ }
42
+
43
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2012 - present the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package io .spring .initializr .generator .configuration .format .yaml ;
18
+
19
+ import io .spring .initializr .generator .configuration .format .ConfigurationFileFormat ;
20
+ import io .spring .initializr .generator .configuration .format .ConfigurationFileFormatFactory ;
21
+
22
+ /**
23
+ * {@link ConfigurationFileFormat Factory} for {@link YamlFormat}.
24
+ *
25
+ * @author Sijun Yang
26
+ */
27
+ class YamlFormatFactory implements ConfigurationFileFormatFactory {
28
+
29
+ @ Override
30
+ public ConfigurationFileFormat createConfigurationFileFormat (String id ) {
31
+ if (YamlFormat .ID .equals (id )) {
32
+ return new YamlFormat ();
33
+ }
34
+ return null ;
35
+ }
36
+
37
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2012 - present the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ /**
18
+ * YAML configuration file format.
19
+ */
20
+ package io .spring .initializr .generator .configuration .format .yaml ;
Original file line number Diff line number Diff line change @@ -10,3 +10,7 @@ io.spring.initializr.generator.language.kotlin.KotlinLanguageFactory
10
10
io.spring.initializr.generator.packaging.PackagingFactory=\
11
11
io.spring.initializr.generator.packaging.jar.JarPackagingFactory,\
12
12
io.spring.initializr.generator.packaging.war.WarPackagingFactory
13
+
14
+ io.spring.initializr.generator.configuration.format.ConfigurationFileFormatFactory=\
15
+ io.spring.initializr.generator.configuration.format.properties.PropertiesFormatFactory,\
16
+ io.spring.initializr.generator.configuration.format.yaml.YamlFormatFactory
You can’t perform that action at this time.
0 commit comments