com.github.tcurrie.rest.factory.RestUri Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rest.factory Show documentation
Show all versions of rest.factory Show documentation
Simple rest client-server factory, you give it a url, it does the rest!
package com.github.tcurrie.rest.factory;
import com.openpojo.business.BusinessIdentity;
import com.openpojo.business.annotation.BusinessKey;
import java.util.function.Supplier;
public class RestUri implements Supplier {
private final Supplier urlSupplier;
@BusinessKey private final String methodUri;
public static RestUri create(final Supplier urlSupplier, final String methodUri) {
return new RestUri(urlSupplier, methodUri);
}
private RestUri(final Supplier urlSupplier, final String methodUri) {
this.urlSupplier = urlSupplier;
this.methodUri = methodUri;
}
@SuppressWarnings("unused")
public Supplier getUrlSupplier() {
return urlSupplier;
}
@SuppressWarnings("unused")
public String getMethodUri() {
return methodUri;
}
@Override
public String get() {
return urlSupplier.get() + methodUri;
}
@Override
public int hashCode() {
return BusinessIdentity.getHashCode(this);
}
@SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
@Override
public boolean equals(final Object obj) {
return BusinessIdentity.areEqual(this, obj);
}
@Override
public String toString() {
return BusinessIdentity.toString(this);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy