org.springframework.network.LiteNetwork Maven / Gradle / Ivy
package org.springframework.network;
class LiteNetwork implements Network {
public static final LiteNetwork NORMAL_INSTANCE = new LiteNetwork(NetworkType.NORMAL, NetworkPlatform.UNKNOWN);
public static final LiteNetwork EXTERNAL_INSTANCE = new LiteNetwork(NetworkType.EXTERNAL, NetworkPlatform.UNKNOWN);
public static final LiteNetwork INTERNAL_INSTANCE = new LiteNetwork(NetworkType.INTERNAL, NetworkPlatform.UNKNOWN);
@Override
public boolean isNormal() {
return this.networkType == NetworkType.NORMAL;
}
@Override
public boolean isExternal() {
return this.networkType == NetworkType.EXTERNAL;
}
@Override
public boolean isInternal() {
return this.networkType == NetworkType.INTERNAL;
}
@Override
public NetworkPlatform getNetworkPlatform() {
return this.networkPlatform;
}
public NetworkType getNetworkType() {
return this.networkType;
}
public static Network from(NetworkType networkType, NetworkPlatform networkPlatform) {
return new LiteNetwork(networkType, networkPlatform);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("[LiteNetwork ");
builder.append("type").append("=").append(this.networkType);
builder.append("]");
return builder.toString();
}
private final NetworkType networkType;
private final NetworkPlatform networkPlatform;
private LiteNetwork(NetworkType NetworkType, NetworkPlatform networkPlatform) {
this.networkType = NetworkType;
this.networkPlatform = networkPlatform;
}
}