Skip to content

Package: DIDLAdapter$ContentHolder

DIDLAdapter$ContentHolder

nameinstructionbranchcomplexitylinemethod
DIDLAdapter.ContentHolder(DIDLContent, int, int)
M: 0 C: 16
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
canEqual(Object)
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
equals(Object)
M: 52 C: 0
0%
M: 16 C: 0
0%
M: 9 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getContent()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getNumberReturned()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getTotalMatches()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
hashCode()
M: 34 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
toString()
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*
2: * *********************************************************************************************************************
3: *
4: * blueMarine II: Semantic Media Centre
5: * http://tidalwave.it/projects/bluemarine2
6: *
7: * Copyright (C) 2015 - 2021 by Tidalwave s.a.s. (http://tidalwave.it)
8: *
9: * *********************************************************************************************************************
10: *
11: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
12: * the License. You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
17: * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations under the License.
19: *
20: * *********************************************************************************************************************
21: *
22: * git clone https://bitbucket.org/tidalwave/bluemarine2-src
23: * git clone https://github.com/tidalwave-it/bluemarine2-src
24: *
25: * *********************************************************************************************************************
26: */
27: package it.tidalwave.bluemarine2.upnp.mediaserver.impl.didl;
28:
29: import javax.annotation.Nonnegative;
30: import javax.annotation.Nonnull;
31: import org.fourthline.cling.support.model.BrowseFlag;
32: import org.fourthline.cling.support.model.DIDLContent;
33: import org.fourthline.cling.support.model.DIDLObject;
34: import lombok.EqualsAndHashCode;
35: import lombok.Getter;
36: import lombok.RequiredArgsConstructor;
37: import lombok.ToString;
38:
39: /***********************************************************************************************************************
40: *
41: * An adapter which converts an object into DIDL stuff.
42: *
43: * @stereotype Role, Adapter
44: *
45: * @author Fabrizio Giudici
46: *
47: **********************************************************************************************************************/
48: public interface DIDLAdapter
49: {
50: public static final Class<DIDLAdapter> _DIDLAdapter_ = DIDLAdapter.class;
51:
52: /*******************************************************************************************************************
53: *
54: ******************************************************************************************************************/
55:• @RequiredArgsConstructor @Getter @EqualsAndHashCode @ToString
56: public static class ContentHolder
57: {
58: /**
59: * The {@link DIDLContent}.
60: */
61: @Nonnull
62: private final DIDLContent content;
63:
64: /**
65: * The number of items that are being returned - this take into account the fact that the client has
66: * requested a subset of data.
67: */
68: @Nonnegative
69: private final int numberReturned;
70:
71: /**
72: * The number of items that would match the client request.
73: */
74: @Nonnegative
75: private final int totalMatches;
76: }
77:
78: /*******************************************************************************************************************
79: *
80: * Converts the owner object to a {@link DIDLContent}.
81: *
82: * @param browseFlag whether metadata for a single object or enumeration of children should be returned
83: * @param from in case of multiple results, the first item to return
84: * @param maxResults in case of multiple results, how many items to return
85: * @return the holder of {@code DIDLContent}
86: *
87: ******************************************************************************************************************/
88: @Nonnull
89: public default ContentHolder toContent (@Nonnull final BrowseFlag browseFlag,
90: @Nonnegative final int from,
91: @Nonnegative final int maxResults)
92: throws Exception
93: {
94: final DIDLContent content = new DIDLContent();
95: content.addObject(toObject());
96: return new ContentHolder(content, 1, 1);
97: }
98:
99: /*******************************************************************************************************************
100: *
101: * Converts the owner object to a {@link DIDLObject}.
102: *
103: * @return the {@code DIDLObject}
104: *
105: ******************************************************************************************************************/
106: @Nonnull
107: public DIDLObject toObject()
108: throws Exception;
109: }