Package ch.semafor.gendas.model

Examples of ch.semafor.gendas.model.PropertyValueList


  private void loadProperties(final Element element, final long revision,
      final Object bean, final Class clazz) throws CoreException {
    for (Property p : element.getProperties()) {
      logger.debug("load properties for {}", p.getType().getName());
      if (p.isInRevision(revision)) {
        final PropertyValueList vlist = p.getValueList(revision);
        if (vlist != null) {
          if (vlist.isValid()) { // NOPMD by wim on 9/20/10 3:06 PM
            String name = getMethodName("set", p.getType().getName());
            Method method = findMethod(clazz, name);
            if (method != null) {
              final Class paramTypes[] = method.getParameterTypes();
              loadSimpleProperty(method, vlist, paramTypes[0], bean);
            } else {
              name = getMethodName("get", p.getType().getName());
              method = findMethod(clazz, name);
              if (method != null) {
                try {
                  Object ref = method.invoke(bean);
                  if (ref instanceof java.util.List) {
                    List l = (java.util.List) ref;
                    logger.debug("load {} list properties for {}",
                        l.size(), p.getType().getName());
                    for (int i = 0; i < vlist.getValues().size(); i++) {
                      l.add((vlist.getValues().get(i)).getObject());
                    }
                  }
                } catch (IllegalArgumentException e) {
                  throw new CoreException("IllegalArgumentException");
                } catch (IllegalAccessException e) {
View Full Code Here


  private void loadProperties(final Element element, final long revision,
      final Object bean, final Class clazz) throws CoreException {
    for (Property p : element.getProperties()) {
      logger.debug("load properties for {}", p.getType().getName());
      if (p.isInRevision(revision)) {
        final PropertyValueList vlist = p.getValueList(revision);
        if (vlist != null) {
          if (vlist.isValid()) { // NOPMD by wim on 9/20/10 3:06 PM
            String name = getMethodName("set", p.getType().getName());
            Method method = findMethod(clazz, name);
            if (method != null) { // ok this is a normal setter
              final Class paramTypes[] = method.getParameterTypes();
              loadSimpleProperty(method, vlist, paramTypes[0], bean);
            } else { // no setter found, assume we have to get a list first
              name = getMethodName("get", p.getType().getName());
              method = findMethod(clazz, name);
              if (method != null) {
                try {
                  Object ref = method.invoke(bean);
                  if (ref instanceof java.util.List) {
                    List l = (java.util.List) ref;
                    logger.debug("load {} list properties for {}",
                        l.size(), p.getType().getName());
                    for (int i = 0; i < vlist.getValues().size(); i++) {
                      l.add((vlist.getValues().get(i)).getObject());
                    }
                  }
                } catch (IllegalArgumentException e) {
                  throw new CoreException("IllegalArgumentException");
                } catch (IllegalAccessException e) {
View Full Code Here

TOP

Related Classes of ch.semafor.gendas.model.PropertyValueList

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.