Skip to contentPackage: Media
Media
Coverage
1: /*
2: * *************************************************************************************************************************************************************
3: *
4: * NorthernWind - lightweight CMS
5: * http://tidalwave.it/projects/northernwind
6: *
7: * Copyright (C) 2011 - 2025 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 the License.
12: * 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 an "AS IS" BASIS, WITHOUT WARRANTIES OR
17: * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
18: *
19: * *************************************************************************************************************************************************************
20: *
21: * git clone https://bitbucket.org/tidalwave/northernwind-src
22: * git clone https://github.com/tidalwave-it/northernwind-src
23: *
24: * *************************************************************************************************************************************************************
25: */
26: package it.tidalwave.northernwind.core.model;
27:
28: import javax.annotation.Nonnull;
29: import lombok.AccessLevel;
30: import lombok.AllArgsConstructor;
31: import lombok.Getter;
32: import lombok.RequiredArgsConstructor;
33: import lombok.ToString;
34: import lombok.With;
35:
36: /***************************************************************************************************************************************************************
37: *
38: * A {@code Media} item is a document that is served as-is, without any processing. It's typically an image or such.
39: *
40: * @author Fabrizio Giudici
41: *
42: **************************************************************************************************************************************************************/
43: public interface Media extends Resource
44: {
45: public static final Class<Media> _Media_ = Media.class;
46:
47: /***********************************************************************************************************************************************************
48: * A builder of a {@link Content}.
49: **********************************************************************************************************************************************************/
50: @AllArgsConstructor(access = AccessLevel.PRIVATE) @RequiredArgsConstructor
51: @Getter @ToString(exclude = "callBack")
52: public final class Builder
53: {
54: // Workaround for a Lombok limitation with Wither and subclasses
55: @FunctionalInterface
56: public static interface CallBack
57: {
58: @Nonnull
59: public Media build (@Nonnull Builder builder);
60: }
61:
62: @Nonnull
63: private final ModelFactory modelFactory;
64:
65: @Nonnull
66: private final CallBack callBack;
67:
68: @With
69: private ResourceFile file;
70:
71: @Nonnull
72: public Media build()
73: {
74: return callBack.build(this);
75: }
76: }
77: }