Java 类com.amazonaws.services.simpleworkflow.flow.annotations.Activity 实例源码

项目:aws-swf-build-tools    文件:ProcessorUtils.java   
public static String computeActivityName(String prefix, String interfaceName, ExecutableElement activity) {
    assert(activity != null);
    String activityName = null;

    Activity activityAnnotation = activity.getAnnotation(Activity.class);
    if (activityAnnotation != null && !activityAnnotation.name().isEmpty()) {
        activityName = activityAnnotation.name();
    }
    else {
        if (prefix == null || prefix.isEmpty()) {
            activityName = interfaceName + "." + activity.getSimpleName().toString();
        }
        else {
            activityName = prefix + activity.getSimpleName().toString();
        }
    }

    return activityName;
}
项目:aws-swf-build-tools    文件:ActivitiesValidator.java   
@Override
public Boolean visitExecutable(ExecutableElement e, ProcessingEnvironment p) {
    TypeMirror returnType = e.getReturnType();
    if (!ProcessorUtils.isVoidType(returnType) && ProcessorUtils.isPromiseType(returnType)) {
        reportError(p, "Activity methods are not allowed to have Promise return type.", e);
    }

    for (VariableElement parameter: e.getParameters()) {
        TypeMirror parameterType = parameter.asType();
        if (ProcessorUtils.isPromiseType(parameterType)) {
            reportError(p, "Activity methods are not allowed to have Promise parameter type.", parameter);
        }
    }

    if ((version == null || version.isEmpty()) && (parentVersion == null || parentVersion.isEmpty())) {
        Activity activityAnnotation = e.getAnnotation(Activity.class);
        if (activityAnnotation == null || activityAnnotation.name().isEmpty()) {
            reportError(p, "Activity version not specified.", e);
        }
    }

    return super.visitExecutable(e, p);
}
项目:aws-swf-build-tools    文件:ProcessorUtils.java   
public static String computeActivityVersion(String version,
        ExecutableElement activity) {
    Activity activityAnnotation = activity.getAnnotation(Activity.class);
    if (activityAnnotation != null && !activityAnnotation.version().isEmpty()) {
        version = activityAnnotation.version();
    }

    return version;
}
项目:datamung    文件:ActivityInvocationDescriber.java   
ActivityInvocationDescriber( Class<?>... activityTypes )
{
    Map<String, Invocation> map = new HashMap<String, Invocation>();
    for ( Class<?> activityType : activityTypes )
    {
        Activities activities =
            activityType.getAnnotation( Activities.class );
        if ( activities == null )
        {
            throw new IllegalArgumentException( "Type " + activityType
                + " is not annotated with " + Activities.class );
        }
        String prefix =
            StringUtils.isBlank( activities.activityNamePrefix() ) ? ( activityType.getSimpleName() + "." )
                            : activities.activityNamePrefix();
        for ( Method method : activityType.getMethods() )
        {
            Description desc = method.getAnnotation( Description.class );
            if ( desc == null )
            {
                continue;
            }
            String name = method.getName();
            Activity activity = method.getAnnotation( Activity.class );
            if ( activity != null
                && StringUtils.isNotBlank( activity.name() ) )
            {
                name = activity.name();
            }
            map.put( prefix + name, new Invocation( method ) );
        }
    }
    this.invocationMap = Collections.unmodifiableMap( map );
}
项目:aws-flow-maven-eclipse-samples    文件:AverageCalculatorActivities.java   
@Activity(name = "computeDataSize")
int computeDataSizeForInputData(String bucketName, String filename);