All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.innoventsolutions.birt.util.LowerCaseClassNameResolver Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (C) 2020 Innovent Solutions
 *
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 ******************************************************************************/
package com.innoventsolutions.birt.util;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase;

/**
 * Used in ApiError handling to convert Exceptions to Errors in REST message
 * 
 * @author Steve Schafer
 *
 */
public class LowerCaseClassNameResolver extends TypeIdResolverBase {

	@Override
	public String idFromValue(final Object value) {
		return value.getClass().getSimpleName().toLowerCase();
	}

	@Override
	public String idFromValueAndType(final Object value, final Class suggestedType) {
		return idFromValue(value);
	}

	@Override
	public JsonTypeInfo.Id getMechanism() {
		return JsonTypeInfo.Id.CUSTOM;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy