Codota Logo
org.apache.bval.model
Code IndexAdd Codota to your IDE (free)

How to use org.apache.bval.model

Best Java code snippets using org.apache.bval.model (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: org.apache.bval/bval-core

  /**
   * Validate a single property only. Performs all validations
   * for this property.
   */
  public static <VL extends ValidationListener> void validateProperty(ValidationContext<VL> context) {
    for (Validation validation : context.getMetaProperty().getValidations()) {
      validation.validate(context);
    }
  }
}
origin: org.apache.bval/bval-xstream

protected <T extends ValidationListener> void validateMandatory(ValidationContext<T> context) {
  if (context.getMetaProperty().isMandatory()) {
    if (context.getPropertyValue() == null) {
      context.getListener().addError(MANDATORY, context);
    }
  }
}
origin: org.apache.bval/bval-jsr303

/**
 * Initialize from {@link ValidationContext}.
 */
public void init() {
  this.rawType = validationContext.getMetaBean().getBeanClass();
  this.type = this.rawType;
}
origin: org.apache.bval/bval-xstream

protected <T extends ValidationListener> void validateMaxValue(ValidationContext<T> context) {
  @SuppressWarnings("unchecked")
  Comparable<Object> maxValue = (Comparable<Object>) context.getMetaProperty().getFeature(MAX_VALUE);
  if (maxValue == null || context.getPropertyValue() == null)
    return;
  if (compare(context, maxValue, context.getPropertyValue()) < 0) {
    context.getListener().addError(MAX_VALUE, context);
  }
}
origin: org.apache.bval/bval-xstream

protected MetaProperty enrichElement(MetaBean meta, XMLMetaElement xmlProp, XMLResult result) throws Exception {
  MetaProperty prop = meta.getProperty(xmlProp.getName());
  if (prop == null) {
    prop = new MetaProperty();
    prop.setName(xmlProp.getName());
    meta.putProperty(xmlProp.getName(), prop);
  }
  xmlProp.mergeInto(prop);
  enrichValidations(prop, xmlProp, result, true);
  return prop;
}
origin: org.apache.bval/bval-core

/**
 * Validate a single bean only, no related beans will be validated.
 */
public static <VL extends ValidationListener> void validateBean(ValidationContext<VL> context) {
  // execute all property level validations
  for (MetaProperty prop : context.getMetaBean().getProperties()) {
    context.setMetaProperty(prop);
    validateProperty(context);
  }
  // execute all bean level validations
  context.setMetaProperty(null);
  for (Validation validation : context.getMetaBean().getValidations()) {
    validation.validate(context);
  }
}
origin: org.apache.bval/bval-xstream

protected void computeRelationships(MetaBean beanInfo, Map<String, MetaBean> cached) {
  for (MetaProperty prop : beanInfo.getProperties()) {
    String beanRef = (String) prop.getFeature(REF_BEAN_ID);
    if (beanRef != null) {
      prop.setMetaBean(cached.get(beanRef));
    }
  }
}
origin: org.apache.bval/bval-core

/**
 * Compute all known relationships for <code>beanInfo</code>. must be called
 * AFTER cache.cache() to avoid endless loop
 * 
 * @param beanInfo
 *            - the bean for which to compute relationships
 */
protected void computeRelationships(MetaBean beanInfo) {
  for (final MetaProperty prop : beanInfo.getProperties()) {
    final String beanRef = prop.getFeature(REF_BEAN_ID);
    computeRelatedMetaBean(prop, beanRef);
  }
}
origin: org.apache.bval/bval-core

/**
 * Resolve the type of this property to a class.
 * @return Class, <code>null</code> if cannot be determined
 */
public Class<?> getTypeClass() {
  Type targetType = type instanceof DynaType ? ((DynaType) type).getRawType() : type;
  if (targetType == null) {
    return null;
  }
  Type assigningType = getParentMetaBean() == null ? null : getParentMetaBean().getBeanClass();
  return TypeUtils.getRawType(targetType, assigningType);
}
origin: org.apache.bval/bval-jsr303

/**
 * Create a new BeanDescriptorImpl instance.
 * 
 * @param factoryContext
 * @param metaBean
 */
protected BeanDescriptorImpl(ApacheFactoryContext factoryContext, MetaBean metaBean) {
  super(metaBean, metaBean.getBeanClass(), metaBean.getValidations());
  this.factoryContext = factoryContext;
}
origin: org.apache.bval/bval-jsr303

  /**
   * {@inheritDoc}
   */
  public <T extends Annotation> void performAppend(ConstraintValidation<T> validation) {
    feature.addValidation(validation);
  }
}
origin: org.apache.bval/bval-core

/**
 * Get the specified feature.
 * 
 * @param <T>
 * @param key
 * @return T
 */
public <T> T getFeature(String key) {
  return getFeature(key, (T) null);
}
origin: org.apache.bval/bval-core

/**
 * Convenience method to access metaProperty.name
 *
 * @return null or the name of the current property
 */
@Override
public String getPropertyName() {
  return metaProperty == null ? null : metaProperty.getName();
}
origin: org.apache.bval/bval-jsr303

/**
 * Create a new ConstructorDescriptorImpl instance.
 * @param metaBean
 * @param validations
 */
protected ConstructorDescriptorImpl(MetaBean metaBean, Validation[] validations) {
  super(metaBean, metaBean.getBeanClass(), validations);
}
origin: org.apache.bval/bval-core

/**
 * Create an Error object.
 * @param reason
 * @param owner
 * @param propertyName
 * @return new {@link Error}
 */
protected Error createError(String reason, Object owner, String propertyName) {
  return new Error(reason, owner, propertyName);
}
origin: org.apache.bval/bval-core

/**
 * @param <VL>
 * @param context
 *            The current validation context.
 * @return the current {@link DynamicMetaBean} in context, or
 *         <code>null</code> if the current meta bean is not dynamic.
 */
private static <VL extends ValidationListener> DynamicMetaBean getDynamicMetaBean(ValidationContext<VL> context) {
  return context.getMetaBean() instanceof DynamicMetaBean ? (DynamicMetaBean) context.getMetaBean() : null;
}
origin: org.apache.bval/bval-core

/**
 * Create a new DynaTypeEnum instance.
 * @param enumClass
 * @param names
 */
public DynaTypeEnum(Class<?> enumClass, String... names) {
  this(enumClass);
  setEnumNames(names);
}
origin: org.apache.bval/bval-core

  @Override
  public MetaBean getParentMetaBean() {
    return invocable.getParentMetaBean();
  }
}
origin: org.apache.bval/bval-core

/**
 * Set the enumeration value names.
 * @param names
 */
public void setEnumNames(String[] names) {
  enumConstants = new Value[names.length];
  int i = 0;
  for (String each : names) {
    enumConstants[i++] = new Value(each);
  }
}
origin: org.apache.bval/bval-xstream

protected <T extends ValidationListener> void validateMinValue(ValidationContext<T> context) {
  @SuppressWarnings("unchecked")
  Comparable<Object> minValue = (Comparable<Object>) context.getMetaProperty().getFeature(MIN_VALUE);
  if (minValue == null || context.getPropertyValue() == null)
    return;
  if (compare(context, minValue, context.getPropertyValue()) > 0) {
    context.getListener().addError(MIN_VALUE, context);
  }
}
org.apache.bval.model

Most used classes

  • FeaturesCapable
    Description: abstract superclass of meta objects that support a map of features.
  • MetaBean
    Description: the meta description of a bean or class. the class/bean itself can have a map of featur
  • MetaProperty
    Description: the meta description of a property of a bean. It supports a map of features and multipl
  • ValidationContext
    Description: Interface of the context that holds all state information during the validation process
  • ValidationListener$Error
    An object holding a single validation constraint violation found during the validation process.
  • DynaTypeEnum$Value,
  • DynaTypeEnum,
  • MetaBean$ConstructorComparator,
  • MetaBean$FieldComparator,
  • MetaBean$MethodComparator,
  • MetaInvocable,
  • Validation,
  • ValidationListener
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now