Skip to contentPackage: Media
Media
Coverage
1: /*
2: * #%L
3: * *********************************************************************************************************************
4: *
5: * NorthernWind - lightweight CMS
6: * http://northernwind.tidalwave.it - git clone https://bitbucket.org/tidalwave/northernwind-src.git
7: * %%
8: * Copyright (C) 2011 - 2023 Tidalwave s.a.s. (http://tidalwave.it)
9: * %%
10: * *********************************************************************************************************************
11: *
12: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
13: * the License. You may obtain a copy of the License at
14: *
15: * http://www.apache.org/licenses/LICENSE-2.0
16: *
17: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
18: * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
19: * specific language governing permissions and limitations under the License.
20: *
21: * *********************************************************************************************************************
22: *
23: *
24: * *********************************************************************************************************************
25: * #L%
26: */
27: package it.tidalwave.northernwind.core.model;
28:
29: import javax.annotation.Nonnull;
30: import lombok.AccessLevel;
31: import lombok.AllArgsConstructor;
32: import lombok.Getter;
33: import lombok.RequiredArgsConstructor;
34: import lombok.ToString;
35: import lombok.With;
36:
37: /***********************************************************************************************************************
38: *
39: * A {@code Media} item is a document that is served as-is, without any processing. It's typically an image or such.
40: *
41: * @author Fabrizio Giudici
42: *
43: **********************************************************************************************************************/
44: public interface Media extends Resource
45: {
46: public static final Class<Media> _Media_ = Media.class;
47:
48: /*******************************************************************************************************************
49: *
50: * A builder of a {@link Content}.
51: *
52: ******************************************************************************************************************/
53: @AllArgsConstructor(access = AccessLevel.PRIVATE) @RequiredArgsConstructor
54: @Getter @ToString(exclude = "callBack")
55: public final class Builder
56: {
57: // Workaround for a Lombok limitation with Wither and subclasses
58: @FunctionalInterface
59: public static interface CallBack
60: {
61: @Nonnull
62: public Media build (@Nonnull Builder builder);
63: }
64:
65: @Nonnull
66: private final ModelFactory modelFactory;
67:
68: @Nonnull
69: private final CallBack callBack;
70:
71: @With
72: private ResourceFile file;
73:
74: @Nonnull
75: public Media build()
76: {
77: return callBack.build(this);
78: }
79: }
80: }