]> git.basschouten.com Git - openhab-addons.git/blob
2d2da0a45ff021921bf0d93783ef6a54facfa114
[openhab-addons.git] /
1 /**
2  * Copyright 2017-2018 Gregory Moyer and contributors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.openhab.binding.lametrictime.api.cloud.model;
17
18 import java.util.List;
19
20 public class IconFilter
21 {
22     private Integer page;
23     private Integer pageSize;
24     private List<IconField> fields;
25     private IconOrder order;
26
27     public Integer getPage()
28     {
29         return page;
30     }
31
32     public void setPage(Integer page)
33     {
34         this.page = page;
35     }
36
37     public IconFilter withPage(Integer page)
38     {
39         this.page = page;
40         return this;
41     }
42
43     public Integer getPageSize()
44     {
45         return pageSize;
46     }
47
48     public void setPageSize(Integer pageSize)
49     {
50         this.pageSize = pageSize;
51     }
52
53     public IconFilter withPageSize(Integer pageSize)
54     {
55         this.pageSize = pageSize;
56         return this;
57     }
58
59     public List<IconField> getFields()
60     {
61         return fields;
62     }
63
64     public String getFieldsString()
65     {
66         if (fields == null || fields.isEmpty())
67         {
68             return null;
69         }
70
71         StringBuilder builder = new StringBuilder();
72         builder.append(fields.get(0).name().toLowerCase());
73
74         for (int i = 1; i < fields.size(); i++)
75         {
76             builder.append(',').append(fields.get(i).name().toLowerCase());
77         }
78
79         return builder.toString();
80     }
81
82     public void setFields(List<IconField> fields)
83     {
84         this.fields = fields;
85     }
86
87     public IconFilter withFields(List<IconField> fields)
88     {
89         this.fields = fields;
90         return this;
91     }
92
93     public IconOrder getOrder()
94     {
95         return order;
96     }
97
98     public String getOrderString()
99     {
100         return order == null ? null : order.name().toLowerCase();
101     }
102
103     public void setOrder(IconOrder order)
104     {
105         this.order = order;
106     }
107
108     public IconFilter withOrder(IconOrder order)
109     {
110         this.order = order;
111         return this;
112     }
113 }