summaryrefslogtreecommitdiffstats
path: root/appmarket-utils/src/main/java/app/market/utils/property/Option.java
diff options
context:
space:
mode:
Diffstat (limited to 'appmarket-utils/src/main/java/app/market/utils/property/Option.java')
-rw-r--r--appmarket-utils/src/main/java/app/market/utils/property/Option.java78
1 files changed, 78 insertions, 0 deletions
diff --git a/appmarket-utils/src/main/java/app/market/utils/property/Option.java b/appmarket-utils/src/main/java/app/market/utils/property/Option.java
new file mode 100644
index 0000000..eb8413e
--- /dev/null
+++ b/appmarket-utils/src/main/java/app/market/utils/property/Option.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2019 TOYOTA MOTOR CORPORATION
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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 CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package app.market.utils.property;
+
+import java.io.Serializable;
+
+/**
+ * Page select's option
+ *
+ * @author Toyota
+ */
+public class Option implements Serializable, Comparable<Option> {
+
+ private static final long serialVersionUID = 3717357659129461807L;
+
+ private String label;
+ private String value;
+
+ public Option() {
+ }
+
+ public Option(String label, String value) {
+ this.label = label;
+ this.value = value;
+ }
+
+ /**
+ * @return the label
+ */
+ public String getLabel() {
+ return label == null ? "" : label;
+ }
+
+ /**
+ * @param label
+ * the label to set
+ */
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * @param value
+ * the value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public int compareTo(Option o) {
+ int b = Integer.valueOf( o.getValue() );
+ int n = ( this.getValue() == null || "".equals( this.getValue().trim() ) ) ? 0
+ : Integer.valueOf( this.getValue() );
+ return b > n ? -1 : 1;
+ }
+
+}