This repository has been archived by the owner on May 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 782
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
consider the user's opinion via metadata
Signed-off-by: Simon Kaufmann <simon.kfm@googlemail.com>
- Loading branch information
Simon Kaufmann
committed
Jun 22, 2018
1 parent
3121065
commit 89d1612
Showing
4 changed files
with
107 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...n/java/org/eclipse/smarthome/core/thing/internal/AutoUpdateConfigDescriptionProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* Copyright (c) 2014,2018 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* 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.eclipse.smarthome.core.thing.internal; | ||
|
||
import static java.util.stream.Collectors.toList; | ||
|
||
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.stream.Stream; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.smarthome.config.core.ConfigDescriptionParameter; | ||
import org.eclipse.smarthome.config.core.ParameterOption; | ||
import org.eclipse.smarthome.config.core.metadata.MetadataConfigDescriptionProvider; | ||
import org.osgi.service.component.annotations.Component; | ||
|
||
/** | ||
* Provider of the config description for the auto update policy metadata. | ||
* | ||
* @author Simon Kaufmann - initial contribution and API | ||
* | ||
*/ | ||
@NonNullByDefault | ||
@Component | ||
public class AutoUpdateConfigDescriptionProvider implements MetadataConfigDescriptionProvider { | ||
|
||
@Override | ||
public String getNamespace() { | ||
return "autoupdate"; | ||
} | ||
|
||
@Override | ||
public @Nullable String getDescription(@Nullable Locale locale) { | ||
return "Auto Update"; | ||
} | ||
|
||
@Override | ||
public @Nullable List<ParameterOption> getParameterOptions(@Nullable Locale locale) { | ||
return Stream.of( // | ||
new ParameterOption("true", "Enforce an auto update"), // | ||
new ParameterOption("false", "Veto an auto update") // | ||
).collect(toList()); | ||
} | ||
|
||
@Override | ||
public @Nullable List<ConfigDescriptionParameter> getParameters(String value, @Nullable Locale locale) { | ||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters