/** * Adds any arguments from annotations. * * @param <ArgumentType> the argument type * @param context the argument context */ protected <ArgumentType> void addEAnnotationArguments(IArgumentContext<ArgumentType> context) { final EAnnotation annotation = getEAnnotation(); if (annotation == null) return; final String value = annotation.getDetails().get(context.getName()); if (value == null) return; IManager.Factory.getManager().addArgumentValue(context, this, null, null, value); }
@Override public <ArgumentType> void addSuperDataTypeArguments( final IArgumentContext<ArgumentType> context) { final IBindingDataType[] superTypes = IBindingDataType.Factory.getSuperTypes(this); for (final IBindingDataType dt : superTypes) { if (dt == this) { continue; } dt.addArguments(context); if (context.isResultFound()) return; } }
@Override public <ArgumentType> void addArguments(final IArgumentContext<ArgumentType> context) { if (!context.addDataType(this)) return; addEAnnotationArguments(context); if (context.isResultFound()) return; /* * Avoid recursion when resolving the "type" argument!!! */ if (!Constants.ARG_TYPE.equals(context.getName())) { final String type = context.getType(); if (type != null && type.length() > 0) { IManager.Factory.getManager() .addArgumentProviderArguments(this.getArgumentProvider(type), context); if (context.isResultFound()) return; } } IManager.Factory.getManager() .addArgumentProviderArguments(this.getArgumentProvider(null), context); }
@Override public <ArgumentType> List<IArgumentValue<ArgumentType>> getArguments( final String name, final String type, final Class<? extends ArgumentType> argumentType, final boolean firstOnly) { final List<IArgumentValue<ArgumentType>> results = new ArrayList<IArgumentValue<ArgumentType>>(); final IArgumentInformation ai = IManager.Factory.getManager().getArgumentInformation(name); final Set<IBindingDataType> visitedDataTypes = new HashSet<IBindingDataType>(); final IArgumentContext<ArgumentType> context = new IArgumentContext<ArgumentType>() { @Override public IBinding getBinding() { return null; } @Override public String getName() { return name; } @Override public IArgumentInformation getArgumentInformation() { return ai; } @Override public String getType() { return type; } @Override public Class<? extends ArgumentType> getArgumentType() { return argumentType; } @Override public boolean firstOnly() { return firstOnly; } @Override public void addResult(Object source, ArgumentType value) { results.add(new ArgumentValue<ArgumentType>(this, value)); } @Override public boolean isResultFound() { return firstOnly() && !results.isEmpty(); } @Override public boolean addDataType(IBindingDataType dataType) { return visitedDataTypes.add(dataType); } }; addArguments(context); if (context.isResultFound()) return results; addSFSuperContainingClassArguments(context); if (context.isResultFound()) return results; addSuperDataTypeArguments(context); if (context.isResultFound()) return results; addParentDataTypeArguments(context); if (context.isResultFound()) return results; return results; }