List of usage examples for org.springframework.util Assert isTrue
public static void isTrue(boolean expression, Supplier<String> messageSupplier)
From source file:org.springmodules.validation.util.condition.collection.MaxSizeCollectionCondition.java
/** * Constructs a new MaxSizeCollectionCondition with a given maximum size. * * @param maxSize The maximum size.//from w w w .j a v a 2s . com */ public MaxSizeCollectionCondition(int maxSize) { Assert.isTrue(maxSize >= 0, "Max size cannot be negative"); this.maxSize = maxSize; }
From source file:org.springmodules.validation.util.condition.collection.MinSizeCollectionCondition.java
/** * Constructs a new MinSizeCollectionCondition with a given minimum size. * * @param minSize The minimum size.// ww w . j a va 2s. c o m */ public MinSizeCollectionCondition(int minSize) { Assert.isTrue(minSize >= 0, "Min size cannot be negative"); this.minSize = minSize; }
From source file:com.nortal.petit.orm.statement.UpdateStatement.java
public UpdateStatement(JdbcOperations jdbcTemplate, StatementBuilder statementBuilder, B... beans) { Assert.isTrue(ArrayUtils.isNotEmpty(beans), "UpdateStatement.construct: beans are mandatory"); this.beans = Arrays.asList(beans); super.init(jdbcTemplate, statementBuilder, (Class<B>) beans[0].getClass()); setBy(StatementUtil.toStringArray(getWritableProps(getMapping()))); }
From source file:org.springmodules.validation.util.condition.string.MinLengthStringCondition.java
/** * Creates a new MinLengthStringCondition with a given minimum length that the checked strings will be checked against. * * @param minLength The minimum length that the checked strings will be checked against. *///w w w. j a v a2s . c o m public MinLengthStringCondition(int minLength) { Assert.isTrue(minLength >= 0, "Given minimum length must be a non-negative value"); this.minLength = minLength; }
From source file:com.sishuok.bigpipe.PageletResult.java
public PageletResult cssUrl(String... cssUrls) { Assert.isTrue(this.isFrameResult == false, "only be not frame result has css url"); this.cssUrls = cssUrls; return this; }
From source file:gov.nyc.doitt.gis.geoclient.parser.regex.UnrecognizedTextParser.java
@Override public void parse(ParseContext parseContext) { Chunk currentChunk = parseContext.getCurrent(); Matcher matcher = ANYTHING.matcher(currentChunk.getText()); Assert.isTrue(matcher.matches(), String.format("Pattern %s should match any input but it doesn't match '%s'", ANYTHING.pattern(), currentChunk.getText())); MatchBuilder builder = new MatchBuilder().add(matcher).add(MatchType.COMPLETE).add(parseContext) .add(ANYTHING, 1, TokenType.UNRECOGNIZED); handleMatch(builder.build(), ChunkType.UNRECOGNIZED); }
From source file:com.creactiviti.piper.core.taskhandler.random.Rogue.java
@Override public Object handle(Task aTask) throws Exception { float nextFloat = RandomUtils.nextFloat(0, 1); float probabilty = aTask.getFloat("probabilty", 0.5f); Assert.isTrue(probabilty >= 0 && probabilty <= 1, "probability must be a value between 0 and 1"); if (nextFloat <= probabilty) { throw new IllegalStateException("I'm a rogue exception"); }/* w w w.java 2 s. co m*/ return null; }
From source file:org.cleverbus.api.event.FailedMsgAsynchEvent.java
/** * Creates new event.//from w ww .j a v a2 s. co m * * @param exchange the exchange * @param message the message */ public FailedMsgAsynchEvent(Exchange exchange, Message message) { super(exchange, message); Assert.isTrue(message.getState() == MsgStateEnum.FAILED, "the message must be in the state " + MsgStateEnum.FAILED); }
From source file:org.cleverbus.api.event.WaitingMsgAsynchEvent.java
/** * Creates new event.// w ww . j a va 2 s . c om * * @param exchange the exchange * @param message the message */ public WaitingMsgAsynchEvent(Exchange exchange, Message message) { super(exchange, message); Assert.isTrue(message.getState() == MsgStateEnum.WAITING, "the message must be in the state " + MsgStateEnum.WAITING); }
From source file:org.cleverbus.api.event.PostponedMsgAsynchEvent.java
/** * Creates new event./*from ww w.ja va2 s. c o m*/ * * @param exchange the exchange * @param message the message */ public PostponedMsgAsynchEvent(Exchange exchange, Message message) { super(exchange, message); Assert.isTrue(message.getState() == MsgStateEnum.POSTPONED, "the message must be in the state " + MsgStateEnum.POSTPONED); }