Package br.net.woodstock.rockframework.core.reflection

Examples of br.net.woodstock.rockframework.core.reflection.BeanDescriptor


    try {
      Object obj = Ognl.getValue(entityName, action);
      if ((obj != null) && (obj instanceof Entity)) {
        Entity<?> entity = (Entity<?>) obj;

        BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(entity.getClass()).getBeanDescriptor();

        PropertyDescriptor propertyDescriptor = beanDescriptor.getProperty(EntityInterceptor.ENTITY_ID);
        Class<?> clazz = propertyDescriptor.getType();

        try {
          Constructor<?> contructor = clazz.getConstructor(new Class[] { String.class });
          Object fieldValue = contructor.newInstance(new Object[] { value });
View Full Code Here


    if (tag.dynamicAttributes()) {
      root.addElement("dynamic-attributes").setData(Boolean.valueOf(tag.dynamicAttributes()));
    }

    BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(clazz).getBeanDescriptor();

    for (PropertyDescriptor propertyDescriptor : beanDescriptor.getProperties()) {
      if (!propertyDescriptor.isAnnotationPresent(Attribute.class)) {
        continue;
      }

      Attribute tldAttribute = propertyDescriptor.getAnnotation(Attribute.class);
View Full Code Here

    super();
    this.clazz = clazz;
  }

  public BeanDescriptor getBeanDescriptor() {
    BeanDescriptor beanDescriptor = new MethodBeanDescriptor(this.clazz);
    return beanDescriptor;
  }
View Full Code Here

  public final BeanDescriptor getBeanDescriptor(final Class<?> clazz) {
    Assert.notNull(clazz, "clazz");

    if (this.hasOnCache(clazz)) {
      RockFrameworkLogger.getLogger().info("Class " + clazz.getSimpleName() + " exists on cache");
      BeanDescriptor descriptor = this.getFromCache(clazz);
      return descriptor;
    }
    BeanDescriptor descriptor = this.getBeanDescriptorInternal(clazz);
    RockFrameworkLogger.getLogger().info("Adding class " + clazz.getSimpleName() + " to cache");
    this.addToCache(clazz, descriptor);
    return descriptor;
  }
View Full Code Here

  public void cleanEntity(final AbstractPreDatabaseOperationEvent event) {
    Object src = event.getEntity();
    EventSource eventSource = event.getSession();
    if (src instanceof Entity) {
      try {
        BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(src.getClass()).getBeanDescriptor();
        for (PropertyDescriptor propertyDescriptor : beanDescriptor.getProperties()) {
          Class propertyType = propertyDescriptor.getType();
          Object propertyValue = propertyDescriptor.getValue(src);
          if (Entity.class.isAssignableFrom(propertyType)) {
            Entity entity = (Entity) propertyValue;
            if (Entities.isNotEmptyId(entity)) {
View Full Code Here

  @SuppressWarnings("rawtypes")
  public void refreshEntity(final Object src, final EventSource eventSource) {
    if (src instanceof Entity) {
      try {
        BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(src.getClass()).getBeanDescriptor();
        for (PropertyDescriptor propertyDescriptor : beanDescriptor.getProperties()) {
          Class propertyType = propertyDescriptor.getType();
          Object propertyValue = propertyDescriptor.getValue(src);
          if (Entity.class.isAssignableFrom(propertyType)) {
            Entity entity = (Entity) propertyValue;
            if (Entities.isNotEmptyId(entity)) {
View Full Code Here

      XmlElement entity = entityMappings.addElement("entity");
      entity.setAttribute("class", clazz.getCanonicalName());
      entity.setAttribute("access", "PROPERTY");
      entity.setAttribute("metadata-complete", "true");

      BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(clazz).getBeanDescriptor();
      Entity e = beanDescriptor.getAnnotation(Entity.class);
      if (Conditions.isNotEmpty(e.name())) {
        entity.setAttribute("name", e.name());
      }

      Table t = beanDescriptor.getAnnotation(Table.class);
      if (t != null) {
        XmlElement table = entity.addElement("table");
        table.setAttribute("name", t.name());
        if (Conditions.isNotEmpty(t.schema())) {
          table.setAttribute("schema", t.schema());
        }
      }

      XmlElement attributes = entity.addElement("attributes");

      for (PropertyDescriptor propertyDescriptor : beanDescriptor.getProperties()) {
        if (propertyDescriptor.isAnnotationPresent(ManyToMany.class)) {
          ManyToMany mm = propertyDescriptor.getAnnotation(ManyToMany.class);
          this.addManyToMany(attributes, propertyDescriptor, mm);
        } else if (propertyDescriptor.isAnnotationPresent(ManyToOne.class)) {
          ManyToOne mo = propertyDescriptor.getAnnotation(ManyToOne.class);
View Full Code Here

    }
    return annotation.getClass().getCanonicalName();
  }

  protected String getAttributeName(final PropertyDescriptor property) {
    BeanDescriptor bean = property.getBeanDescriptor();
    return bean.getType().getCanonicalName() + "." + property.getName();
  }
View Full Code Here

  public Collection<String> getErrors(final String baseName) {
    Assert.notEmpty(baseName, "baseName");
    Collection<String> collection = new ArrayList<String>();
    ClassFinder classFinder = new ClassFinderImpl(baseName, new AssignableClassFilter(Entity.class));
    for (Class<?> clazz : classFinder.getClasses()) {
      BeanDescriptor beanDescriptor = new BeanDescriptorBuilder(clazz).getBeanDescriptor();
      for (PropertyDescriptor propertyDescriptor : beanDescriptor.getProperties()) {
        String name = propertyDescriptor.getName();
        if (propertyDescriptor.isAnnotationPresent(Column.class)) {
          if (propertyDescriptor.isAnnotationPresent(Enumerated.class)) {
            this.columnChecker.checkEnumColumn(name, propertyDescriptor, collection);
          }
View Full Code Here

TOP

Related Classes of br.net.woodstock.rockframework.core.reflection.BeanDescriptor

Copyright © 2018 www.massapicom. 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.