Codota Logo
MetaBean.getBeanClass
Code IndexAdd Codota to your IDE (free)

How to use
getBeanClass
method
in
org.apache.bval.model.MetaBean

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Connection c =
  • Codota IconDataSource dataSource;dataSource.getConnection()
  • Codota IconString url;DriverManager.getConnection(url)
  • Codota IconIdentityDatabaseUtil.getDBConnection()
  • Smart code suggestions by Codota
}
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

/**
 * Remove a single MetaBean from the cache.
 * @param beanInfo
 */
public void removeFromCache(MetaBean beanInfo) {
  cacheById.remove(beanInfo.getId());
  if (beanInfo.getBeanClass() != null && beanInfo.getId().equals(beanInfo.getBeanClass().getName())) {
    cacheByClass.remove(beanInfo.getBeanClass());
  }
}
origin: org.apache.bval/bval-core

/**
 * Cache the specified MetaBean.
 * @param beanInfo
 */
public void cache(MetaBean beanInfo) {
  cacheById.put(beanInfo.getId(), beanInfo);
  if (beanInfo.getBeanClass() != null && beanInfo.getId().equals(beanInfo.getBeanClass().getName())) {
    cacheByClass.putIfAbsent(beanInfo.getBeanClass(), beanInfo);
  }
}
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

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

/**
 * {@inheritDoc}
 */
public ElementDescriptor.ConstraintFinder lookingAt(Scope scope) {
  if (scope.equals(Scope.LOCAL_ELEMENT)) {
    findInScopes.remove(Scope.HIERARCHY);
    for (Iterator<ConstraintValidation<?>> it = constraintDescriptors.iterator(); it.hasNext();) {
      ConstraintValidation<?> cv = it.next();
      if (cv.getOwner() != metaBean.getBeanClass()) {
        it.remove();
      }
    }
  }
  return this;
}
origin: org.apache.bval/bval-jsr303

private boolean isInScope(ConstraintValidation<?> descriptor) {
  if (findInScopes.size() == Scope.values().length)
    return true; // all scopes
  if (metaBean != null) {
    Class<?> owner = descriptor.getOwner();
    for (Scope scope : findInScopes) {
      switch (scope) {
      case LOCAL_ELEMENT:
        if (owner.equals(metaBean.getBeanClass()))
          return true;
        break;
      case HIERARCHY:
        if (!owner.equals(metaBean.getBeanClass()))
          return true;
        break;
      }
    }
  }
  return false;
}
origin: org.apache.bval/bval-jsr303

/**
 * {@inheritDoc} Add the validation features to the metabean that come from JSR303 annotations in the beanClass.
 */
public void buildMetaBean(MetaBean metabean) {
  try {
    final Class<?> beanClass = metabean.getBeanClass();
    processGroupSequence(beanClass, metabean);
    // process class, superclasses and interfaces
    List<Class<?>> classSequence = new ArrayList<Class<?>>();
    ClassHelper.fillFullClassHierarchyAsList(classSequence, beanClass);
    // start with superclasses and go down the hierarchy so that
    // the child classes are processed last to have the chance to
    // overwrite some declarations
    // of their superclasses and that they see what they inherit at the
    // time of processing
    for (int i = classSequence.size() - 1; i >= 0; i--) {
      Class<?> eachClass = classSequence.get(i);
      processClass(eachClass, metabean);
      processGroupSequence(eachClass, metabean, "{GroupSequence:" + eachClass.getCanonicalName() + "}");
    }
  } catch (IllegalAccessException e) {
    throw new IllegalArgumentException(e);
  } catch (InvocationTargetException e) {
    throw new IllegalArgumentException(e.getTargetException());
  }
}
origin: org.apache.bval/bval-core

/**
 * {@inheritDoc}
 */
@Override
public void buildMetaBean(MetaBean meta) throws Exception {
  if (meta.getBeanClass() == null) {
    return; // handle only, when local class exists
  }
  BeanInfo info = Introspector.getBeanInfo(meta.getBeanClass());
  if (meta.getName() == null && info.getBeanDescriptor() != null) {
    meta.setName(info.getBeanDescriptor().getName()); // (display?)name = simple class name!
  }
  for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
    if (!(pd instanceof IndexedPropertyDescriptor || pd.getName().equals("class"))) {
      MetaProperty metaProp = buildMetaProperty(pd, meta.getProperty(pd.getName()));
      meta.putProperty(pd.getName(), metaProp);
    }
  }
}
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

private void buildConstructorConstraints(MethodBeanDescriptorImpl beanDesc) throws InvocationTargetException,
  IllegalAccessException {
  beanDesc.setConstructorConstraints(new HashMap<Constructor<?>, ConstructorDescriptor>());
  for (Constructor<?> cons : beanDesc.getMetaBean().getBeanClass().getDeclaredConstructors()) {
    if (!factoryContext.getFactory().getAnnotationIgnores().isIgnoreAnnotations(cons)) {
      ConstructorDescriptorImpl consDesc =
        new ConstructorDescriptorImpl(beanDesc.getMetaBean(), new Validation[0]);
      beanDesc.putConstructorDescriptor(cons, consDesc);
      Annotation[][] paramsAnnos = cons.getParameterAnnotations();
      int idx = 0;
      for (Annotation[] paramAnnos : paramsAnnos) {
        ParameterAccess access = new ParameterAccess(cons.getParameterTypes()[idx], idx);
        processAnnotations(consDesc, paramAnnos, access, idx);
        idx++;
      }
    }
  }
}
origin: org.apache.bval/bval-jsr303

private void buildMethodConstraints(MethodBeanDescriptorImpl beanDesc) throws InvocationTargetException,
  IllegalAccessException {
  beanDesc.setMethodConstraints(new HashMap<Method, MethodDescriptor>());
  for (Method method : beanDesc.getMetaBean().getBeanClass().getDeclaredMethods()) {
    if (!factoryContext.getFactory().getAnnotationIgnores().isIgnoreAnnotations(method)) {
      MethodDescriptorImpl methodDesc = new MethodDescriptorImpl(beanDesc.getMetaBean(), new Validation[0]);
      beanDesc.putMethodDescriptor(method, methodDesc);
      // return value validations
      AppendValidationToList validations = new AppendValidationToList();
      ReturnAccess returnAccess = new ReturnAccess(method.getReturnType());
      for (Annotation anno : method.getAnnotations()) {
        if (anno instanceof Valid || anno instanceof Validate) {
          methodDesc.setCascaded(true);
        } else {
          processAnnotation(anno, methodDesc, returnAccess, validations);
        }
      }
      methodDesc.addValidations(validations.getValidations());
      // parameter validations
      Annotation[][] paramsAnnos = method.getParameterAnnotations();
      int idx = 0;
      for (Annotation[] paramAnnos : paramsAnnos) {
        ParameterAccess access = new ParameterAccess(method.getParameterTypes()[idx], idx);
        processAnnotations(methodDesc, paramAnnos, access, idx);
        idx++;
      }
    }
  }
}
origin: org.apache.bval/bval-jsr303

/**
 * If we currently have a property, navigate the context such that the property becomes the bean, in preparation for
 * another property.
 * 
 * @param validationContext
 */
public void moveDownIfNecessary() {
  MetaProperty mp = validationContext.getMetaProperty();
  if (mp != null) {
    if (mp.getMetaBean() == null) {
      throw new UnknownPropertyException(String.format("Property %s.%s is not cascaded", mp
        .getParentMetaBean().getId(), mp.getName()));
    }
    validationContext.moveDown(mp, new NullSafePropertyAccess(validationContext.getMetaBean().getBeanClass(),
      mp.getName()));
  }
}
origin: org.apache.bval/bval-jsr303

private boolean isReachable(GroupValidationContext<?> context) {
  PathImpl path = context.getPropertyPath();
  NodeImpl node = path.getLeafNode();
  PathImpl beanPath = path.getPathWithoutLeafNode();
  if (beanPath == null) {
    beanPath = PathImpl.create(null);
  }
  try {
    if (!context.getTraversableResolver().isReachable(context.getBean(), node,
      context.getRootMetaBean().getBeanClass(), beanPath, access.getElementType()))
      return false;
  } catch (RuntimeException e) {
    throw new ValidationException("Error in TraversableResolver.isReachable() for " + context.getBean(), e);
  }
  return true;
}
origin: org.apache.bval/bval-jsr303

    context.getRootMetaBean().getBeanClass(), beanPath, access.getElementType()))
    return false;
} catch (RuntimeException e) {
    context.getRootMetaBean().getBeanClass(), beanPath, access.getElementType()))
    return false;
} catch (RuntimeException e) {
origin: org.apache.bval/bval-jsr303

&& parentMetaBean.getBeanClass() != builder.getConstraintValidation().getOwner()
&& builder.getConstraintValidation().getGroups().size() == 1
&& builder.getConstraintValidation().getGroups().contains(Default.class)) {
origin: org.apache.bval/bval-jsr303

ClassHelper.fillFullClassHierarchyAsList(classHierarchy, context.getMetaBean().getBeanClass());
Class<?> initialOwner = context.getCurrentOwner();
org.apache.bval.modelMetaBeangetBeanClass

Javadoc

Get the beanClass.

Popular methods of MetaBean

  • getId
    Get the id.
  • getProperties
    Get the properties.
  • getProperty
    Get the specified MetaProperty.
  • putProperty
    bidirectional - set the relationship between a MetaProperty and its parentMetaBean
  • getValidations
  • setBeanClass
    Set the beanClass.
  • setId
    Set the id.
  • setName
    Set the name.
  • <init>
  • copy
  • getFeature
  • getName
    Get the name.
  • getFeature,
  • getName,
  • hasRelationships,
  • putFeature,
  • resolveMetaBean

Popular in Java

  • Start an intent from android
  • setScale (BigDecimal)
  • onRequestPermissionsResult (Fragment)
  • notifyDataSetChanged (ArrayAdapter)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Kernel (java.awt.image)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
  • Runner (org.openjdk.jmh.runner)
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