private String getName(Class<?> clazz) { Name nameAnnotation = clazz.getAnnotation(Name.class); if (nameAnnotation == null || nameAnnotation.value() == null) { throw new IllegalArgumentException(clazz + " must be registered with a name or it must have a Name annotation!"); } return nameAnnotation.value(); }
private String getName(Class<?> clazz) { Name nameAnnotation = clazz.getAnnotation(Name.class); if (nameAnnotation == null) { throw new IllegalArgumentException(clazz + " must be registered with a name or it must have a Name annotation!"); } return nameAnnotation.value(); }
public static String getName(Class<? extends Processor> processor) { if (processor.isAnnotationPresent(Name.class)) { Name name = processor.getAnnotation(Name.class); return name.value(); } throw new IllegalArgumentException("Processor " + processor + " has no @Name annotation!"); } }
public static String getName(Class<? extends Processor> processor) { if (processor.isAnnotationPresent(Name.class)) { Name name = processor.getAnnotation(Name.class); return name.value(); } throw new IllegalArgumentException("Processor " + processor + " has no @Name annotation!"); } }
private static void handleNameAnnotation(Class<? extends Processor> processor, RubyClass rubyClass) { Ruby rubyRuntime = rubyClass.getRuntime(); if (processor.isAnnotationPresent(Name.class)) { Name name = processor.getAnnotation(Name.class); rubyClass.callMethod(rubyRuntime.getCurrentContext(), "option", new IRubyObject[]{ rubyRuntime.newSymbol("name"), rubyRuntime.newString(name.value()) }); } }
private static void handleNameAnnotation(Class<? extends Processor> processor, RubyClass rubyClass) { Ruby rubyRuntime = rubyClass.getRuntime(); if (processor.isAnnotationPresent(Name.class)) { Name name = processor.getAnnotation(Name.class); rubyClass.callMethod(rubyRuntime.getCurrentContext(), "option", new IRubyObject[]{ rubyRuntime.newSymbol("name"), rubyRuntime.newString(name.value()) }); } }