本文整理汇总了Java中org.apache.wicket.util.lang.Args类的典型用法代码示例。如果您正苦于以下问题:Java Args类的具体用法?Java Args怎么用?Java Args使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Args类属于org.apache.wicket.util.lang包,在下文中一共展示了Args类的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: fromConditionFactory
import org.apache.wicket.util.lang.Args; //导入依赖的package包/类
public static <T extends Tuple> ILinkParameterValidatorFactory<T> fromConditionFactory(
final IDetachableFactory<T, ? extends Condition> conditionFactory) {
Args.notNull(conditionFactory, "conditionFactory");
return new AbstractLinkParameterValidatorFactory<T>() {
private static final long serialVersionUID = 1L;
@Override
public ILinkParameterValidator create(T parameters) {
return new ConditionLinkParameterValidator(conditionFactory.create(parameters));
}
@Override
public void detach() {
super.detach();
conditionFactory.detach();
}
};
}
示例4: 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);
}
}
}
示例5: extract
import org.apache.wicket.util.lang.Args; //导入依赖的package包/类
protected <T> T extract(PageParameters sourceParameters, ILinkParameterConversionService conversionService, String parameterName, Class<? extends T> mappedType)
throws LinkParameterExtractionException {
Args.notNull(sourceParameters, "sourceParameters");
Args.notNull(conversionService, "conversionService");
String parameterValue = sourceParameters.get(parameterName).toString();
T mappedValue = null;
if (parameterValue != null) {
try {
mappedValue = conversionService.convert(parameterValue, mappedType);
} catch (ConversionException e) {
throw new LinkParameterExtractionException("Error converting the value of parameter " + parameterName, e);
}
}
return mappedValue;
}
示例6: AbstractOneOrMoreMappableParameterMainStateImpl
import org.apache.wicket.util.lang.Args; //导入依赖的package包/类
public AbstractOneOrMoreMappableParameterMainStateImpl(
AbstractOneOrMoreMappableParameterMainStateImpl<
?,
TEarlyTargetDefinitionLinkDescriptor,
TLateTargetDefinitionPageLinkDescriptor,
TLateTargetDefinitionResourceLinkDescriptor,
TLateTargetDefinitionImageResourceLinkDescriptor
> previousState,
LinkParameterTypeInformation<?> addedParameterType, int expectedNumberOfParameters) {
super(previousState);
this.dynamicParameterTypes = ImmutableList.<LinkParameterTypeInformation<?>>builder()
.addAll(previousState.dynamicParameterTypes).add(addedParameterType).build();
Args.withinRange(
expectedNumberOfParameters, expectedNumberOfParameters,
dynamicParameterTypes.size(), "dynamicParameterTypes.size()"
);
}
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:18,代码来源:AbstractOneOrMoreMappableParameterMainStateImpl.java
示例7: AnimatedGlobalFeedbackPanel
import org.apache.wicket.util.lang.Args; //导入依赖的package包/类
/**
* @param id Id wicket.
* @param autohideDelay Délai de fermeture automatique, en secondes.
* Si < 0 : le feedback ne se cache pas automatiquement
*/
public AnimatedGlobalFeedbackPanel(String id, Integer autohideDelayValue, TimeUnit autohideDelayUnit) {
super(id);
setOutputMarkupId(true);
this.autohideDelayValue = autohideDelayValue != null ? autohideDelayValue : propertyService.get(GLOBAL_FEEDBACK_AUTOHIDE_DELAY_VALUE);
this.autohideDelayUnit = autohideDelayUnit != null ? autohideDelayUnit : propertyService.get(GLOBAL_FEEDBACK_AUTOHIDE_DELAY_UNIT);
Args.notNull(this.autohideDelayValue, "autohideDelayValue");
Args.notNull(this.autohideDelayUnit, "autohideDelayUnit");
WebMarkupContainer closeTrigger = new WebMarkupContainer("closeTrigger");
add(closeTrigger);
closeTrigger.add(new CloseAlertBehavior());
// To retrieve main panel on close event.
add(new ClassAttributeAppender(new Model<String>("animated-global-feedback")));
}
示例8: validateFormModelValidator
import org.apache.wicket.util.lang.Args; //导入依赖的package包/类
private void validateFormModelValidator(IFormModelValidator validator) {
Args.notNull(validator, "validator");
final FormComponent<?>[] dependents = validator.getDependentFormComponents();
boolean validate = true;
if (dependents != null) {
for (final FormComponent<?> dependent : dependents) {
if (!dependent.isValid() || !dependent.isVisibleInHierarchy()) {
validate = false;
break;
}
}
}
if (validate) {
validator.validate(this);
}
}
示例9: ArtifactoryWebRequest
import org.apache.wicket.util.lang.Args; //导入依赖的package包/类
/**
* Construct.
*
* @param httpServletRequest
* @param filterPrefix contentPath + filterPath, used to extract the actual {@link Url}
* @param url
*/
public ArtifactoryWebRequest(HttpServletRequest httpServletRequest, String filterPrefix, Url url) {
super(httpServletRequest, filterPrefix, null);
Args.notNull(httpServletRequest, "httpServletRequest");
Args.notNull(filterPrefix, "filterPrefix");
this.httpServletRequest = httpServletRequest;
this.filterPrefix = filterPrefix;
errorAttributes = ErrorAttributes.of(httpServletRequest);
forwardAttributes = ForwardAttributes.of(httpServletRequest);
if (url != null) {
this.url = url;
} else {
this.url = getContextRelativeUrl(httpServletRequest.getRequestURI(), filterPrefix);
}
}
示例10: checkQuietly
import org.apache.wicket.util.lang.Args; //导入依赖的package包/类
/**
* Checks the given value if it is between 0 to 100 quietly. If not a default value from 50 will
* be set.
*
* @param name
* the name
* @param value
* the value
* @return the integer
*/
private static Integer checkQuietly(final String name, final Integer value)
{
Integer val = 50;
try
{
val = Args.withinRange(0, 100, value, name);
}
catch (final IllegalArgumentException e)
{
LOGGER.error(String.format(
"Given argument '%s' must have a value within [%s,%s], but was %s. Default value 50% will be set.",
name, 0, 100, value));
}
return val;
}
示例11: StringTextValue
import org.apache.wicket.util.lang.Args; //导入依赖的package包/类
/**
* Instantiates a new {@link StringTextValue} object.
*
* @param name
* the name
* @param value
* the value
* @param stringTextType
* the string text type
* @param initialValue
* the flag if the initial value is also the default value. This flag is taken for
* the generation of javascript, if false this {@link StringTextValue} will be not
* added.
*/
@SuppressWarnings("unchecked")
public StringTextValue(final String name, final T value, final StringTextType stringTextType,
final boolean initialValue)
{
Args.notNull(stringTextType, "type");
this.value = value;
this.defaultValue = value;
this.type = stringTextType;
this.initialValue = initialValue;
this.name = name;
if (stringTextType.equals(StringTextType.BOOLEAN))
{
this.value = (T)Boolean.FALSE;
}
if (stringTextType.equals(StringTextType.STRING)
|| stringTextType.equals(StringTextType.STRING_INTEGER))
{
setQuotationMarkType(QuotationMarkType.SINGLE);
}
}
示例12: updateUserPassword
import org.apache.wicket.util.lang.Args; //导入依赖的package包/类
public boolean updateUserPassword(User user, final String password, final String passwordConfirmation) {
Args.notNull(user, "User may not be null!");
Args.notEmpty(password, "Password may not be null or empty!");
Args.
notEmpty(passwordConfirmation, "Password confirmation may not be null or empty!");
try {
byte[] salt = generateSalt();
byte[] encryptedPassword = getEncryptedPassword(password, salt);
user.setPassword(encryptedPassword);
user.setPwSalt(salt);
userService.update(user);
return true;
} catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
throw new RuntimeException("An unexpected error occurred!", e);
}
}
示例13: 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);
}
示例14: 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);
}
}
}
示例15: 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);
}
}