Package org.data2semantics.platform.annotation

Examples of org.data2semantics.platform.annotation.In


    Object [] args = new Object[annotations.length]; // this will be passed to the constructor
   
    // Find the values (in order) for each parameter of the constructor
    for(int i=0;i<annotations.length;i++)
    {
      In ia = getAnnotation(annotations[i], In.class);
      InstanceInput ii = instance.input(ia.name());
      args[i] = ii.value();
    }
   
    // Call constructor to instantiate the module object
    Object moduleObject = null;
View Full Code Here


   
    for(int i=0;i<annotations.length;i++){
      for(int j=0;j<annotations[i].length;j++){
        if(annotations[i][j] instanceof In)
        {
          In ia = (In)annotations[i][j];
          InstanceInput ii = instance.input(ia.name());
          args[i] = ii.value();
        }
      }
    }
   
View Full Code Here

    Method[] methods = theClass.getMethods();
    Field[] fields = theClass.getFields();
    Constructor<?>[] constructors = theClass.getConstructors();
   
    for(Field f : fields){
      In inputAnnotation = getInputAnnotations(f);
      if(inputAnnotation != null && inputAnnotation.name().equals(name)){
        JavaType jType = new JavaType(f.getType());
        return jType;
      }
    }

    // Case where input are defined as parameter of constructors.
    for(Constructor c : constructors){
      Annotation [][] parameterAnnotations = c.getParameterAnnotations();
      for(int i =0; i< parameterAnnotations.length;i++){
        for(int j=0;j< parameterAnnotations[i].length;j++){
          if (parameterAnnotations[i][j] instanceof In)
          { In in = (In)parameterAnnotations[i][j];
            if(in.name().equals(name)){
              Class[] paramTypes = c.getParameterTypes();
              JavaType jType = new JavaType(paramTypes[i]);
              return jType;
            }
          }
        }
      }
    }
   
    // Case where inputs are defined as parameter of input factory method.
    for(Method m : methods){
      if(hasFactoryAnnotation(m)){
        Annotation [][] parameterAnnotations = m.getParameterAnnotations();
        for(int i =0; i< parameterAnnotations.length;i++){
          for(int j=0;j< parameterAnnotations[i].length;j++){
            if (parameterAnnotations[i][j] instanceof In)
            { In in = (In)parameterAnnotations[i][j];
              if(in.name().equals(name)){
                Class[] paramTypes = m.getParameterTypes();
                JavaType jType = new JavaType(paramTypes[i]);
                return jType;
              }
            }
View Full Code Here

    Method[] methods = theClass.getMethods();
    Field[] fields = theClass.getFields();
    Constructor<?>[] constructors = theClass.getConstructors();
   
    for(Field f : fields){
      In inputAnnotation = getInputAnnotations(f);
      if(inputAnnotation != null && inputAnnotation.name().equals(name))
        return inputAnnotation.description();
    }

    // Case where input are defined as parameter of constructors.
    for(Constructor c : constructors){
      Annotation [][] parameterAnnotations = c.getParameterAnnotations();
      for(int i =0; i< parameterAnnotations.length;i++){
        for(int j=0;j< parameterAnnotations[i].length;j++){
          if (parameterAnnotations[i][j] instanceof In)
          { In in = (In)parameterAnnotations[i][j];
            if(in.name().equals(name))
              return in.description();
          }
        }
      }
    }
   
    // Case where inputs are defined as parameter of input factory method.
    for(Method m : methods){
      if(hasFactoryAnnotation(m)){
        Annotation [][] parameterAnnotations = m.getParameterAnnotations();
        for(int i =0; i< parameterAnnotations.length;i++){
          for(int j=0;j< parameterAnnotations[i].length;j++){
            if (parameterAnnotations[i][j] instanceof In)
            { In in = (In)parameterAnnotations[i][j];
              if(in.name().equals(name))
                return in.description();
            }
          }
        } 
      }
     
View Full Code Here

    Constructor<?>[] constructors = theClass.getConstructors();
   
    Map<String, JavaType> inputNameToTypeMap = new LinkedHashMap<String, JavaType>();
   
    for(Field f : fields){
      In inputAnnotation = getInputAnnotations(f);
      if(inputAnnotation != null){
        JavaType jType = new JavaType(f.getType());
        if(inputNameToTypeMap.containsKey(inputAnnotation.name())){
          JavaType storedType = inputNameToTypeMap.get(inputAnnotation.name());
          if(!storedType.equals(jType)){
            errors.add("Inputs named as : '"+inputAnnotation.name() + "' are declared using  different types : " + storedType.clazz()+ " != "+jType.clazz());
          }
        } else {
          inputNameToTypeMap.put(inputAnnotation.name(), jType);
        }
      }
    }

    // Case where input are defined as parameter of constructors.
    for(Constructor c : constructors){
      Annotation [][] parameterAnnotations = c.getParameterAnnotations();
      for(int i =0; i< parameterAnnotations.length;i++){
        for(int j=0;j< parameterAnnotations[i].length;j++){
          if (parameterAnnotations[i][j] instanceof In)
          { In in = (In)parameterAnnotations[i][j];
            Class<?>[] paramTypes = c.getParameterTypes();
            JavaType jType = new JavaType(paramTypes[i]);
            if(inputNameToTypeMap.containsKey(in.name())){
              JavaType storedType = inputNameToTypeMap.get(in.name());
              if(!storedType.equals(jType)){
                errors.add("Inputs named as : '"+in.name() + "' are declared using  different types : " + storedType.clazz()+ " != "+jType.clazz());
              }
            } else {
              inputNameToTypeMap.put(in.name(), jType);
            }
          }
        }
      }
    }
   
    // Case where inputs are defined as parameter of input factory method.
    for(Method m : methods){
      if(hasFactoryAnnotation(m)){
        Annotation [][] parameterAnnotations = m.getParameterAnnotations();
        for(int i =0; i< parameterAnnotations.length;i++){
          for(int j=0;j< parameterAnnotations[i].length;j++){
            if (parameterAnnotations[i][j] instanceof In)
            { In in = (In)parameterAnnotations[i][j];
              Class <?>[] paramTypes = m.getParameterTypes();
              JavaType jType = new JavaType(paramTypes[i]);
              if(inputNameToTypeMap.containsKey(in.name())){
                JavaType storedType = inputNameToTypeMap.get(in.name());
                if(!storedType.equals(jType)){
                  errors.add("Inputs named as : '"+in.name() + "' are declared using  different types : " + storedType.clazz()+ " != "+jType.clazz());
                }
              } else {
                inputNameToTypeMap.put(in.name(), jType);
                  }   
            }
          }
        } 
      }
View Full Code Here

    Method[] methods = theClass.getMethods();
    Field[] fields = theClass.getFields();
    Constructor<?>[] constructors = theClass.getConstructors();
   
    for(Field f : fields){
      In inputAnnotation = getInputAnnotations(f);
      if(inputAnnotation != null && inputAnnotation.name().equals(name)){
        return inputAnnotation.print();
      }
    }

    // Case where input are defined as parameter of constructors.
    for(Constructor c : constructors){
      Annotation [][] parameterAnnotations = c.getParameterAnnotations();
      for(int i =0; i< parameterAnnotations.length;i++){
        for(int j=0;j< parameterAnnotations[i].length;j++){
          if (parameterAnnotations[i][j] instanceof In)
          { In in = (In)parameterAnnotations[i][j];
            if(in.name().equals(name)){
              return in.print();
            }
          }
        }
      }
    }
   
    // Case where inputs are defined as parameter of input factory method.
    for(Method m : methods){
      if(hasFactoryAnnotation(m)){
        Annotation [][] parameterAnnotations = m.getParameterAnnotations();
        for(int i =0; i< parameterAnnotations.length;i++){
          for(int j=0;j< parameterAnnotations[i].length;j++){
            if (parameterAnnotations[i][j] instanceof In)
            { In in = (In)parameterAnnotations[i][j];
              if(in.name().equals(name)){
                return in.print();
              }
            }
          }
        } 
      }
View Full Code Here

    for(int i = 0; i < nParam; i++){
     
      // Let's for now assume that we care only for the first annotation
      if(annotations[i].length > 0 )
      if(annotations[i][0] instanceof In){
        In ip = (In) annotations[i][0];
        result[i] = actualInputMap.get(ip.name());
        LOG.info("Getting " + ip.name() + " " + result[i]);
      }
     
    }
   
    return result;
View Full Code Here

TOP

Related Classes of org.data2semantics.platform.annotation.In

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.