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

com.zarbosoft.interface1.ObjectVisitor Maven / Gradle / Ivy

package com.zarbosoft.interface1;

import com.zarbosoft.rendaw.common.Pair;

import java.util.List;
import java.util.Map;
import java.util.Set;

public interface ObjectVisitor {

	void visitString(String value);

	void visitSigned(Long value);

	void visitUnsigned(Long value);

	void visitDouble(Double value);

	void visitBoolean(Boolean value);

	void visitEnum(Enum value);

	void visitListStart(List value);

	void visitListEnd(List value);

	void visitSetStart(Set value);

	void visitSetEnd(Set value);

	void visitMapStart(Map value);

	void visitKeyBegin(Object key);

	void visitKeyEnd(Object key);

	void visitMapEnd(Map value);

	void visitAbstractBegin(Class klass, Object value);

	void visitAbstractEnd(Class klass, Object value);

	boolean visitConcreteBegin(Class klass, Object value);

	void visitFieldBegin(TypeInfo field, Object value);

	void visitFieldEnd(TypeInfo field, Object value);

	void visitConcreteEnd(Class klass, Object value);

	default void visitOther(final Object value) {
		throw new AssertionError(String.format("Uninterfacable field of type or derived type [%s]",
				value.getClass()
		));
	}

	default Pair transformValue(TypeInfo fieldInfo, Object value) {
		return new Pair<>(fieldInfo, value);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy