Package org.data2semantics.platform.core.data

Examples of org.data2semantics.platform.core.data.JavaType


      Class<?> paramClazz = inputNameToParamType.get(ii.name());
     
      if(!(ii.dataType() instanceof JavaType))
        return false;
     
      JavaType jType = (JavaType)ii.dataType();
   
      if(!PlatformUtil.isAssignableFrom(paramClazz, jType.clazz()))
        return false;
    }
   
    return true;
  }
View Full Code Here


      Field f = nameToFieldMap.get(ii.name());
     
      if(!(ii.dataType() instanceof JavaType))
        return false;
     
      JavaType jType = (JavaType)ii.dataType();
   
      if(!PlatformUtil.isAssignableFrom(f.getType(), jType.clazz()))
        return false;
     
     
    }
   
View Full Code Here

    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

    {
      Out outputAnnotation = getOutputAnnotations(f);
      if (outputAnnotation != null
          && outputAnnotation.name().equals(name))
      {
        JavaType jType = new JavaType(f.getType());
        return jType;
      }
    }

    for (Method m : methods)
    {
     
      Annotation[] annotations = m.getAnnotations();
      for(Annotation a : annotations){
        if(a instanceof Out){
          Out outAnnotation = (Out) a;
          if(outAnnotation.name().equals(name)){
            if(m.getReturnType().equals(Void.TYPE)){
              throw new IllegalArgumentException("@Out method with name "+((Out)a).name()+" has a void return type.");
            }
            JavaType jType = new JavaType(m.getReturnType());
            return jType;
          }
        }
        if(a instanceof Main){
          Main mainAnnotation = (Main)a;
          if(mainAnnotation.name().equals(name)){
            JavaType jType = new JavaType(m.getReturnType());
            return jType;
          }
        }
      }
View Full Code Here

  {
    //Because this is java domain
    if(!(type instanceof JavaType))
      return false;
   
    JavaType jType = (JavaType)type;
   
    return PlatformUtil.isAssignableFrom(jType.clazz(), value.getClass());
   
  }
View Full Code Here

    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

      return result;
    }
   
    private static boolean isList(DataType outputType) {
      if(!(outputType instanceof JavaType)) return false;
      JavaType jType = (JavaType)outputType;
      return List.class.isAssignableFrom(jType.clazz());
    }
View Full Code Here

TOP

Related Classes of org.data2semantics.platform.core.data.JavaType

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.