All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.softicar.platform.common.core.immutable.ImmutableStringWrapper Maven / Gradle / Ivy

Go to download

The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.

There is a newer version: 50.0.0
Show newest version
package com.softicar.platform.common.core.immutable;

/**
 * Base class for string wrapper classes.
 * 

* For example, if you want to be sure that all article numbers are normalized, * derive a new class from this class to represent a valid article number. * * @author Oliver Richers */ public class ImmutableStringWrapper implements Comparable { private final String value; protected ImmutableStringWrapper(String value) { this.value = value; } public boolean isEmpty() { return value.isEmpty(); } @Override public String toString() { return value; } @Override public int hashCode() { return value.hashCode(); } @Override public boolean equals(Object other) { if (other instanceof ImmutableStringWrapper) { return value.equals(((ImmutableStringWrapper) other).value); } else if (other instanceof String) { return value.equals(other); } return false; } @Override public int compareTo(ImmutableStringWrapper other) { return value.compareTo(other.value); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy