Package org.jboss.errai.marshalling.client.api.annotations

Examples of org.jboss.errai.marshalling.client.api.annotations.MapsTo


          else {
            boolean hasMapsTo = false;
            for (Annotation a : annotations) {
              if (MapsTo.class.isAssignableFrom(a.annotationType())) {
                hasMapsTo = true;
                MapsTo mapsTo = (MapsTo) a;
                String key = mapsTo.value();
                simpleConstructorMapping.mapParmToIndex(key, i, c.getParameters()[i].getType());
              }
            }
            hasMapsTos.add(hasMapsTo);
          }
        }
        if (hasMapsTos.contains(true) && hasMapsTos.contains(false)) {
          throw new InvalidMappingException("Not all parameters of constructor " + c.asConstructor()
              + " have a @" + MapsTo.class.getSimpleName() + " annotation");
        }

        if (hasMapsTos.contains(true)) {
          constructors.add(c);
        }
      }
    }

    final MetaConstructor constructor;
    if (constructors.isEmpty()) {
      constructor = toMap.getConstructor(new MetaClass[0]);
    }
    else if (constructors.size() > 1) {
      throw new InvalidMappingException("found more than one matching constructor for mapping: "
              + toMap.getFullyQualifiedName());
    }
    else {
      constructor = constructors.iterator().next();
    }

    simpleConstructorMapping.setConstructor(constructor);
    definition.setInstantiationMapping(simpleConstructorMapping);

    if (toMap.isEnum()) {
      return definition;
    }

    if (simpleConstructorMapping.getMappings().length == 0) {
      final Set<MetaMethod> factoryMethods = new HashSet<MetaMethod>();
      final SimpleFactoryMapping simpleFactoryMapping = new SimpleFactoryMapping();

      for (final MetaMethod method : toMap.getDeclaredMethods()) {
        if (method.isStatic()) {
          List<Boolean> hasMapsTos = new ArrayList<Boolean>();
          for (int i = 0; i < method.getParameters().length; i++) {
            final Annotation[] annotations = method.getParameters()[i].getAnnotations();
            if (annotations.length == 0) {
              hasMapsTos.add(false);
            }
            else {
              boolean hasMapsTo = false;
              for (Annotation a : annotations) {
                if (MapsTo.class.isAssignableFrom(a.annotationType())) {
                  hasMapsTo = true;
                  MapsTo mapsTo = (MapsTo) a;
                  String key = mapsTo.value();
                  simpleFactoryMapping.mapParmToIndex(key, i, method.getParameters()[i].getType());
                }
              }
              hasMapsTos.add(hasMapsTo);
            }
View Full Code Here


              if (!MapsTo.class.isAssignableFrom(a.annotationType())) {
                satisifed = false;
                break FieldScan;
              }
              else {
                MapsTo mapsTo = (MapsTo) a;
                String key = mapsTo.value();
                simpleConstructorMapping.mapParmToIndex(key, i, c.getParameters()[i].getType());
              }
            }
          }
        }

        if (satisifed) {
          constructors.add(c);
        }
      }
    }

    MetaConstructor constructor;
    if (constructors.isEmpty()) {
      constructor = toMap.getConstructor(new MetaClass[0]);
    }
    else if (constructors.size() > 1) {
      throw new InvalidMappingException("found more than one matching constructor for mapping: "
              + toMap.getFullyQualifiedName());
    }
    else {
      constructor = constructors.iterator().next();
      simpleConstructorMapping.setConstructor(constructor);
    }

    definition.setInstantiationMapping(simpleConstructorMapping);

    if (toMap.isEnum()) {
      return definition;
    }

    if (simpleConstructorMapping.getMappings().length == 0) {
      Set<MetaMethod> factoryMethods = new HashSet<MetaMethod>();

      SimpleFactoryMapping simpleFactoryMapping = new SimpleFactoryMapping();
      for (MetaMethod method : toMap.getDeclaredMethods()) {
        if (method.isStatic()) {
          boolean satisifed = true;
          FieldScan:
          for (int i = 0; i < method.getParameters().length; i++) {
            Annotation[] annotations = method.getParameters()[i].getAnnotations();
            if (annotations.length == 0) {
              satisifed = false;
            }
            else {
              for (Annotation a : annotations) {
                if (!MapsTo.class.isAssignableFrom(a.annotationType())) {
                  satisifed = false;
                  break FieldScan;
                }
                else {
                  MapsTo mapsTo = (MapsTo) a;
                  String key = mapsTo.value();
                  simpleFactoryMapping.mapParmToIndex(key, i, method.getParameters()[i].getType());
                }
              }
            }
View Full Code Here

              if (!MapsTo.class.isAssignableFrom(a.annotationType())) {
                satisifed = false;
                break FieldScan;
              }
              else {
                MapsTo mapsTo = (MapsTo) a;
                String key = mapsTo.value();
                simpleConstructorMapping.mapParmToIndex(key, i, c.getParameters()[i].getType());
              }
            }
          }
        }

        if (satisifed) {
          constructors.add(c);
        }
      }
    }

    MetaConstructor constructor;
    if (constructors.isEmpty()) {
      constructor = toMap.getConstructor(new MetaClass[0]);
    }
    else if (constructors.size() > 1) {
      throw new InvalidMappingException("found more than one matching constructor for mapping: "
              + toMap.getFullyQualifiedName());
    }
    else {
      constructor = constructors.iterator().next();
      simpleConstructorMapping.setConstructor(constructor);
    }

    definition.setInstantiationMapping(simpleConstructorMapping);

    if (toMap.isEnum()) {
      return definition;
    }

    if (simpleConstructorMapping.getMappings().length == 0) {
      Set<MetaMethod> factoryMethods = new HashSet<MetaMethod>();

      SimpleFactoryMapping simpleFactoryMapping = new SimpleFactoryMapping();
      for (MetaMethod method : toMap.getDeclaredMethods()) {
        if (method.isStatic()) {
          boolean satisifed = true;
          FieldScan:
          for (int i = 0; i < method.getParameters().length; i++) {
            Annotation[] annotations = method.getParameters()[i].getAnnotations();
            if (annotations.length == 0) {
              satisifed = false;
            }
            else {
              for (Annotation a : annotations) {
                if (!MapsTo.class.isAssignableFrom(a.annotationType())) {
                  satisifed = false;
                  break FieldScan;
                }
                else {
                  MapsTo mapsTo = (MapsTo) a;
                  String key = mapsTo.value();
                  simpleFactoryMapping.mapParmToIndex(key, i, method.getParameters()[i].getType());
                }
              }
            }
View Full Code Here

            satisifed = false;
          }
          else {
            for (Annotation a : annotations) {
              if (MapsTo.class.isAssignableFrom(a.annotationType())) {
                MapsTo mapsTo = (MapsTo) a;
                String key = mapsTo.value();
                simpleConstructorMapping.mapParmToIndex(key, i, c.getParameters()[i].getType());
              }
            }
          }
        }

        if (satisifed) {
          constructors.add(c);
        }
      }
    }

    MetaConstructor constructor;
    if (constructors.isEmpty()) {
      constructor = toMap.getConstructor(new MetaClass[0]);
    }
    else if (constructors.size() > 1) {
      throw new InvalidMappingException("found more than one matching constructor for mapping: "
              + toMap.getFullyQualifiedName());
    }
    else {
      constructor = constructors.iterator().next();
      simpleConstructorMapping.setConstructor(constructor);
    }

    definition.setInstantiationMapping(simpleConstructorMapping);

    if (toMap.isEnum()) {
      return definition;
    }

    if (simpleConstructorMapping.getMappings().length == 0) {
      Set<MetaMethod> factoryMethods = new HashSet<MetaMethod>();

      SimpleFactoryMapping simpleFactoryMapping = new SimpleFactoryMapping();
      for (MetaMethod method : toMap.getDeclaredMethods()) {
        if (method.isStatic()) {
          boolean satisifed = true;
          for (int i = 0; i < method.getParameters().length; i++) {
            Annotation[] annotations = method.getParameters()[i].getAnnotations();
            if (annotations.length == 0) {
              satisifed = false;
            }
            else {
              for (Annotation a : annotations) {
                if (MapsTo.class.isAssignableFrom(a.annotationType())) {
                  MapsTo mapsTo = (MapsTo) a;
                  String key = mapsTo.value();
                  simpleFactoryMapping.mapParmToIndex(key, i, method.getParameters()[i].getType());
                }
              }
            }
View Full Code Here

          else {
            boolean hasMapsTo = false;
            for (Annotation a : annotations) {
              if (MapsTo.class.isAssignableFrom(a.annotationType())) {
                hasMapsTo = true;
                MapsTo mapsTo = (MapsTo) a;
                String key = mapsTo.value();
                simpleConstructorMapping.mapParmToIndex(key, i, c.getParameters()[i].getType());
              }
            }
            hasMapsTos.add(hasMapsTo);
          }
        }
        if (hasMapsTos.contains(true) && hasMapsTos.contains(false)) {
          throw new InvalidMappingException("Not all parameters of constructor " + c.asConstructor()
              + " have a @" + MapsTo.class.getSimpleName() + " annotation");
        }

        if (hasMapsTos.contains(true)) {
          constructors.add(c);
        }
      }
    }

    final MetaConstructor constructor;
    if (constructors.isEmpty()) {
      constructor = toMap.getConstructor(new MetaClass[0]);
    }
    else if (constructors.size() > 1) {
      throw new InvalidMappingException("found more than one matching constructor for mapping: "
              + toMap.getFullyQualifiedName());
    }
    else {
      constructor = constructors.iterator().next();
    }

    simpleConstructorMapping.setConstructor(constructor);
    definition.setInstantiationMapping(simpleConstructorMapping);

    if (toMap.isEnum()) {
      return definition;
    }

    if (simpleConstructorMapping.getMappings().length == 0) {
      final Set<MetaMethod> factoryMethods = new HashSet<MetaMethod>();
      final SimpleFactoryMapping simpleFactoryMapping = new SimpleFactoryMapping();

      for (final MetaMethod method : toMap.getDeclaredMethods()) {
        if (method.isStatic()) {
          List<Boolean> hasMapsTos = new ArrayList<Boolean>();
          for (int i = 0; i < method.getParameters().length; i++) {
            final Annotation[] annotations = method.getParameters()[i].getAnnotations();
            if (annotations.length == 0) {
              hasMapsTos.add(false);
            }
            else {
              boolean hasMapsTo = false;
              for (Annotation a : annotations) {
                if (MapsTo.class.isAssignableFrom(a.annotationType())) {
                  hasMapsTo = true;
                  MapsTo mapsTo = (MapsTo) a;
                  String key = mapsTo.value();
                  simpleFactoryMapping.mapParmToIndex(key, i, method.getParameters()[i].getType());
                }
              }
              hasMapsTos.add(hasMapsTo);
            }
View Full Code Here

          else {
            boolean hasMapsTo = false;
            for (Annotation a : annotations) {
              if (MapsTo.class.isAssignableFrom(a.annotationType())) {
                hasMapsTo = true;
                MapsTo mapsTo = (MapsTo) a;
                String key = mapsTo.value();
                simpleConstructorMapping.mapParmToIndex(key, i, c.getParameters()[i].getType());
              }
            }
            hasMapsTos.add(hasMapsTo);
          }
        }
        if (hasMapsTos.contains(true) && hasMapsTos.contains(false)) {
          throw new InvalidMappingException("Not all parameters of constructor " + c.asConstructor()
              + " have a @" + MapsTo.class.getSimpleName() + " annotation");
        }

        if (hasMapsTos.contains(true)) {
          constructors.add(c);
        }
      }
    }

    final MetaConstructor constructor;
    if (constructors.isEmpty()) {
      constructor = toMap.getConstructor(new MetaClass[0]);
    }
    else if (constructors.size() > 1) {
      throw new InvalidMappingException("found more than one matching constructor for mapping: "
              + toMap.getFullyQualifiedName());
    }
    else {
      constructor = constructors.iterator().next();
    }

    simpleConstructorMapping.setConstructor(constructor);
    definition.setInstantiationMapping(simpleConstructorMapping);

    if (toMap.isEnum()) {
      return definition;
    }

    if (simpleConstructorMapping.getMappings().length == 0) {
      final Set<MetaMethod> factoryMethods = new HashSet<MetaMethod>();
      final SimpleFactoryMapping simpleFactoryMapping = new SimpleFactoryMapping();

      for (final MetaMethod method : toMap.getDeclaredMethods()) {
        if (method.isStatic()) {
          List<Boolean> hasMapsTos = new ArrayList<Boolean>();
          for (int i = 0; i < method.getParameters().length; i++) {
            final Annotation[] annotations = method.getParameters()[i].getAnnotations();
            if (annotations.length == 0) {
              hasMapsTos.add(false);
            }
            else {
              boolean hasMapsTo = false;
              for (Annotation a : annotations) {
                if (MapsTo.class.isAssignableFrom(a.annotationType())) {
                  hasMapsTo = true;
                  MapsTo mapsTo = (MapsTo) a;
                  String key = mapsTo.value();
                  simpleFactoryMapping.mapParmToIndex(key, i, method.getParameters()[i].getType());
                }
              }
              hasMapsTos.add(hasMapsTo);
            }
View Full Code Here

          else {
            boolean hasMapsTo = false;
            for (Annotation a : annotations) {
              if (MapsTo.class.isAssignableFrom(a.annotationType())) {
                hasMapsTo = true;
                MapsTo mapsTo = (MapsTo) a;
                String key = mapsTo.value();
                simpleConstructorMapping.mapParmToIndex(key, i, c.getParameters()[i].getType());
              }
            }
            hasMapsTos.add(hasMapsTo);
          }
        }
        if (hasMapsTos.contains(true) && hasMapsTos.contains(false)) {
          throw new InvalidMappingException("Not all parameters of constructor " + c.asConstructor()
              + " have a @" + MapsTo.class.getSimpleName() + " annotation");
        }

        if (hasMapsTos.contains(true)) {
          constructors.add(c);
        }
      }
    }

    final MetaConstructor constructor;
    if (constructors.isEmpty()) {
      constructor = toMap.getConstructor(new MetaClass[0]);
    }
    else if (constructors.size() > 1) {
      throw new InvalidMappingException("found more than one matching constructor for mapping: "
              + toMap.getFullyQualifiedName());
    }
    else {
      constructor = constructors.iterator().next();
    }

    simpleConstructorMapping.setConstructor(constructor);
    definition.setInstantiationMapping(simpleConstructorMapping);

    if (toMap.isEnum()) {
      return definition;
    }

    if (simpleConstructorMapping.getMappings().length == 0) {
      final Set<MetaMethod> factoryMethods = new HashSet<MetaMethod>();
      final SimpleFactoryMapping simpleFactoryMapping = new SimpleFactoryMapping();

      for (final MetaMethod method : toMap.getDeclaredMethods()) {
        if (method.isStatic()) {
          List<Boolean> hasMapsTos = new ArrayList<Boolean>();
          for (int i = 0; i < method.getParameters().length; i++) {
            final Annotation[] annotations = method.getParameters()[i].getAnnotations();
            if (annotations.length == 0) {
              hasMapsTos.add(false);
            }
            else {
              boolean hasMapsTo = false;
              for (Annotation a : annotations) {
                if (MapsTo.class.isAssignableFrom(a.annotationType())) {
                  hasMapsTo = true;
                  MapsTo mapsTo = (MapsTo) a;
                  String key = mapsTo.value();
                  simpleFactoryMapping.mapParmToIndex(key, i, method.getParameters()[i].getType());
                }
              }
              hasMapsTos.add(hasMapsTo);
            }
View Full Code Here

          else {
            boolean hasMapsTo = false;
            for (Annotation a : annotations) {
              if (MapsTo.class.isAssignableFrom(a.annotationType())) {
                hasMapsTo = true;
                MapsTo mapsTo = (MapsTo) a;
                String key = mapsTo.value();
                simpleConstructorMapping.mapParmToIndex(key, i, c.getParameters()[i].getType());
              }
            }
            hasMapsTos.add(hasMapsTo);
          }
        }
        if (hasMapsTos.contains(true) && hasMapsTos.contains(false)) {
          throw new InvalidMappingException("Not all parameters of constructor " + c.asConstructor()
              + " have a @" + MapsTo.class.getSimpleName() + " annotation");
        }

        if (hasMapsTos.contains(true)) {
          constructors.add(c);
        }
      }
    }

    final MetaConstructor constructor;
    if (constructors.isEmpty()) {
      constructor = toMap.getConstructor(new MetaClass[0]);
    }
    else if (constructors.size() > 1) {
      throw new InvalidMappingException("found more than one matching constructor for mapping: "
              + toMap.getFullyQualifiedName());
    }
    else {
      constructor = constructors.iterator().next();
    }

    simpleConstructorMapping.setConstructor(constructor);
    definition.setInstantiationMapping(simpleConstructorMapping);

    if (toMap.isEnum()) {
      return definition;
    }

    if (simpleConstructorMapping.getMappings().length == 0) {
      final Set<MetaMethod> factoryMethods = new HashSet<MetaMethod>();
      final SimpleFactoryMapping simpleFactoryMapping = new SimpleFactoryMapping();

      for (final MetaMethod method : toMap.getDeclaredMethods()) {
        if (method.isStatic()) {
          List<Boolean> hasMapsTos = new ArrayList<Boolean>();
          for (int i = 0; i < method.getParameters().length; i++) {
            final Annotation[] annotations = method.getParameters()[i].getAnnotations();
            if (annotations.length == 0) {
              hasMapsTos.add(false);
            }
            else {
              boolean hasMapsTo = false;
              for (Annotation a : annotations) {
                if (MapsTo.class.isAssignableFrom(a.annotationType())) {
                  hasMapsTo = true;
                  MapsTo mapsTo = (MapsTo) a;
                  String key = mapsTo.value();
                  simpleFactoryMapping.mapParmToIndex(key, i, method.getParameters()[i].getType());
                }
              }
              hasMapsTos.add(hasMapsTo);
            }
View Full Code Here

              if (!MapsTo.class.isAssignableFrom(a.annotationType())) {
                satisifed = false;
                break FieldScan;
              }
              else {
                MapsTo mapsTo = (MapsTo) a;
                String key = mapsTo.value();
                simpleConstructorMapping.mapParmToIndex(key, i, c.getParameters()[i].getType());
              }
            }
          }
        }

        if (satisifed) {
          constructors.add(c);
        }
      }
    }

    MetaConstructor constructor;
    if (constructors.isEmpty()) {
      constructor = toMap.getConstructor(new MetaClass[0]);
    }
    else if (constructors.size() > 1) {
      throw new InvalidMappingException("found more than one matching constructor for mapping: "
              + toMap.getFullyQualifiedName());
    }
    else {
      constructor = constructors.iterator().next();
      simpleConstructorMapping.setConstructor(constructor);
    }

    definition.setInstantiationMapping(simpleConstructorMapping);

    if (toMap.isEnum()) {
      return definition;
    }

    if (simpleConstructorMapping.getMappings().length == 0) {
      Set<MetaMethod> factoryMethods = new HashSet<MetaMethod>();

      SimpleFactoryMapping simpleFactoryMapping = new SimpleFactoryMapping();
      for (MetaMethod method : toMap.getDeclaredMethods()) {
        if (method.isStatic()) {
          boolean satisifed = true;
          FieldScan:
          for (int i = 0; i < method.getParameters().length; i++) {
            Annotation[] annotations = method.getParameters()[i].getAnnotations();
            if (annotations.length == 0) {
              satisifed = false;
            }
            else {
              for (Annotation a : annotations) {
                if (!MapsTo.class.isAssignableFrom(a.annotationType())) {
                  satisifed = false;
                  break FieldScan;
                }
                else {
                  MapsTo mapsTo = (MapsTo) a;
                  String key = mapsTo.value();
                  simpleFactoryMapping.mapParmToIndex(key, i, method.getParameters()[i].getType());
                }
              }
            }
View Full Code Here

          else {
            boolean hasMapsTo = false;
            for (Annotation a : annotations) {
              if (MapsTo.class.isAssignableFrom(a.annotationType())) {
                hasMapsTo = true;
                MapsTo mapsTo = (MapsTo) a;
                String key = mapsTo.value();
                simpleConstructorMapping.mapParmToIndex(key, i, c.getParameters()[i].getType());
              }
            }
            hasMapsTos.add(hasMapsTo);
          }
        }
        if (hasMapsTos.contains(true) && hasMapsTos.contains(false)) {
          throw new InvalidMappingException("Not all parameters of constructor " + c.asConstructor()
              + " have a @" + MapsTo.class.getSimpleName() + " annotation");
        }

        if (hasMapsTos.contains(true)) {
          constructors.add(c);
        }
      }
    }

    MetaConstructor constructor;
    if (constructors.isEmpty()) {
      constructor = toMap.getConstructor(new MetaClass[0]);
    }
    else if (constructors.size() > 1) {
      throw new InvalidMappingException("found more than one matching constructor for mapping: "
              + toMap.getFullyQualifiedName());
    }
    else {
      constructor = constructors.iterator().next();
      simpleConstructorMapping.setConstructor(constructor);
    }

    definition.setInstantiationMapping(simpleConstructorMapping);

    if (toMap.isEnum()) {
      return definition;
    }

    if (simpleConstructorMapping.getMappings().length == 0) {
      Set<MetaMethod> factoryMethods = new HashSet<MetaMethod>();

      SimpleFactoryMapping simpleFactoryMapping = new SimpleFactoryMapping();
      for (MetaMethod method : toMap.getDeclaredMethods()) {
        if (method.isStatic()) {
          List<Boolean> hasMapsTos = new ArrayList<Boolean>();
          for (int i = 0; i < method.getParameters().length; i++) {
            Annotation[] annotations = method.getParameters()[i].getAnnotations();
            if (annotations.length == 0) {
              hasMapsTos.add(false);
            }
            else {
              boolean hasMapsTo = false;
              for (Annotation a : annotations) {
                if (MapsTo.class.isAssignableFrom(a.annotationType())) {
                  hasMapsTo = true;
                  MapsTo mapsTo = (MapsTo) a;
                  String key = mapsTo.value();
                  simpleFactoryMapping.mapParmToIndex(key, i, method.getParameters()[i].getType());
                }
              }
              hasMapsTos.add(hasMapsTo);
            }
View Full Code Here

TOP

Related Classes of org.jboss.errai.marshalling.client.api.annotations.MapsTo

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.