Example usage for org.springframework.util Assert isTrue

List of usage examples for org.springframework.util Assert isTrue

Introduction

In this page you can find the example usage for org.springframework.util Assert isTrue.

Prototype

public static void isTrue(boolean expression, Supplier<String> messageSupplier) 

Source Link

Document

Assert a boolean expression, throwing an IllegalArgumentException if the expression evaluates to false .

Usage

From source file:com.nortal.petit.orm.statement.DeleteStatement.java

public DeleteStatement(JdbcOperations jdbcTemplate, StatementBuilder statementBuilder, Class<B> beanClass) {
    Assert.isTrue(beanClass != null, "InsertStatement.construct: beanClass is mandatory");

    super.init(jdbcTemplate, statementBuilder, beanClass);
}

From source file:at.porscheinformatik.common.spring.web.extended.expression.ScriptExpressionHandler.java

@Override
public String process(String value) {
    Assert.notNull(scriptConfig, "No scriptstack defined");
    Assert.isTrue(scriptConfig.hasStack(value), "ScriptStack " + value + " not found");

    if (config.isOptimizeResources()) {
        return HtmlUtils.buildScriptLink(generateUrl("script/stack", value));
    } else {//from w  ww . j av a  2  s . com
        return buildDevelopmentScripts(value);
    }
}

From source file:org.apache.zeppelin.lens.LensSimpleExecutionStrategy.java

public Object execute(ParseResult parseResult) throws RuntimeException {
    Assert.notNull(parseResult, "Parse result required");
    logger.info("LensSimpleExecutionStrategy execute method invoked");
    synchronized (this) {
        Assert.isTrue(isReadyForCommands(), "SimpleExecutionStrategy not yet ready for commands");
        Object target = parseResult.getInstance();
        if (target instanceof ExecutionProcessor) {
            ExecutionProcessor processor = ((ExecutionProcessor) target);
            parseResult = processor.beforeInvocation(parseResult);
            try {
                Object result = invoke(parseResult);
                processor.afterReturningInvocation(parseResult, result);
                return result;
            } catch (Throwable th) {
                processor.afterThrowingInvocation(parseResult, th);
                return handleThrowable(th);
            }/* ww w.j a  va2 s .c om*/
        } else {
            return invoke(parseResult);
        }
    }
}

From source file:org.socialsignin.spring.data.dynamodb.query.MultipleEntityScanExpressionQuery.java

public void assertScanEnabled(boolean scanEnabled) {
    Assert.isTrue(scanEnabled, "Scanning for this query is not enabled.  "
            + "To enable annotate your repository method with @EnableScan, or "
            + "enable scanning for all repository methods by annotating your repository interface with @EnableScan");
}

From source file:com.oakhole.voa.service.UserServiceTest.java

@Test
public void testGetUserInfo() throws Exception {
    this.authService.generateAccessToken();
    UserInfo userInfo = this.userService.getUserInfo("otcWxuPvBN9GkjWufMtxuRl9YX_U");
    Assert.isTrue("0".equals(userInfo.getErrcode()), userInfo.getErrcode() + "," + userInfo.getErrmsg());
    System.out.println(userInfo.getNickname() + "," + userInfo.getCountry() + "," + userInfo.getProvince() + ","
            + userInfo.getCity());//from   www . ja v  a  2 s . c  o m
}

From source file:com.sishuok.bigpipe.PageletResult.java

public PageletResult jsUrl(String... jsUrls) {
    Assert.isTrue(this.isFrameResult == false, "only be not frame result has js url");
    this.jsUrls = jsUrls;
    return this;
}

From source file:slina.mb.smb.DefaultSmbSessionFactory.java

@Override
public Session getSession() {
    Assert.notNull(this.domain, "domain must not be null");
    Assert.hasText(this.user, "user must not be empty");
    Assert.isTrue(StringUtils.hasText(this.password), "password is required");
    try {//from   ww  w  .j a  va2  s  . co  m
        NtlmPasswordAuthentication ntlmAuth = new NtlmPasswordAuthentication(domain, user, password);
        Session smbSession = new SmbSessionImpl(ntlmAuth);
        return smbSession;
    } catch (Exception e) {
        throw new IllegalStateException("failed to create SMB Session", e);
    }
}

From source file:org.mitre.openid.connect.filter.MultiUrlRequestMatcher.java

public MultiUrlRequestMatcher(Set<String> filterProcessesUrls) {
    for (String filterProcessesUrl : filterProcessesUrls) {
        Assert.hasLength(filterProcessesUrl, "filterProcessesUrl must be specified");
        Assert.isTrue(UrlUtils.isValidRedirectUrl(filterProcessesUrl),
                filterProcessesUrl + " isn't a valid redirect URL");
    }/* w  ww .  ja  v  a2s.  co m*/
    this.filterProcessesUrls = ImmutableSet.copyOf(filterProcessesUrls);
}

From source file:org.springmodules.validation.util.condition.collection.AtLeastCollectionCondition.java

/**
 * Constructs a new AtLeastCollectionCondition with a given element condition.
 *
 * @param elementCondition The condition to be checked on the collection elements.
 *//*  w  w  w .java2  s.  c  o m*/
public AtLeastCollectionCondition(Condition elementCondition, int count) {
    super(elementCondition);
    Assert.isTrue(count >= 0, "Count cannot be negative");
    this.count = count;
}

From source file:org.springmodules.validation.util.io.FileIterator.java

public FileIterator(File dir, FileFilter filter) {
    Assert.isTrue(dir.isDirectory(), "Given file must be a directory");
    fileIterator = new ArrayIterator(dir.listFiles(filter));
}