validation/validation-aspect/src/main/java/se/jguru/nazgul/tools/validation/aspect/ValidationAspect.java
@AfterReturning(value = "anyNonDefaultConstructor(joinPoint) && target(aValidatable)",
            argNames = "joinPoint, aValidatable")
    public void performValidationAfterCompoundConstructor(final JoinPoint joinPoint, final Validatable aValidatable)
            throws InternalStateValidationException {

        if (log.isDebugEnabled()) {
            log.debug("Validating instance of type [" + aValidatable.getClass().getName() + "]");
        }

        if (joinPoint.getStaticPart() == null) {
            log.warn("Static part of join point was null for validatable of type: "
                    + aValidatable.getClass().getName(), new IllegalStateException());
            return;
        }

        // Ignore calling validateInternalState when we execute constructors in
        // any class but the concrete Validatable class.
        final ConstructorSignature sig = (ConstructorSignature) joinPoint.getSignature();
        final Class<?> constructorDefinitionClass = sig.getConstructor().getDeclaringClass();
        if (aValidatable.getClass() == constructorDefinitionClass) {

            // Now fire the validateInternalState method.
            aValidatable.validateInternalState();

        } else {

            log.debug("Ignored firing validatable for constructor defined in ["
                    + constructorDefinitionClass.getName() + "] and Validatable of type ["
                    + aValidatable.getClass().getName() + "]");
        }
    }
@AfterReturning(value = "anyNonDefaultConstructor(joinPoint) && target(aValidatable)",
            argNames = "joinPoint, aValidatable")
    public void performValidationAfterCompoundConstructor(final JoinPoint joinPoint, final Validatable aValidatable)
            throws InternalStateValidationException {

        if (log.isDebugEnabled()) {
            log.debug("Validating instance of type [" + aValidatable.getClass().getName() + "]");
        }

        if (joinPoint.getStaticPart() == null) {
            log.warn("Static part of join point was null for validatable of type: "
                    + aValidatable.getClass().getName(), new IllegalStateException());
            return;
        }

        // Ignore calling validateInternalState when we execute constructors in
        // any class but the concrete Validatable class.
        final ConstructorSignature sig = (ConstructorSignature) joinPoint.getSignature();
        final Class<?> constructorDefinitionClass = sig.getConstructor().getDeclaringClass();
        if (aValidatable.getClass() == constructorDefinitionClass) {

            // Now fire the validateInternalState method.
            aValidatable.validateInternalState();

        } else {

            log.debug("Ignored firing validatable for constructor defined in ["
                    + constructorDefinitionClass.getName() + "] and Validatable of type ["
                    + aValidatable.getClass().getName() + "]");
        }
    }
Aspect invoking the {@link Validatable#validateInternalState()} method before returning from any non-default
constructor within a class implementing {@link Validatable}.

@param joinPoint The currently executing joinPoint.
@throws InternalStateValidationException if the validation of the {@link Validatable} failed.