de.hakenadu.terms.gson.converter.StringConstantValueConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of composite-terms Show documentation
Show all versions of composite-terms Show documentation
A light extensible java 8+ library for creating composites of terms which are evaluatable using a visitor pattern.
The newest version!
package de.hakenadu.terms.gson.converter;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
public final class StringConstantValueConverter implements ConstantValueConverter {
@Override
public JsonElement toJson(final String value) {
return new JsonPrimitive(value);
}
@Override
public String fromJson(final JsonElement jsonElement) {
return jsonElement.getAsJsonPrimitive().getAsString();
}
@Override
public String getTypeName() {
return "string";
}
@Override
public Class getTypeClass() {
return String.class;
}
}