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

org.interledger.link.Ids Maven / Gradle / Ivy

There is a newer version: 1.3.1
Show newest version
package org.interledger.link;

import org.interledger.core.Wrapped;
import org.interledger.core.Wrapper;

import org.immutables.value.Value;

/**
 * Wrapped immutable classes for providing type-safe identifiers.
 */
public class Ids {

  @Value.Immutable
  @Wrapped
  @SuppressWarnings( {"TypeName"})
  abstract static class _LinkId extends Wrapper {

  }

  @Wrapped
  @SuppressWarnings( {"TypeName"})
  @Value.Immutable
  abstract static class _LinkType extends Wrapper {

    /**
     * Always normalize Link-type String values to full uppercase to avoid casing ambiguity in properties files.
     *
     * @return A Link type.
     */
    @Value.Check
    public _LinkType normalize() {
      final String linkTypeString = this.value();
      if (!linkTypeString.toUpperCase().equals(linkTypeString)) {
        return LinkType.of(linkTypeString.toUpperCase());
      } else {
        return this;
      }
    }

  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy