private static String getPropertyName(String methodName, String prefix, Annotation annotation) { if (prefix != null) { return methodName.substring(prefix.length()); } String propName = null; if (annotation instanceof JSGetter) { propName = ((JSGetter) annotation).value(); if (propName == null || propName.length() == 0) { if (methodName.length() > 1 && (methodName.startsWith("取") || methodName.startsWith("get"))) { propName = methodName.substring(3); if (Character.isUpperCase(propName.charAt(0))) { if (propName.length() == 1) { propName = propName.toLowerCase(); } else if (!Character.isUpperCase(propName.charAt(1))){ propName = Character.toLowerCase(propName.charAt(0)) + propName.substring(1); } } } } } else if (annotation instanceof JSFunction) { propName = ((JSFunction) annotation).value(); } else if (annotation instanceof JSStaticFunction) { propName = ((JSStaticFunction) annotation).value(); } if (propName == null || propName.length() == 0) { propName = methodName; } return propName; }
private static String getPropertyName(String methodName, String prefix, Annotation annotation) { if (prefix != null) { return methodName.substring(prefix.length()); } String propName = null; if (annotation instanceof JSGetter) { propName = ((JSGetter) annotation).value(); if (propName == null || propName.length() == 0) { if (methodName.length() > 3 && methodName.startsWith("get")) { propName = methodName.substring(3); if (Character.isUpperCase(propName.charAt(0))) { if (propName.length() == 1) { propName = propName.toLowerCase(); } else if (!Character.isUpperCase(propName.charAt(1))){ propName = Character.toLowerCase(propName.charAt(0)) + propName.substring(1); } } } } } else if (annotation instanceof JSFunction) { propName = ((JSFunction) annotation).value(); } else if (annotation instanceof JSStaticFunction) { propName = ((JSStaticFunction) annotation).value(); } if (propName == null || propName.length() == 0) { propName = methodName; } return propName; }
/** Check if the job finished or not * @return Job completion status */ @JSGetter public Boolean getIsComplete () throws IOException { return job.isComplete(); }
/** Check if the job finished successfully or not * @return Job success status */ @JSGetter public Boolean getIsSuccessful () throws IOException { return job.isSuccessful(); }
/** Get the progress of the job's map tasks * @return A progress value between 0.0 and 1.0. */ @JSGetter public Double getMapProgress () throws IOException { return (double) job.mapProgress(); }
/** Get the progress of the job's reduce tasks * @return A progress value between 0.0 and 1.0. */ @JSGetter public Double getReduceProgress () throws IOException { return (double) job.reduceProgress(); }
/** Get the progress of the job's setup * @return A progress value between 0.0 and 1.0. */ @JSGetter public Double getSetupProgress () throws IOException { return (double) job.setupProgress(); }
@JSGetter public String getFoo() { return foo; }
@JSGetter("bar") public String getMyBar() { return bar; }
@JSGetter public int getCount() { return count++; }
@JSGetter public int getLineNumber() throws FileNotFoundException { return getReader().getLineNumber(); }
/** Get the encapsulated job object * @return The job object */ @JSGetter public Job getJob () { return job; }
/** Get the pathname of the job's jar * @return The pathname */ @JSGetter public String getJar () { return job.getJar(); }
/** Get the URL for tracking the job's progress * @return The URL */ @JSGetter public String getTrackingURL () { return job.getTrackingURL(); }
/** Get the task attempt ID for the task * @return The Hadoop task attempt ID */ @JSGetter public String getTaskAttemptID () { return task.getTaskAttemptID().toString(); }
/** Get the task context that this object encapsulates * @return The Hadoop task context */ @JSGetter public TaskInputOutputContext getContext () { return task; }
/** Get the Hadoop Configuration object * @return The Hadoop configuration */ @JSGetter public Configuration getConfiguration () { return task.getConfiguration(); }
/** Get the Job ID for the task * @return The Hadoop job id */ @JSGetter public String getJobID () { return task.getJobID().toString(); }
/** Get the user-specified job name for the task * @return The Hadoop job name */ @JSGetter public String getJobName () { return task.getJobName(); }
/** Get the status message for the task. * @return The status message */ @JSGetter public String getStatus () { return task.getStatus(); }
/** Get the standard error print stream * @return A print stream */ @JSGetter public PrintStream getStderr () { return System.err; }
/** Get the standard output print stream * @return A print stream */ @JSGetter public PrintStream getStdout () { return System.out; }
@JSGetter public int getHigh() { return high; }