本文整理汇总了Java中org.apache.wicket.util.lang.Args.notNull方法的典型用法代码示例。如果您正苦于以下问题:Java Args.notNull方法的具体用法?Java Args.notNull怎么用?Java Args.notNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.wicket.util.lang.Args
的用法示例。
在下文中一共展示了Args.notNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConnection
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
@Override
public IWebSocketConnection getConnection(Application application, String sessionId, IKey key)
{
Args.notNull(application, "application");
Args.notNull(sessionId, "sessionId");
Args.notNull(key, "key");
IWebSocketConnection connection = null;
ConcurrentMap<String, ConcurrentMap<IKey, IWebSocketConnection>> connectionsBySession = application.getMetaData(KEY);
if (connectionsBySession != null)
{
ConcurrentMap<IKey, IWebSocketConnection> connectionsByPage = connectionsBySession.get(sessionId);
if (connectionsByPage != null)
{
connection = connectionsByPage.get(key);
}
}
return connection;
}
示例2: getConnections
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
@Override
public Collection<IWebSocketConnection> getConnections(Application application, String sessionId)
{
Args.notNull(application, "application");
Args.notNull(sessionId, "sessionId");
Collection<IWebSocketConnection> connections = Collections.emptyList();
ConcurrentMap<String, ConcurrentMap<IKey, IWebSocketConnection>> connectionsBySession = application.getMetaData(KEY);
if (connectionsBySession != null)
{
ConcurrentMap<IKey, IWebSocketConnection> connectionsByPage = connectionsBySession.get(sessionId);
if (connectionsByPage != null)
{
connections = connectionsByPage.values();
}
}
return connections;
}
示例3: inject
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
protected <T> void inject(PageParameters targetParameters, ILinkParameterConversionService conversionService, String parameterName, T mappedValue)
throws LinkParameterInjectionException {
Args.notNull(targetParameters, "targetParameters");
Args.notNull(conversionService, "conversionService");
String parameterValue = null;
if (mappedValue != null) {
try {
parameterValue = conversionService.convert(mappedValue, String.class);
} catch (ConversionException e) {
throw new LinkParameterInjectionException("Error converting the value of parameter " + parameterName, e);
}
if (parameterValue != null) {
targetParameters.add(parameterName, parameterValue);
}
}
}
示例4: startComponentInForm
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
/**
* Process a component. A web page will be automatically created with the {@code pageMarkup}
* provided. In case pageMarkup is null, the markup will be automatically created with
* {@link #createFormPageMarkup(String, String)}.
* <p>
* <strong>Note</strong>: the instantiated component will have an auto-generated id. To
* reach any of its children use their relative path to the component itself. For example
* if the started component has a child a Link component with id "link" then after starting
* the component you can click it with: <code>tester.clickLink("link")</code>
* </p>
*
* @param <C>
* the type of the component
*
* @param componentClass
* the class of the component to be tested
* @param inputType
* the type of HTML input to be associated with the component to be tested
* @param pageMarkup
* the markup for the Page that will be automatically created. May be {@code null}.
* @return The component processed
*/
@SuppressWarnings("deprecation")
public final <C extends Component> C startComponentInForm(final Class<C> componentClass,
final String inputType, final IMarkupFragment pageMarkup)
{
Args.notNull(componentClass, "componentClass");
// Create the component instance from the class
C comp = null;
try
{
Constructor<C> c = componentClass.getConstructor(String.class);
comp = c.newInstance(ComponentInForm.ID);
componentInForm = new ComponentInForm();
componentInForm.component = comp;
componentInForm.isInstantiated = true;
}
catch (Exception e)
{
fail(String.format("Cannot instantiate component with type '%s' because of '%s'",
componentClass.getName(), e.getMessage()));
}
// process the component
return startComponentInForm(comp, inputType, pageMarkup);
}
示例5: install
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
/**
* Install Leaflet with given settings to application.
* If application already has Leaflet installed, it ignores new settings.
*
* @param application application, which Leaflet should be bounded to.
* @param settings custom settings, which are used to initialized library
* @throws IllegalArgumentException if application is {@code null}.
*/
public static void install(WebApplication application, LeafletSettings settings) {
// install Leaflet.js with given configuration
Args.notNull(application, "application");
if (application.getMetaData(LEAFLET_SETTINGS_KEY) == null) {
LeafletSettings settingsOrDefault = settings != null ? settings : new DefaultLeafletSettings();
application.setMetaData(LEAFLET_SETTINGS_KEY, settingsOrDefault);
if (settingsOrDefault.autoAppendResources()) {
application.getComponentInstantiationListeners().add(new LeafletResourceAppender());
}
if (settingsOrDefault.useWebJars()) {
WicketWebjars.install(application);
}
}
}
示例6: createClient
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
/**
* Creates MemcachedClient with the provided hostname and port
* in the settings
*
* @param settings The configuration for the client
* @return A MemcachedClient
*/
private static MemcachedClient createClient(IMemcachedSettings settings)
{
Args.notNull(settings, "settings");
String host = settings.getHost();
Checks.notEmptyShort(host, "host");
int port = settings.getPort();
Checks.withinRangeShort(1, 65535, port, "port");
try
{
MemcachedClient memcachedClient = new MemcachedClient(new InetSocketAddress(host, port));
return memcachedClient;
}
catch (IOException iox)
{
throw new RuntimeException(iox);
}
}
示例7: inject
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
@Override
public void inject(PageParameters targetParameters, ILinkParameterConversionService conversionService)
throws LinkParameterInjectionException {
Args.notNull(targetParameters, "targetParameters");
Args.notNull(conversionService, "conversionService");
Artifact artifact = artifactModel.getObject();
if (artifact != null) {
if (artifact.getGroup() != null && artifact.getGroup().getGroupId() != null) {
targetParameters.add(GROUP_ID_PARAMETER, artifact.getGroup().getGroupId());
}
if (artifact.getArtifactId() != null) {
targetParameters.add(ARTIFACT_ID_PARAMETER, artifact.getArtifactId());
}
}
}
示例8: extract
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
@Override
public void extract(PageParameters sourceParameters, ILinkParameterConversionService conversionService)
throws LinkParameterExtractionException {
Args.notNull(sourceParameters, "sourceParameters");
Args.notNull(conversionService, "conversionService");
String groupId = sourceParameters.get(GROUP_ID_PARAMETER).toString();
String artifactId = sourceParameters.get(ARTIFACT_ID_PARAMETER).toString();
Artifact artifact = null;
if (groupId != null && artifactId != null) {
ArtifactKey artifactKey = new ArtifactKey(groupId, artifactId);
try {
artifact = conversionService.convert(artifactKey, Artifact.class);
} catch (ConversionException e) {
throw new LinkParameterExtractionException(e);
}
}
artifactModel.setObject(artifact);
}
示例9: AbstractWebSocketProcessor
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
/**
* Constructor.
*
* @param request
* the http request that was used to create the TomcatWebSocketProcessor
* @param application
* the current Wicket Application
*/
public AbstractWebSocketProcessor(final HttpServletRequest request, final WebApplication application)
{
this.sessionId = request.getSession(true).getId();
String pageId = request.getParameter("pageId");
resourceName = request.getParameter("resourceName");
if (Strings.isEmpty(pageId) && Strings.isEmpty(resourceName))
{
throw new IllegalArgumentException("The request should have either 'pageId' or 'resourceName' parameter!");
}
if (Strings.isEmpty(pageId) == false)
{
this.pageId = Integer.parseInt(pageId, 10);
}
else
{
this.pageId = NO_PAGE_ID;
}
String baseUrl = request.getParameter(WebRequest.PARAM_AJAX_BASE_URL);
Checks.notNull(baseUrl, String.format("Request parameter '%s' is required!", WebRequest.PARAM_AJAX_BASE_URL));
this.baseUrl = Url.parse(baseUrl);
WicketFilter wicketFilter = application.getWicketFilter();
this.servletRequest = new ServletRequestCopy(request);
this.application = Args.notNull(application, "application");
this.webSocketSettings = WebSocketSettings.Holder.get(application);
this.webRequest = webSocketSettings.newWebSocketRequest(request, wicketFilter.getFilterPath());
this.connectionRegistry = webSocketSettings.getConnectionRegistry();
this.connectionFilter = webSocketSettings.getConnectionFilter();
}
示例10: WebSocketConnection
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
/**
* Constructor.
*
* @param session
* the jetty websocket connection
*/
public WebSocketConnection(Session session, AbstractWebSocketProcessor webSocketProcessor, PageKey pageKey)
{
super(webSocketProcessor);
this.session = Args.notNull(session, "connection");
this.pageKey = pageKey;
}
示例11: StaticResourceMapper
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
public StaticResourceMapper(String path, Class<?> scope) {
Args.notEmpty(path, "path");
Args.notNull(scope, "scope");
this.scope = scope;
this.mountSegments = getMountSegments(path);
}
示例12: SimpleMandatoryCollectionLinkParameterValidator
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
public SimpleMandatoryCollectionLinkParameterValidator(Collection<String> parameterNames,
Collection<? extends IModel<? extends Collection>> parameterModels) {
Args.notNull(parameterNames, "parameterNames");
Args.notNull(parameterModels, "parameterModels");
this.parameterNames = ImmutableList.copyOf(parameterNames);
this.parameterModels = ImmutableList.copyOf(parameterModels);
}
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:8,代码来源:SimpleMandatoryCollectionLinkParameterValidator.java
示例13: buildUrl
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
@Deprecated
protected String buildUrl(final IRequestHandler requestHandler, final String anchor) {
Args.notNull(requestHandler, "requestHandler");
try (ITearDownHandle handle = wicketContextProvider.context().open()) {
StringBuilder url = new StringBuilder();
url.append(RequestCycle.get().getUrlRenderer().renderFullUrl(Url.parse(RequestCycle.get().urlFor(requestHandler))));
if (StringUtils.hasText(anchor)) {
url.append(ANCHOR_ROOT).append(anchor);
}
return url.toString();
}
}
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:15,代码来源:AbstractNotificationUrlBuilderServiceImpl.java
示例14: checkSerialized
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
/**
* Checks that the serialized form of the parameters is valid according to a validator, throwing a {@link LinkParameterSerializedFormValidationException} if it is not.
* @throws LinkParameterSerializedFormValidationException if the serialized form of the parameters is invalid according to the validator.
* @throws NullPointerException if <code>parameters</code> or <code>validator</code> is null.
*/
public static void checkSerialized(PageParameters parameters, ILinkParameterValidator validator) throws LinkParameterSerializedFormValidationException {
Args.notNull(parameters, "parameters");
Args.notNull(validator, "validator");
LinkParameterValidationErrorCollector collector = new LinkParameterValidationErrorCollector();
validator.validateSerialized(parameters, collector);
Collection<ILinkParameterValidationErrorDescription> errors = collector.getErrors();
if ( ! errors.isEmpty() ) {
throw new LinkParameterSerializedFormValidationException(parameters, errors);
}
}
示例15: factory
import org.apache.wicket.util.lang.Args; //导入方法依赖的package包/类
public static <T> ILinkParameterMappingEntryFactory<Unit<IModel<T>>> factory(final String parameterName,
final Supplier<? extends TypeDescriptor> typeDescriptorSupplier) {
Args.notNull(parameterName, "parameterName");
Args.notNull(typeDescriptorSupplier, "typeDescriptorSupplier");
return new AbstractLinkParameterMappingEntryFactory<Unit<IModel<T>>>() {
private static final long serialVersionUID = 1L;
@Override
public ILinkParameterMappingEntry create(Unit<IModel<T>> parameters) {
return new SimpleLinkParameterMappingEntry<T>(
parameterName, parameters.getValue0(), typeDescriptorSupplier
);
}
};
}