001package ball.upnp;
002/*-
003 * ##########################################################################
004 * UPnP/SSDP Implementation Classes
005 * %%
006 * Copyright (C) 2013 - 2022 Allen D. Ball
007 * %%
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *      http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 * ##########################################################################
020 */
021import java.net.URI;
022import java.util.Map;
023import java.util.Set;
024import lombok.EqualsAndHashCode;
025import lombok.NoArgsConstructor;
026import lombok.Synchronized;
027
028import static lombok.AccessLevel.PROTECTED;
029
030/**
031 * Abstract base class for {@link.uri http://www.upnp.org/ UPnP}
032 * {@link Device}s.
033 *
034 * {@bean.info}
035 *
036 * @author {@link.uri mailto:ball@hcf.dev Allen D. Ball}
037 */
038@NoArgsConstructor(access = PROTECTED) @EqualsAndHashCode
039public abstract class AbstractDevice implements AnnotatedDevice {
040    private Map<URI,Set<URI>> map = null;
041
042    @Synchronized
043    @Override
044    public Map<URI,Set<URI>> getUSNMap() {
045        if (map == null) {
046            map = AnnotatedDevice.super.getUSNMap();
047        }
048
049        return map;
050    }
051
052    @Override
053    public String toString() { return getDeviceType().toString(); }
054}