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

cdc.applic.expressions.content.StringValue Maven / Gradle / Ivy

There is a newer version: 0.13.3
Show newest version
package cdc.applic.expressions.content;

import cdc.applic.expressions.literals.SName;

/**
 * Class representing a single string value.
 *
 * @author Damien Carbonne
 */
public final class StringValue extends SName implements StringSItem, Value {
    /**
     * Value used to designate all unknown values with pattern types.
     * 

* Special processing is associated to this value that should not be used with normal types. */ public static final StringValue PATTERN_UNKNOWN = of(SName.LITERAL_PATTERN_UNKNOWN); private StringValue(String literal, boolean escaped) { super(literal, escaped); } /** * Creates a StringValue from an escaped or non-escaped literal. * * @param literal The literal. * @param escaped {@code true} if {@code literal} is escaped. * @return A new StringValue or {@code null} if {@code literal} is {@code null}. */ public static StringValue of(String literal, boolean escaped) { return literal == null ? null : new StringValue(literal, escaped); } /** * Creates a StringValue from a non-escaped literal. * * @param literal The non-escaped literal. * @return A new StringValue or {@code null} if {@code literal} is {@code null}. */ public static StringValue of(String literal) { return of(literal, false); } @Override public boolean equals(Object object) { if (this == object) { return true; } if (!(object instanceof StringValue)) { return false; } final StringValue other = (StringValue) object; return getNonEscapedLiteral().equals(other.getNonEscapedLiteral()); } @Override public int hashCode() { return super.hashCode(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy