diff options
author | asgar <sammoham@in.ibm.com> | 2018-09-06 00:01:04 +0530 |
---|---|---|
committer | Mohamed Asgar Samiulla <sammoham@in.ibm.com> | 2018-09-06 04:50:28 +0000 |
commit | 773f99551923739e47c53c7bc1ac4ed6b7e0eda1 (patch) | |
tree | 467f085c4314a5513ac7ae49b49d5b7bef066664 | |
parent | dfef19e542581df2f69c263721fd6ead3752549d (diff) |
Return expression instead of temporary variable
Change-Id: Ib5d939c99fc4fb9845f06e787b3915640acfce3e
Issue-ID: AAI-1575
Signed-off-by: Mohamed Asgar Samiulla <sammoham@in.ibm.com>
4 files changed, 67 insertions, 68 deletions
diff --git a/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java b/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java index e0ce203d..aa4ec1a1 100644 --- a/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java +++ b/aai-core/src/main/java/org/onap/aai/config/IntrospectionConfig.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright © 2018 IBM. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -35,23 +37,22 @@ import org.onap.aai.nodes.NodeIngestor; @Configuration public class IntrospectionConfig { - private Map<SchemaVersion, MoxyLoader> MOXYINSTANCEMAP = new ConcurrentHashMap<>(); - @Autowired - NodeIngestor nodeIngestor; + private Map<SchemaVersion, MoxyLoader> moxyInstanceMap = new ConcurrentHashMap<>(); + @Autowired + NodeIngestor nodeIngestor; - @Bean - public LoaderFactory loaderFactory(SchemaVersions schemaVersions) { - LoaderFactory loaderFactory = new LoaderFactory(moxyLoaderInstance(schemaVersions)); - return loaderFactory; - } + @Bean + public LoaderFactory loaderFactory(SchemaVersions schemaVersions) { + return new LoaderFactory(moxyLoaderInstance(schemaVersions)); + } - @Bean - public Map<SchemaVersion, MoxyLoader> moxyLoaderInstance(SchemaVersions schemaVersions) { - for(SchemaVersion version : schemaVersions.getVersions()){ - if (!MOXYINSTANCEMAP.containsKey(version)) { - MOXYINSTANCEMAP.put(version, new MoxyLoader(version, nodeIngestor)); - } - } - return MOXYINSTANCEMAP; - } + @Bean + public Map<SchemaVersion, MoxyLoader> moxyLoaderInstance(SchemaVersions schemaVersions) { + for(SchemaVersion version : schemaVersions.getVersions()){ + if (!moxyInstanceMap.containsKey(version)) { + moxyInstanceMap.put(version, new MoxyLoader(version, nodeIngestor)); + } + } + return moxyInstanceMap; + } } diff --git a/aai-core/src/main/java/org/onap/aai/config/RestBeanConfig.java b/aai-core/src/main/java/org/onap/aai/config/RestBeanConfig.java index 29763291..6c56ff69 100644 --- a/aai-core/src/main/java/org/onap/aai/config/RestBeanConfig.java +++ b/aai-core/src/main/java/org/onap/aai/config/RestBeanConfig.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright © 2018 IBM. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -31,21 +33,18 @@ import org.springframework.context.annotation.Scope; @Configuration public class RestBeanConfig { - @Bean(name = "traversalUriHttpEntry") - @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public HttpEntry traversalUriHttpEntry() { - HttpEntry httpEntry = new HttpEntry(ModelType.MOXY, QueryStyle.TRAVERSAL_URI); - return httpEntry; - } - - @Bean(name = "traversalHttpEntry") - @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public HttpEntry traversalHttpEntry() { - HttpEntry httpEntry = new HttpEntry(ModelType.MOXY, QueryStyle.TRAVERSAL); - - return httpEntry; - } - - + @Bean(name = "traversalUriHttpEntry") + @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public HttpEntry traversalUriHttpEntry() { + return new HttpEntry(ModelType.MOXY, QueryStyle.TRAVERSAL_URI); + } + + @Bean(name = "traversalHttpEntry") + @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public HttpEntry traversalHttpEntry() { + return new HttpEntry(ModelType.MOXY, QueryStyle.TRAVERSAL); + } + + } diff --git a/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java b/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java index 20112bde..b00ecfb7 100644 --- a/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java +++ b/aai-core/src/main/java/org/onap/aai/config/SchemaConfiguration.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright © 2018 IBM. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -43,20 +45,18 @@ public class SchemaConfiguration { return new EdgeSerializer(edgeIngestor); } - @Bean(name = "nodeIngestor") - public NodeIngestor nodeIngestor(ConfigTranslator configTranslator) { - NodeIngestor nodeIngestor = new NodeIngestor(configTranslator); - return nodeIngestor; - } + @Bean(name = "nodeIngestor") + public NodeIngestor nodeIngestor(ConfigTranslator configTranslator) { + return new NodeIngestor(configTranslator); + } - @Bean(name = "configTranslator") - public ConfigTranslator configTranslator(SchemaLocationsBean schemaLocationsBean, SchemaVersions schemaVersions) { - ConfigTranslator aaiConfigTranslator = new AAIConfigTranslator(schemaLocationsBean, schemaVersions); - return aaiConfigTranslator; - } + @Bean(name = "configTranslator") + public ConfigTranslator configTranslator(SchemaLocationsBean schemaLocationsBean, SchemaVersions schemaVersions) { + return new AAIConfigTranslator(schemaLocationsBean, schemaVersions); + } - @Bean - public SchemaErrorStrategy schemaErrorStrategy(){ + @Bean + public SchemaErrorStrategy schemaErrorStrategy(){ return new CheckEverythingStrategy(); - } + } } diff --git a/aai-core/src/main/java/org/onap/aai/config/SwaggerGenerationConfiguration.java b/aai-core/src/main/java/org/onap/aai/config/SwaggerGenerationConfiguration.java index a09018ad..fbbb703a 100644 --- a/aai-core/src/main/java/org/onap/aai/config/SwaggerGenerationConfiguration.java +++ b/aai-core/src/main/java/org/onap/aai/config/SwaggerGenerationConfiguration.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright © 2018 IBM. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -35,28 +37,25 @@ import org.springframework.context.annotation.Scope; @Configuration public class SwaggerGenerationConfiguration { - @Value("${schema.uri.base.path}") - private String basePath; + @Value("${schema.uri.base.path}") + private String basePath; - @Bean - @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public NodesYAMLfromOXM nodesYamlFromOXM(SchemaVersions schemaVersions, NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { - NodesYAMLfromOXM nodesYamlFromOXM = new NodesYAMLfromOXM(basePath, schemaVersions, nodeIngestor, edgeIngestor); - return nodesYamlFromOXM; - } - - @Bean - @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public HTMLfromOXM htmlFromOXM(SchemaVersions schemaVersions, NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { - HTMLfromOXM htmlFromOXM = new HTMLfromOXM(schemaVersions, nodeIngestor, edgeIngestor); - return htmlFromOXM; - } - - @Bean - @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public YAMLfromOXM yamlFromOXM(SchemaVersions schemaVersions, NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { - YAMLfromOXM yamlFromOXM = new YAMLfromOXM(basePath, schemaVersions, nodeIngestor, edgeIngestor); - return yamlFromOXM; - } + @Bean + @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public NodesYAMLfromOXM nodesYamlFromOXM(SchemaVersions schemaVersions, NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { + return new NodesYAMLfromOXM(basePath, schemaVersions, nodeIngestor, edgeIngestor); + } + + @Bean + @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public HTMLfromOXM htmlFromOXM(SchemaVersions schemaVersions, NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { + return new HTMLfromOXM(schemaVersions, nodeIngestor, edgeIngestor); + } + + @Bean + @Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public YAMLfromOXM yamlFromOXM(SchemaVersions schemaVersions, NodeIngestor nodeIngestor, EdgeIngestor edgeIngestor) { + return new YAMLfromOXM(basePath, schemaVersions, nodeIngestor, edgeIngestor); + } } |