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

jodd.jtx.meta.TransactionAnnotation Maven / Gradle / Ivy

// Copyright (c) 2003-present, Jodd Team (jodd.org). All Rights Reserved.

package jodd.jtx.meta;

import jodd.jtx.JtxIsolationLevel;
import jodd.jtx.JtxPropagationBehavior;
import jodd.jtx.JtxTransactionMode;
import jodd.util.AnnotationDataReader;

import java.lang.annotation.Annotation;
import java.lang.reflect.AccessibleObject;

/**
 * Transaction annotation.
 */
public class TransactionAnnotation extends AnnotationDataReader> {

	public TransactionAnnotation(Class annotationClass) {
		super(annotationClass, Transaction.class);
	}

	/**
	 * Need to override to make java compiler happy.
	 */
	@Override
	public TransactionAnnotationData readAnnotationData(AccessibleObject accessibleObject) {
		return super.readAnnotationData(accessibleObject);
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	protected TransactionAnnotationData createAnnotationData(A annotation) {

		TransactionAnnotationData td = new TransactionAnnotationData(annotation);

		td.propagation = (JtxPropagationBehavior) readElement(annotation, "propagation");

		td.isolation = (JtxIsolationLevel) readElement(annotation, "isolation");

		td.readOnly = readBoolean(annotation, "readOnly", false);

		td.timeout = readInt(annotation, "timeout", JtxTransactionMode.DEFAULT_TIMEOUT);

		return td;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy