/** * Returns the target {@link ExporterDescription} type from the class inheritance hierarchy. * * @return the suitable type */ @SuppressWarnings("unchecked") @Override public Class<T> getDescriptionClass() { List<Type> arguments = TypeUtil.invoke(BaseExporterRetriever.class, getClass()); if (arguments.size() != 1) { throw new IllegalStateException( MessageFormat.format("Failed to extract type argument from {0}", getClass().getName())); } Type first = arguments.get(0); if ((first instanceof Class<?>) == false || ExporterDescription.class.isAssignableFrom((Class<?>) first) == false) { throw new IllegalStateException( MessageFormat.format( "Failed to extract type argument of {0} from {1}", ExporterDescription.class.getName(), getClass().getName())); } return (Class<T>) first; }
@SuppressWarnings("unchecked") @Override public Class<T> getTargetType() { List<Type> typeArguments = TypeUtil.invoke(WorkDescriptionProcessor.class, getClass()); if (typeArguments == null || typeArguments.size() != 1) { throw new IllegalStateException( MessageFormat.format( "{0}は{1}の型引数を設定しません", getClass().getName(), WorkDescriptionProcessor.class.getName())); } Type first = typeArguments.get(0); if ((first instanceof Class<?>) == false) { throw new IllegalStateException( MessageFormat.format( "{0}で指定された{1}の型引数{2}は、クラス型である必要があります", getClass().getName(), WorkDescriptionProcessor.class.getName(), first)); } return (Class<T>) first; }