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

org.llorllale.youtrack.api.FieldValue Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2017 George Aristy
 *
 * 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 org.llorllale.youtrack.api;

/**
 * A value for some {@link Field}.
 * 
 * @author George Aristy ([email protected])
 * @since 0.8.0
 */
public interface FieldValue {
  /**
   * The owner {@link Field}.
   * 
   * @return the owner {@link Field}
   * @since 0.8.0
   */
  Field field();

  /**
   * Returns a string representation of this {@link FieldValue}.
   * 
   * @return a string representation of this {@link FieldValue}
   * @since 0.8.0
   */
  String asString();

  /**
   * Whether this value is equal to {@code other} and both share the same parent {@link Field}.
   * 
   * @param other the other {@link FieldValue} to compare to
   * @return {@code true} if this {@link FieldValue} is equal to {@code other}, and both belong to
   *     the same parent {@link Field}; otherwise {@code false}
   * @since 0.8.0
   */
  default boolean isEqualTo(FieldValue other) {
    return this.field().isSameField(other.field()) && this.asString().equals(other.asString());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy