Search in sources :

Example 1 with MetaFilterBase

use of io.crnk.meta.provider.MetaFilterBase in project crnk-framework by crnk-project.

the class ValidationMetaProvider method getFilters.

@Override
public Collection<MetaFilter> getFilters() {
    return Arrays.asList((MetaFilter) new MetaFilterBase() {

        @Override
        public void onInitialized(MetaElement element) {
            if (element instanceof MetaAttribute) {
                MetaAttribute attr = (MetaAttribute) element;
                NotNull notNull = attr.getAnnotation(NotNull.class);
                if (notNull != null) {
                    attr.setNullable(false);
                }
            }
        }
    });
}
Also used : MetaElement(io.crnk.meta.model.MetaElement) MetaAttribute(io.crnk.meta.model.MetaAttribute) MetaFilterBase(io.crnk.meta.provider.MetaFilterBase) NotNull(javax.validation.constraints.NotNull)

Aggregations

MetaAttribute (io.crnk.meta.model.MetaAttribute)1 MetaElement (io.crnk.meta.model.MetaElement)1 MetaFilterBase (io.crnk.meta.provider.MetaFilterBase)1 NotNull (javax.validation.constraints.NotNull)1