Search in sources :

Example 1 with TxType

use of javax.transaction.Transactional.TxType in project aries by apache.

the class ComponentTxData method parseTxData.

private boolean parseTxData(Class<?> c) {
    boolean shouldAssignInterceptor = false;
    Transactional classAnnotation = c.getAnnotation(Transactional.class);
    TxType defaultType = getType(classAnnotation);
    if (defaultType != null) {
        shouldAssignInterceptor = true;
    }
    for (Method m : c.getDeclaredMethods()) {
        try {
            Transactional methodAnnotation = m.getAnnotation(Transactional.class);
            TxType t = getType(methodAnnotation);
            if (t != null) {
                TransactionalAnnotationAttributes txData = new TransactionalAnnotationAttributes(t, methodAnnotation.dontRollbackOn(), methodAnnotation.rollbackOn());
                assertAllowedModifier(m);
                txMap.put(m, Optional.of(txData));
                shouldAssignInterceptor = true;
            } else if (defaultType != null) {
                txMap.put(m, Optional.of(new TransactionalAnnotationAttributes(defaultType, classAnnotation.dontRollbackOn(), classAnnotation.rollbackOn())));
            }
        } catch (IllegalStateException e) {
            LOG.warn("Invalid transaction annoation found", e);
        }
    }
    return shouldAssignInterceptor;
}
Also used : TxType(javax.transaction.Transactional.TxType) Method(java.lang.reflect.Method) Transactional(javax.transaction.Transactional)

Aggregations

Method (java.lang.reflect.Method)1 Transactional (javax.transaction.Transactional)1 TxType (javax.transaction.Transactional.TxType)1