Examples of PodamCollection


Examples of uk.co.jemos.podam.common.PodamCollection

              for (Annotation annotation : annotations) {
                if (annotation.annotationType().equals(
                    PodamCollection.class)) {

                  PodamCollection ann = (PodamCollection) annotation;

                  nbrElements = ann.nbrElements();

                }
              }

              for (int i = 0; i < nbrElements; i++) {
                Object attributeValue = manufactureAttributeValue(
                    clazz, pojos, elementType, annotations,
                    attributeName);

                listType.add(attributeValue);
              }

              parameterValues[idx] = listType;

              // It's a Map
            } else if (Map.class.isAssignableFrom(parameterType)) {

              Map<? super Object, ? super Object> mapType = resolveMapType(parameterType);

              Class<?> keyClass;
              Class<?> valueClass;
              if (paramType instanceof ParameterizedType) {
                keyClass = (Class<?>) methodGenericTypeArgs
                    .get()[0];
                valueClass = (Class<?>) methodGenericTypeArgs
                    .get()[1];
              } else {
                keyClass = Object.class;
                valueClass = Object.class;
              }

              int nbrElements = strategy
                  .getNumberOfCollectionElements(valueClass);

              for (Annotation annotation : annotations) {
                if (annotation.annotationType().equals(
                    PodamCollection.class)) {

                  PodamCollection ann = (PodamCollection) annotation;

                  nbrElements = ann.nbrElements();

                }
              }

              for (int i = 0; i < nbrElements; i++) {
View Full Code Here

Examples of uk.co.jemos.podam.common.PodamCollection

      throws InstantiationException, IllegalAccessException,
      InvocationTargetException, ClassNotFoundException {

    // If the user defined a strategy to fill the collection elements,
    // we use it
    PodamCollection collectionAnnotation = null;
    AttributeStrategy<?> elementStrategy = null;
    for (Annotation annotation : annotations) {
      if (PodamCollection.class.isAssignableFrom(annotation.getClass())) {
        collectionAnnotation = (PodamCollection) annotation;
        break;
      }

    }

    int nbrElements = strategy
        .getNumberOfCollectionElements(collectionElementType);

    if (null != collectionAnnotation) {

      nbrElements = collectionAnnotation.nbrElements();
      elementStrategy = collectionAnnotation.collectionElementStrategy()
          .newInstance();
    }

    for (int i = 0; i < nbrElements; i++) {
View Full Code Here

Examples of uk.co.jemos.podam.common.PodamCollection

      throws InstantiationException, IllegalAccessException,
      InvocationTargetException, ClassNotFoundException {

    // If the user defined a strategy to fill the collection elements,
    // we use it
    PodamCollection collectionAnnotation = null;
    AttributeStrategy<?> keyStrategy = null;
    AttributeStrategy<?> elementStrategy = null;
    for (Annotation annotation : mapArguments.getAnnotations()) {
      if (PodamCollection.class.isAssignableFrom(annotation.getClass())) {
        collectionAnnotation = (PodamCollection) annotation;
        break;
      }

    }

    int nbrElements = strategy.getNumberOfCollectionElements(mapArguments
        .getElementClass());

    if (null != collectionAnnotation) {

      nbrElements = collectionAnnotation.nbrElements();
      keyStrategy = collectionAnnotation.mapKeyStrategy().newInstance();
      elementStrategy = collectionAnnotation.mapElementStrategy()
          .newInstance();

    }

    for (int i = 0; i < nbrElements; i++) {
View Full Code Here

Examples of uk.co.jemos.podam.common.PodamCollection

      }
    }

    // If the user defined a strategy to fill the collection elements,
    // we use it
    PodamCollection collectionAnnotation = null;
    AttributeStrategy<?> elementStrategy = null;
    for (Annotation annotation : annotations) {
      if (PodamCollection.class.isAssignableFrom(annotation.getClass())) {
        collectionAnnotation = (PodamCollection) annotation;
        break;
      }

    }

    int nbrElements;
    if (null != collectionAnnotation) {

      nbrElements = collectionAnnotation.nbrElements();
      elementStrategy = collectionAnnotation.collectionElementStrategy()
          .newInstance();
    } else {

      nbrElements = strategy.getNumberOfCollectionElements(attributeType);
    }

    Object arrayElement = null;
    Object array = Array.newInstance(componentType, nbrElements);

    for (int i = 0; i < nbrElements; i++) {

      // The default
      if (null != elementStrategy
          && ObjectStrategy.class
              .isAssignableFrom(collectionAnnotation
                  .collectionElementStrategy())
          && Object.class.equals(componentType)) {
        LOG.debug("Element strategy is ObjectStrategy and array element is of type Object: using the ObjectStrategy strategy");
        arrayElement = elementStrategy.getValue();
      } else if (null != elementStrategy
          && !ObjectStrategy.class
              .isAssignableFrom(collectionAnnotation
                  .collectionElementStrategy())) {
        LOG.debug("Array elements will be filled using the following strategy: "
            + elementStrategy);
        arrayElement = returnAttributeDataStrategyValue(componentType,
            elementStrategy);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.