Examples of required()


Examples of org.constretto.annotation.Configuration.required()

            if (parameterAnnotations.length != 0) {
                for (Annotation parameterAnnotation : parameterAnnotations) {
                    if (parameterAnnotation.annotationType() == Configuration.class) {
                        Configuration configurationAnnotation = (Configuration) parameterAnnotation;
                        expression = configurationAnnotation.value();
                        required = configurationAnnotation.required();
                        if (hasAnnotationDefaults(configurationAnnotation)) {
                            if (configurationAnnotation.defaultValueFactory().equals(Configuration.EmptyValueFactory.class)) {
                                defaultValue = ValueConverterRegistry.convert(parameterTargetClass, parameterTargetClass, new CPrimitive(configurationAnnotation.defaultValue()));
                            } else {
                                ConfigurationDefaultValueFactory valueFactory = configurationAnnotation.defaultValueFactory().newInstance();
View Full Code Here

Examples of org.focusns.common.web.widget.annotation.bind.WidgetAttribute.required()

        Class<?> widgetClass = parameter.getMethod().getDeclaringClass();
        WidgetAttribute widgetAttribute = parameter.getParameterAnnotation(WidgetAttribute.class);
        if (widgetAttribute != null) {
            String widgetAttributeName = getWidgetAttributeName(parameter, widgetAttribute);
            Object value = webRequest.getAttribute(widgetAttributeName, WebRequest.SCOPE_REQUEST);
            if (widgetAttribute.required()) {
                Assert.notNull(value, String.format("%s attribute %s can not be null!", widgetClass, widgetAttributeName));
            }
            return value;
        }
        //
View Full Code Here

Examples of org.focusns.common.web.widget.annotation.bind.WidgetPref.required()

                Object value = widgetConfig.getPreferences().get(widgetPreferenceName);
                if (StringUtils.hasText(defaultValue) && value == null) {
                    value = defaultValue;
                }
                //
                if (widgetPreference.required()) {
                    Assert.notNull(value, String.format("Widget preference %s can not be null!", value));
                }
                //
                return value;
            }
View Full Code Here

Examples of org.internna.iwebmvc.core.validation.annotation.BeanConstraint.required()

    protected Set<ValidationError> validateBeanConstraint(final Field field, final Object bean) {
        Set<ValidationError> errors = new HashSet<ValidationError>();
        BeanConstraint beanConstraint = field.getAnnotation(BeanConstraint.class);
        if (beanConstraint != null) {
            if (beanConstraint.required() & (bean == null)) errors.add(new ValidationError(field.getName(), errorCodes[0], beanConstraint, bean));
            if ((bean != null) && (beanConstraint.traverse())) {
                Collection<ValidationError> deepErrors = this.visit(bean);
                for (ValidationError error : deepErrors) error.addPath(field.getName());
                errors.addAll(deepErrors);
            }
View Full Code Here

Examples of org.internna.iwebmvc.core.validation.annotation.CollectionConstraint.required()

    @SuppressWarnings("unchecked")
    protected Set<ValidationError> validateCollectionConstraint(final Field field, final Object collection) {
        Set<ValidationError> errors = new HashSet<ValidationError>();
        CollectionConstraint collectionConstraint = field.getAnnotation(CollectionConstraint.class);
        if (collectionConstraint != null) {
            if (collectionConstraint.required() & (collection == null)) errors.add(new ValidationError(field.getName(), errorCodes[0], collectionConstraint, collection));
            if (collection != null) {
                if (Collection.class.isInstance(collection)) {
                    Collection<?> col = (Collection<?>) collection;
                    if (collectionConstraint.traverse()) {
                        Collection<ValidationError> deepErrors = new HashSet<ValidationError>();
View Full Code Here

Examples of org.internna.iwebmvc.core.validation.annotation.DateConstraint.required()

     */
    protected Set<ValidationError> validateDateConstraint(final Field field, final Object object) {
        final DateConstraint dateConstraint = field.getAnnotation(DateConstraint.class);
        Set<ValidationError> errors = new HashSet<ValidationError>();
        if (dateConstraint != null) {
            if (dateConstraint.required() & (object == null)) errors.add(new ValidationError(field.getName(), errorCodes[0], dateConstraint, object));
            if (object != null) {
                Calendar min = dateConstraint.minValue().getDate(false);
                Calendar max = dateConstraint.maxValue().getDate(true);
                Calendar date = Calendar.getInstance();
                date.setTime((Date) object);
View Full Code Here

Examples of org.internna.iwebmvc.core.validation.annotation.NumberConstraint.required()

    protected Set<ValidationError> validateNumericConstraint(final Field field, final Object object) {
        final NumberConstraint numberConstraint = field.getAnnotation(NumberConstraint.class);
        Set<ValidationError> errors = new HashSet<ValidationError>();
        if (numberConstraint != null) {
            if (numberConstraint.required() & (object == null)) errors.add(new ValidationError(field.getName(), errorCodes[0], numberConstraint, object));
            if (object != null) {
                double numericValue = ((Number) object).doubleValue();
                if (numberConstraint.minValue() > numericValue) errors.add(new ValidationError(field.getName(), errorCodes[2], numberConstraint, object));
                if (numberConstraint.maxValue() < numericValue) errors.add(new ValidationError(field.getName(), errorCodes[3], numberConstraint, object));
            }
View Full Code Here

Examples of org.internna.iwebmvc.core.validation.annotation.StringConstraint.required()

     */
    protected Set<ValidationError> validateStringConstraint(final Field field, final Object object) {
        final StringConstraint stringConstraint = field.getAnnotation(StringConstraint.class);
        Set<ValidationError> errors = new HashSet<ValidationError>();
        if (stringConstraint != null) {
            if (stringConstraint.required() & (object == null)) errors.add(new ValidationError(field.getName(), errorCodes[0], stringConstraint, object));
            if ((object != null) & (stringConstraint.regexp().length() > 0)) {
                try {
                    Pattern pattern = Pattern.compile(stringConstraint.regexp());
                    Matcher matcher = pattern.matcher(object.toString());
                    if (!matcher.matches()) errors.add(new ValidationError(field.getName(), errorCodes[1], stringConstraint, object));
View Full Code Here

Examples of org.jboss.aesh.cl.Option.required()

                    optionType = OptionType.NORMAL;
                else
                    optionType = OptionType.BOOLEAN;
                if(o.name() == null || o.name().length() < 1) {
                    processedCommand.addOption(o.shortName(), field.getName(), o.description(),
                            o.argument(), o.required(), ',', o.defaultValue(),
                            field.getType(), field.getName(), optionType, o.converter(),
                            o.completer(), o.validator(), o.activator(), o.renderer(), o.overrideRequired());
                }
                else {
                    processedCommand.addOption(o.shortName(), o.name(), o.description(),
View Full Code Here

Examples of org.jboss.aesh.cl.OptionGroup.required()

                    ParameterizedType listType = (ParameterizedType) field.getGenericType();
                    type = (Class) listType.getActualTypeArguments()[1];
                }
                if(og.name() == null || og.name().length() < 1) {
                    processedCommand.addOption(og.shortName(), field.getName(), og.description(),
                            "", og.required(), ',', og.defaultValue(), type, field.getName(), OptionType.GROUP,
                            og.converter(), og.completer(), og.validator(), og.activator(), og.renderer());
                }
                else {
                    processedCommand.addOption(og.shortName(), og.name(), og.description(),
                            "", og.required(), ',', og.defaultValue(), type, field.getName(), OptionType.GROUP,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.