com.flyfish.oauth.domain.data.Tuple Maven / Gradle / Ivy
package com.flyfish.oauth.domain.data;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 二元组
*/
@AllArgsConstructor(staticName = "of")
public class Tuple {
@Getter
private T first;
@Getter
private T second;
private Tuple(T[] args) {
this.first = args[0];
this.second = args[1];
}
@SuppressWarnings("unchecked")
private Tuple(String pattern) {
this((T[]) pattern.split(" -> "));
}
public static Tuple parse(String pattern) {
return new Tuple<>(pattern);
}
}