Example usage for org.springframework.boot.autoconfigure.condition ConditionMessage empty

List of usage examples for org.springframework.boot.autoconfigure.condition ConditionMessage empty

Introduction

In this page you can find the example usage for org.springframework.boot.autoconfigure.condition ConditionMessage empty.

Prototype

public static ConditionMessage empty() 

Source Link

Document

Factory method to return a new empty ConditionMessage .

Usage

From source file:org.juiser.spring.boot.config.JuiserSpringSecurityCondition.java

@Override
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {

    ConditionMessage matchMessage = ConditionMessage.empty();

    boolean enabled = isSpringSecurityEnabled(context);

    if (metadata.isAnnotated(ConditionalOnJuiserSpringSecurityEnabled.class.getName())) {
        if (!enabled) {
            return ConditionOutcome
                    .noMatch(ConditionMessage.forCondition(ConditionalOnJuiserSpringSecurityEnabled.class)
                            .didNotFind("spring security enabled").atAll());
        }/*w  ww .  jav  a2s. c  o m*/
        matchMessage = matchMessage.andCondition(ConditionalOnJuiserSpringSecurityEnabled.class)
                .foundExactly("spring security enabled");
    }

    if (metadata.isAnnotated(ConditionalOnJuiserSpringSecurityDisabled.class.getName())) {
        if (enabled) {
            return ConditionOutcome
                    .noMatch(ConditionMessage.forCondition(ConditionalOnJuiserSpringSecurityDisabled.class)
                            .didNotFind("spring security disabled").atAll());
        }
        matchMessage = matchMessage.andCondition(ConditionalOnJuiserSpringSecurityDisabled.class)
                .didNotFind("spring security disabled").atAll();
    }

    return ConditionOutcome.match(matchMessage);
}