* @throws Exception
*/
Object createArtifact(final RefArtifact refArtifact, final StepContextImpl stepContext, final Class<?> aClass) throws Exception {
final String ref = refArtifact.getRef();
if (ref.isEmpty()) {
final Script script = refArtifact.getScript();
if (script == null) {
throw BatchMessages.MESSAGES.failToGetAttribute(XmlAttribute.REF.getLocalName(), null);
}
return aClass == ScriptItemReader.class ? new ScriptItemReader(script, refArtifact.getProperties(), stepContext) :
aClass == ScriptItemWriter.class ? new ScriptItemWriter(script, refArtifact.getProperties(), stepContext) :