-
-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
- Loading branch information
Showing
21 changed files
with
1,079 additions
and
27 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
81 changes: 81 additions & 0 deletions
81
...les/org.openhab.core.addon/src/main/java/org/openhab/core/addon/AddonDiscoveryMethod.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,81 @@ | ||
/** | ||
* 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.addon; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
/** | ||
* DTO for serialization of a suggested addon discovery method. | ||
* | ||
* @author Andrew Fiddian-Green - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class AddonDiscoveryMethod { | ||
private @NonNullByDefault({}) String serviceType; | ||
private @Nullable String mdnsServiceType; | ||
private @Nullable List<AddonMatchProperty> matchProperties; | ||
|
||
public String getServiceType() { | ||
return serviceType.toLowerCase(); | ||
} | ||
|
||
public String getMdnsServiceType() { | ||
String mdnsServiceType = this.mdnsServiceType; | ||
return mdnsServiceType != null ? mdnsServiceType : ""; | ||
} | ||
|
||
public List<AddonMatchProperty> getMatchProperties() { | ||
List<AddonMatchProperty> matchProperties = this.matchProperties; | ||
return matchProperties != null ? matchProperties : List.of(); | ||
} | ||
|
||
public AddonDiscoveryMethod setServiceType(String serviceType) { | ||
this.serviceType = serviceType.toLowerCase(); | ||
return this; | ||
} | ||
|
||
public AddonDiscoveryMethod setMdnsServiceType(@Nullable String mdnsServiceType) { | ||
this.mdnsServiceType = mdnsServiceType; | ||
return this; | ||
} | ||
|
||
public AddonDiscoveryMethod setMatchProperties(@Nullable List<AddonMatchProperty> matchProperties) { | ||
this.matchProperties = matchProperties; | ||
return this; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(serviceType, mdnsServiceType, matchProperties); | ||
} | ||
|
||
@Override | ||
public boolean equals(@Nullable Object obj) { | ||
if (this == obj) { | ||
return true; | ||
} | ||
if (obj == null) { | ||
return false; | ||
} | ||
if (getClass() != obj.getClass()) { | ||
return false; | ||
} | ||
AddonDiscoveryMethod other = (AddonDiscoveryMethod) obj; | ||
return Objects.equals(serviceType, other.serviceType) && Objects.equals(mdnsServiceType, other.mdnsServiceType) | ||
&& Objects.equals(matchProperties, other.matchProperties); | ||
} | ||
} |
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
38 changes: 38 additions & 0 deletions
38
bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/AddonInfoList.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,38 @@ | ||
/** | ||
* 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.addon; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
/** | ||
* DTO containing a list of {@code AddonInfo} | ||
* | ||
* @author Andrew Fiddian-Green - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class AddonInfoList { | ||
protected @Nullable List<AddonInfo> addons; | ||
|
||
public List<AddonInfo> getAddons() { | ||
List<AddonInfo> addons = this.addons; | ||
return addons != null ? addons : List.of(); | ||
} | ||
|
||
public AddonInfoList setAddons(@Nullable List<AddonInfo> addons) { | ||
this.addons = addons; | ||
return this; | ||
} | ||
} |
Oops, something went wrong.