class MyAttributeEncodingFactory {

  public static MyAttributeValue parseValueFromEncoding(URI encoding, Object attributeValue, /*Nullable*/ EnumAllowedValues eav) {
    MyAttributeValue ret = parseValueFromEncodingNoCheck(encoding, attributeValue, eav);
    if(! encoding.equals(ret.getEncodingOrNull())) {
      throw new RuntimeException("Problem with encoding: " + encoding + "/" + ret.getEncodingOrNull());
    }
    return ret;
  }

}