Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump spotless and fix formatting #3469

Merged
merged 1 commit into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void deactivate() {
// compile the script here _after_ setting context attributes, so that the script engine
// can bind the attributes as variables during compilation. This primarily affects jruby.
if (compiledScript == null
&& scriptEngineContainer.getScriptEngine()instanceof Compilable scriptEngine) {
&& scriptEngineContainer.getScriptEngine() instanceof Compilable scriptEngine) {
// no compiled script available but compiling is supported
compiledScript = scriptEngine.compile(scriptRecord.script);
scriptRecord.compiledScript = compiledScript;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ private ConfigParser() {
*
* <pre>
* {@code
* public void modified(Map<String, Object> properties) {
* public void modified(Map<String, Object> properties) {
* YourConfig config = ConfigParser.configurationAs(properties, YourConfig.class);
* }
* }
* }
* </pre>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,19 @@
*
* Parser rules follows Java Binary Block Parser syntax.
*
* <p>
* <p />
*
* See details from <a href=
* "https://github.com/raydac/java-binary-block-parser">https://github.com/raydac/java-binary-block-parser</a>
*
* <p>
* <p />
* Usage example:
*
* <pre>
* {@code
* JsonObject json = new Bin2Json("byte a; byte b; ubyte c;").convert("03FAFF");
* json.toString() = {"a":3,"b":-6,"c":255}
* }
* </pre>
*
* @author Pauli Anttila - Initial contribution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public boolean complete(String[] args, int cursorArgumentIndex, int cursorPositi
if (cursorArgumentIndex <= 0) {
return new StringsCompleter(
itemRegistry.getAll().stream().map(i -> i.getName()).collect(Collectors.toList()), true)
.complete(args, cursorArgumentIndex, cursorPosition, candidates);
.complete(args, cursorArgumentIndex, cursorPosition, candidates);
}
var localDataTypeGetter = dataTypeGetter;
if (cursorArgumentIndex == 1 && localDataTypeGetter != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ public Response updateConfiguration(
thingRegistry.updateConfiguration(thingUIDObject,
new Configuration(
normalizeConfiguration(configurationParameters, thing.getThingTypeUID(), thing.getUID()))
.getProperties());
.getProperties());
} catch (ConfigValidationException ex) {
logger.debug("Config description validation exception occurred for thingUID {} - Messages: {}", thingUID,
ex.getValidationMessages());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,4 @@ public void deactivate() throws Exception {
public String getExtension() {
return "items";
}

}
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
/**
* Copyright (c) 2010-2023 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.model.internal.valueconverter;

import org.openhab.core.model.core.valueconverter.ValueTypeToStringConverter;
import org.eclipse.xtext.common.services.DefaultTerminalConverters;
import org.eclipse.xtext.conversion.IValueConverter;
import org.eclipse.xtext.conversion.ValueConverter;

import com.google.inject.Inject;

/**
* Registers {@link IValueConverter}s for the items language.
*
* @author Simon Kaufmann - Initial contribution
*/
public class ItemValueConverters extends DefaultTerminalConverters {

@Inject
private ValueTypeToStringConverter valueTypeToStringConverter;

@ValueConverter(rule = "ValueType")
public IValueConverter<Object> ValueType() {
return valueTypeToStringConverter;
}

}
/**
* Copyright (c) 2010-2023 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.model.internal.valueconverter;

import org.eclipse.xtext.common.services.DefaultTerminalConverters;
import org.eclipse.xtext.conversion.IValueConverter;
import org.eclipse.xtext.conversion.ValueConverter;
import org.openhab.core.model.core.valueconverter.ValueTypeToStringConverter;

import com.google.inject.Inject;

/**
* Registers {@link IValueConverter}s for the items language.
*
* @author Simon Kaufmann - Initial contribution
*/
public class ItemValueConverters extends DefaultTerminalConverters {

@Inject
private ValueTypeToStringConverter valueTypeToStringConverter;

@ValueConverter(rule = "ValueType")
public IValueConverter<Object> ValueType() {
return valueTypeToStringConverter;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ public BindingConfigParseException(String msg) {
public BindingConfigParseException(String msg, Exception e) {
super(msg, e);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -517,5 +517,4 @@ private Map<String, Item> toItemMap(@Nullable Collection<Item> items) {
public @Nullable StateDescriptionFragment getStateDescriptionFragment(String itemName, @Nullable Locale locale) {
return stateDescriptionFragments.get(itemName);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public void removeMetadataByNamespace(String namespace) {
* Removes all meta-data for a given item
*
* @param itemName the item name
*/public void removeMetadataByItemName(String itemName) {
*/
public void removeMetadataByItemName(String itemName) {
Set<Metadata> toBeRemoved;
try {
lock.writeLock().lock();
Expand All @@ -101,6 +102,7 @@ public void removeMetadataByNamespace(String namespace) {
notifyListenersAboutRemovedElement(m);
}
}

@Override
public Collection<Metadata> getAll() {
try {
Expand All @@ -110,5 +112,4 @@ public Collection<Metadata> getAll() {
lock.readLock().unlock();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,4 @@ public void deactivate() throws Exception {
public String getExtension() {
return "persist";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@
import java.util.List;

import org.eclipse.emf.ecore.EObject;
import org.openhab.core.persistence.PersistenceManager;
import org.openhab.core.persistence.PersistenceService;
import org.openhab.core.persistence.PersistenceServiceConfiguration;
import org.openhab.core.persistence.PersistenceFilter;
import org.openhab.core.persistence.PersistenceItemConfiguration;
import org.openhab.core.persistence.config.PersistenceAllConfig;
import org.openhab.core.persistence.config.PersistenceConfig;
import org.openhab.core.persistence.config.PersistenceGroupConfig;
import org.openhab.core.persistence.config.PersistenceItemConfig;
import org.openhab.core.persistence.strategy.PersistenceCronStrategy;
import org.openhab.core.persistence.strategy.PersistenceStrategy;
import org.openhab.core.model.core.EventType;
import org.openhab.core.model.core.ModelRepository;
import org.openhab.core.model.core.ModelRepositoryChangeListener;
Expand All @@ -38,6 +27,17 @@
import org.openhab.core.model.persistence.persistence.PersistenceConfiguration;
import org.openhab.core.model.persistence.persistence.PersistenceModel;
import org.openhab.core.model.persistence.persistence.Strategy;
import org.openhab.core.persistence.PersistenceFilter;
import org.openhab.core.persistence.PersistenceItemConfiguration;
import org.openhab.core.persistence.PersistenceManager;
import org.openhab.core.persistence.PersistenceService;
import org.openhab.core.persistence.PersistenceServiceConfiguration;
import org.openhab.core.persistence.config.PersistenceAllConfig;
import org.openhab.core.persistence.config.PersistenceConfig;
import org.openhab.core.persistence.config.PersistenceGroupConfig;
import org.openhab.core.persistence.config.PersistenceItemConfig;
import org.openhab.core.persistence.strategy.PersistenceCronStrategy;
import org.openhab.core.persistence.strategy.PersistenceStrategy;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

Expand Down Expand Up @@ -170,5 +170,4 @@ private List<PersistenceFilter> mapFilters(List<Filter> filters) {
private PersistenceFilter mapFilter(Filter filter) {
return new PersistenceFilter();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.impl.ResourceImpl;
import org.openhab.core.model.persistence.persistence.Strategy;
import org.eclipse.xtext.resource.EObjectDescription;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.impl.AbstractGlobalScopeProvider;
import org.eclipse.xtext.scoping.impl.SimpleScope;
import org.openhab.core.model.persistence.persistence.Strategy;

import com.google.common.base.Predicate;

Expand Down Expand Up @@ -53,5 +53,4 @@ protected IScope getScope(Resource resource, boolean ignoreCase, EClass type,
}
return new SimpleScope(parentScope, descs);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,5 @@ public RuleContextAdapter(IEvaluationContext context) {
public IEvaluationContext getContext() {
return context;
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,4 @@ public void assignValue(QualifiedName qualifiedName, Object value) {
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,10 @@ public Class<?> forName(String name) throws ClassNotFoundException {
cache.put(name, NULL_CLASS);
throw e;
}

}

@Override
protected Class<?> forName(String name, ClassLoader classLoader) throws ClassNotFoundException {
return Class.forName(name, false, classLoader);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ private DefaultEvaluationContext createEvaluationContext(Script script, IEvaluat
}
}

Map<String, Object> cachePreset = scriptExtensionAccessor.findPreset("cache", (String) context.getAttribute("oh.engine-identifier", ScriptContext.ENGINE_SCOPE));
Map<String, Object> cachePreset = scriptExtensionAccessor.findPreset("cache",
(String) context.getAttribute("oh.engine-identifier", ScriptContext.ENGINE_SCOPE));
evalContext.newValue(QualifiedName.create("sharedCache"), cachePreset.get("sharedCache"));
evalContext.newValue(QualifiedName.create("privateCache"), cachePreset.get("privateCache"));
// now add specific implicit vars, where we have to map the right content
Expand Down Expand Up @@ -211,7 +212,6 @@ public Object eval(Reader reader, Bindings n) throws ScriptException {

@Override
public void put(String key, Object value) {

}

@Override
Expand Down Expand Up @@ -240,7 +240,6 @@ public ScriptContext getContext() {

@Override
public void setContext(ScriptContext context) {

}

@Override
Expand Down Expand Up @@ -308,5 +307,4 @@ public String getEngineName() {
}
};
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public class DSLScriptEngineFactory implements ScriptEngineFactory {
protected @Nullable DSLScriptContextProvider contextProvider;

@Activate
public DSLScriptEngineFactory(@Reference ScriptEngine scriptEngine, @Reference ScriptExtensionAccessor scriptExtensionAccessor) {
public DSLScriptEngineFactory(@Reference ScriptEngine scriptEngine,
@Reference ScriptExtensionAccessor scriptExtensionAccessor) {
this.scriptEngine = scriptEngine;
this.scriptExtensionAccessor = scriptExtensionAccessor;
}
Expand All @@ -63,5 +64,4 @@ public void scopeValues(javax.script.ScriptEngine scriptEngine, Map<String, Obje
public javax.script.@Nullable ScriptEngine createScriptEngine(String scriptType) {
return new DSLScriptEngine(scriptEngine, contextProvider, scriptExtensionAccessor);
}

}
Loading