Cleanup DocumentedNode
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / util / RangeConstraintImpl.java
index 75ff4793d0f3d0f50c6988158cd33c777bb74ac6..ce06bfed82f7c5c096e75478ba5f51c30866233c 100644 (file)
@@ -7,21 +7,21 @@
  */
 package org.opendaylight.yangtools.yang.model.util;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import java.util.Objects;
+import java.util.Optional;
 import org.opendaylight.yangtools.concepts.Immutable;
 import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
 
 /**
- * {@link Immutable} implementation of {@link LengthConstraint}.
- *
- * Range constraint based on supplied parameters with additional behaviour:
+ * {@link Immutable} implementation of {@link RangeConstraint}.
  *
+ * <p>
+ * Range constraint based on supplied parameters with additional behavior:
  * <ul>
  * <li>{@link RangeConstraint#getErrorAppTag()} returns
  * <code>range-out-of-specified-bounds</code>
- * <li>{@link RangeConstraint#getErrorMessage() returns <code>The argument is
+ * <li>{@link RangeConstraint#getErrorMessage()} returns <code>The argument is
  * out of bounds &lt;<i>min</i>, <i>max</i> &gt;</code>
  * </ul>
  */
@@ -45,31 +45,31 @@ final class RangeConstraintImpl implements RangeConstraint, Immutable {
             final Optional<String> reference, final String errorAppTag, final String errorMessage) {
         this.min = Preconditions.checkNotNull(min, "min must not be null.");
         this.max = Preconditions.checkNotNull(max, "max must not be null.");
-        this.description = description.orNull();
-        this.reference = reference.orNull();
+        this.description = description.orElse(null);
+        this.reference = reference.orElse(null);
         this.errorAppTag = errorAppTag != null ? errorAppTag : "range-out-of-specified-bounds";
         this.errorMessage = errorMessage != null ? errorMessage : "The argument is out of bounds <" + min + ", " + max
                 + ">";
     }
 
     @Override
-    public String getDescription() {
-        return description;
+    public Optional<String> getDescription() {
+        return Optional.ofNullable(description);
     }
 
     @Override
-    public String getErrorAppTag() {
-        return errorAppTag;
+    public Optional<String> getErrorAppTag() {
+        return Optional.ofNullable(errorAppTag);
     }
 
     @Override
-    public String getErrorMessage() {
-        return errorMessage;
+    public Optional<String> getErrorMessage() {
+        return Optional.ofNullable(errorMessage);
     }
 
     @Override
-    public String getReference() {
-        return reference;
+    public Optional<String> getReference() {
+        return Optional.ofNullable(reference);
     }
 
     @Override
@@ -110,18 +110,7 @@ final class RangeConstraintImpl implements RangeConstraint, Immutable {
 
     @Override
     public String toString() {
-        return "RangeConstraintImpl [min=" +
-                min +
-                ", max=" +
-                max +
-                ", description=" +
-                description +
-                ", reference=" +
-                reference +
-                ", errorAppTag=" +
-                errorAppTag +
-                ", errorMessage=" +
-                errorMessage +
-                "]";
+        return "RangeConstraintImpl [min=" + min + ", max=" + max + ", description=" + description
+                + ", reference=" + reference + ", errorAppTag=" + errorAppTag + ", errorMessage=" + errorMessage + "]";
     }
-}
\ No newline at end of file
+}