List of usage examples for org.springframework.util Assert notNull
public static void notNull(@Nullable Object object, Supplier<String> messageSupplier)
From source file:org.cleverbus.api.route.AbstractExtRoute.java
/** * Gets route ID for synchronous routes, specific for extension routes. * * @param service the service name * @param operationName the operation name * @return route ID/* ww w.j a v a 2 s. com*/ * @see #getRouteId(ServiceExtEnum, String) */ public static String getExtRouteId(ServiceExtEnum service, String operationName) { Assert.notNull(service, "the service must not be null"); Assert.hasText(operationName, "the operationName must not be empty"); return service.getServiceName() + "_" + operationName + EXT_ROUTE_SUFFIX; }
From source file:ctv.stageissue.SampleController.java
@Autowired public SampleController(JdbcTemplate jdbcTemplate) { Assert.notNull(jdbcTemplate, "CAN NOT BE null"); this.jdbcTemplate = jdbcTemplate; }
From source file:org.cloudfoundry.caldecott.server.tunnel.TunnelId.java
public TunnelId(String id) { Assert.notNull(id, "ID must not be null"); this.id = id; }
From source file:com.trenako.services.view.ItemView.java
/** * Creates a new item view for a {@code Collection} item. * * @param collection the rolling stocks collection * @param item the collection item * @return a {@code ItemView}/*from w w w. j ava 2 s. co m*/ */ public static ItemView createView(Collection collection, CollectionItem item) { Assert.notNull(item.getRollingStock(), "Item rolling stock is required"); return new ItemView(collection.getSlug(), "collection", item.getRollingStock().getSlug(), item.getRollingStock().getLabel(), item.getAddedAt()); }
From source file:com.orientechnologies.orient.jdbc.util.DataSourceContextHolder.java
/** * Sets the current data source context. * //from w ww . j a v a 2s . co m * @param lookupKey the current data source context. */ public static void setContext(String lookupKey) { Assert.notNull(lookupKey, "The lookup key of the data source context cannot be null."); CONTEXT_HOLDER.set(lookupKey); }
From source file:com.iflytek.edu.cloud.frame.doc.ClassUtils.java
public static boolean isPrimitiveOrWrapper(String typeName) { Assert.notNull(typeName, "typeName must not be null"); return primitiveWrapperList.contains(typeName); }
From source file:org.jasig.cas.authentication.AbstractAuthentication.java
public AbstractAuthentication(final Principal principal, final Map<String, Object> attributes) { Assert.notNull(principal, "principal cannot be null"); Assert.notNull(attributes, "attributes cannot be null"); this.principal = principal; this.attributes = attributes; }
From source file:org.personal.mason.addressbook.app.command.RemoveContactCommand.java
public RemoveContactCommand(ContactId contactId) { super(contactId); Assert.notNull(contactId, "Cannot remove a contact with an empty id"); }
From source file:org.javelin.sws.ext.utils.NamespaceUtils.java
/** * Converts package name to URL for namespace according to JAXB/JAX-WS conventions with separate domain and path fragments * //www. jav a 2 s .co m * @param pkg * @param domainComponentCount number of package components to be converted into domain part of URL. If zero than entire package will be a domain * @return */ public static String packageNameToNamespace(Package pkg, int domainComponentCount) { Assert.notNull(pkg, "Package should not be null"); Assert.isTrue(domainComponentCount != 1, "The domain part should not consist of one component. It may be zero or more than 1."); List<String> elements = new ArrayList<String>(Arrays.asList(pkg.getName().split("\\."))); if (domainComponentCount > 0) { List<String> domain = elements.subList(0, domainComponentCount); List<String> path = elements.subList(domainComponentCount, elements.size()); Collections.reverse(domain); return "http://" + StringUtils.collectionToDelimitedString(domain, ".") + "/" + StringUtils.collectionToDelimitedString(path, "/"); } else { Collections.reverse(elements); return "http://" + StringUtils.collectionToDelimitedString(elements, ".") + "/"; } }
From source file:at.pagu.soldockr.core.ResultHelper.java
static Map<Field, Page<FacetEntry>> convertFacetQueryResponseToFacetPageMap(FacetQuery query, QueryResponse response) {// w w w .j av a 2s . co m Assert.notNull(query, "Cannot convert response for 'null', query"); if (!query.hasFacetOptions() || response == null) { return Collections.emptyMap(); } Map<Field, Page<FacetEntry>> facetResult = new HashMap<Field, Page<FacetEntry>>(); if (CollectionUtils.isNotEmpty(response.getFacetFields())) { int initalPageSize = query.getFacetOptions().getPageable().getPageSize(); for (FacetField facetField : response.getFacetFields()) { if (facetField != null && StringUtils.isNotBlank(facetField.getName())) { Field field = new SimpleField(facetField.getName()); if (CollectionUtils.isNotEmpty(facetField.getValues())) { List<FacetEntry> pageEntries = new ArrayList<FacetEntry>(initalPageSize); for (Count count : facetField.getValues()) { if (count != null) { pageEntries.add(new SimpleFacetEntry(field, count.getName(), count.getCount())); } } facetResult.put(field, new FacetPage<FacetEntry>(pageEntries, query.getFacetOptions().getPageable(), facetField.getValueCount())); } else { facetResult.put(field, new FacetPage<FacetEntry>(Collections.<FacetEntry>emptyList(), query.getFacetOptions().getPageable(), 0)); } } } } return facetResult; }