Package se.unlogic.standardutils.dao.annotations

Examples of se.unlogic.standardutils.dao.annotations.ManyToMany


    this.field = field;
    this.daoFactory = daoFactory;


    //Validate linkTable name
    ManyToMany localAnnotation = field.getAnnotation(ManyToMany.class);
   
    this.linkTable = localAnnotation.linkTable();
       
    //Get remote field
    Field matchingRemoteField = null;
   
    Field[] fields = remoteClass.getDeclaredFields();

    for(Field remoteField : fields){

      if(ReflectionUtils.getGenericlyTypeCount(remoteField) == 1 && ReflectionUtils.getGenericType(remoteField).equals(beanClass) && remoteField.isAnnotationPresent(DAOManaged.class) && remoteField.isAnnotationPresent(ManyToMany.class) && remoteField.getAnnotation(ManyToMany.class).linkTable().equals(linkTable)){

        matchingRemoteField = remoteField;

        break;
      }
     
    }

    if(matchingRemoteField == null){

      throw new RuntimeException("Unable to to find corresponding @ManyToMany field in " + remoteClass + " while parsing field " + field.getName() + " in " + beanClass);
    }
   
    //Get remote annotation
    ManyToMany remoteAnnotation = matchingRemoteField.getAnnotation(ManyToMany.class);
   
    //Get local key field
    this.localKeyField = getKeyField(localAnnotation, beanClass, field);
   
    //Get local localColumn name
View Full Code Here


          // comes up with something smarter...
          Class<?> remoteClass = (Class<?>) ReflectionUtils.getGenericType(field);

          this.manyToManyRelations.put(field, DefaultManyToManyRelation.getGenericInstance(beanClass, remoteClass, field, daoFactory, daoManaged));

          ManyToMany manyToMany = field.getAnnotation(ManyToMany.class);

          if (manyToMany.autoAdd()) {
            this.autoAddRelations.add(field);
          }

          if (manyToMany.autoUpdate()) {
            this.autoUpdateRelations.add(field);
          }

          if (manyToMany.autoGet()) {
            this.autoGetRelations.add(field);
          }

        } else {
View Full Code Here

    this.field = field;
    this.daoFactory = daoFactory;


    //Validate linkTable name
    ManyToMany localAnnotation = field.getAnnotation(ManyToMany.class);
   
    this.linkTable = localAnnotation.linkTable();
       
    //Get remote field
    Field matchingRemoteField = null;
   
    Field[] fields = remoteClass.getDeclaredFields();

    for(Field remoteField : fields){

      if(ReflectionUtils.getGenericlyTypeCount(remoteField) == 1 && ReflectionUtils.getGenericType(remoteField).equals(beanClass) && remoteField.isAnnotationPresent(DAOManaged.class) && remoteField.isAnnotationPresent(ManyToMany.class) && remoteField.getAnnotation(ManyToMany.class).linkTable().equals(linkTable)){

        matchingRemoteField = remoteField;

        break;
      }
     
    }

    if(matchingRemoteField == null){

      throw new RuntimeException("Unable to to find corresponding @ManyToMany field in " + remoteClass + " while parsing field " + field.getName() + " in " + beanClass);
    }
   
    //Get remote annotation
    ManyToMany remoteAnnotation = matchingRemoteField.getAnnotation(ManyToMany.class);
   
    //Get local key field
    this.localKeyField = getKeyField(localAnnotation, beanClass, field);
   
    //Get local localColumn name
View Full Code Here

          // comes up with something smarter...
          Class<?> remoteClass = (Class<?>) ReflectionUtils.getGenericType(field);

          this.manyToManyRelations.put(field, DefaultManyToManyRelation.getGenericInstance(beanClass, remoteClass, field, daoFactory, daoManaged));

          ManyToMany manyToMany = field.getAnnotation(ManyToMany.class);

          if (manyToMany.autoAdd()) {
            this.autoAddRelations.add(field);
          }

          if (manyToMany.autoUpdate()) {
            this.autoUpdateRelations.add(field);
          }

          if (manyToMany.autoGet()) {
            this.autoGetRelations.add(field);
          }

        } else {
View Full Code Here

TOP

Related Classes of se.unlogic.standardutils.dao.annotations.ManyToMany

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.