Package org.data2semantics.platform.annotation

Examples of org.data2semantics.platform.annotation.Out


    }
   
    // Loop through all fields to check for outputs
    for(Field field : curClass.getFields())
    {
      Out anno = getAnnotation(field.getAnnotations(), Out.class);
      if(anno != null)
      {
        String name = anno.name();
        Object value = null;
        try {
          value = field.get(moduleObject);
        } catch (IllegalArgumentException e) {
          throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
          throw new RuntimeException("Output field '"+field+"' in module '"+instance.module().source()+"' not accessible. ");
        }
       
        outputs.put(name, value);
      }
    }
   
    // Loop through all methods to check for outputs
    for(Method method : curClass.getMethods())
    {
      Out anno = getAnnotation(method.getAnnotations(), Out.class);
     
      if(anno != null)
      {
        String name = anno.name();
        Object value = null;
        try {
          value = method.invoke(moduleObject);
        } catch (IllegalArgumentException e) {
          throw new RuntimeException(e);
View Full Code Here


    Method[] methods = theClass.getMethods();
    Field[] fields = theClass.getFields();

    for (Field f : fields)
    {
      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;
View Full Code Here

      }
    }
   
    Field[] fields = theClass.getFields();
    for(Field f : fields){
      Out outputAnnotation = getOutputAnnotations(f);
      if(outputAnnotation != null)
        outputNames.add(outputAnnotation.name());
    }
   
    return outputNames;
  }
View Full Code Here

    Method[] methods = theClass.getMethods();
    Field[] fields = theClass.getFields();

    for (Field f : fields)
    {
      Out outputAnnotation = getOutputAnnotations(f);
      if (outputAnnotation != null
          && outputAnnotation.name().equals(name))
          return outputAnnotation.description();

    }

    for (Method m : methods)
    {
      //if(m.getReturnType().equals(Void.TYPE)) continue;
     
      Annotation[] annotations = m.getAnnotations();
      for(Annotation a : annotations){
        if(a instanceof Out){
          Out outAnnotation = (Out) a;
          if(outAnnotation.name().equals(name))       
            return outAnnotation.description();

        }
        if(a instanceof Main){
          Main mainAnnotation = (Main)a;
          if(mainAnnotation.name().equals(name))        
View Full Code Here

    Method[] methods = theClass.getMethods();
    Field[] fields = theClass.getFields();

    for (Field f : fields)
    {
      Out outputAnnotation = getOutputAnnotations(f);
      if (outputAnnotation != null
          && outputAnnotation.name().equals(name))
      {
        return outputAnnotation.print();
      }
    }

    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)){
            return outAnnotation.print();

          }
        }
        if(a instanceof Main){
          Main mainAnnotation = (Main)a;
View Full Code Here

   */
  public static Object getOutputField(Object instance, String outputName) throws IllegalArgumentException, IllegalAccessException{
    Object result= null;
    for(Field f : instance.getClass().getDeclaredFields()){
      if(f.isAnnotationPresent(Out.class)){
        Out outputAnnotation = f.getAnnotation(Out.class);
        if(outputName.equals(outputAnnotation.name())){
          return f.get(instance);
        }
      }
    }
   
View Full Code Here

  public static Collection<String> getAllOutputNames(Class<?> clz){
      Collection<String> result = new Vector<String>();
     
      for(Field f: clz.getDeclaredFields()){
        if(f.isAnnotationPresent(Out.class)){
          Out outputAnnotation = f.getAnnotation(Out.class);
          result.add(outputAnnotation.name())
        }
      }
     
      return result;
  }
View Full Code Here

TOP

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

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.