public void add(final NakedObject owningAdapter, final NakedObject elementAdapter) { final Collection collection = (Collection) NakedObjectInvokeUtils.invoke(method, owningAdapter); collection.add(NakedObjectUtils.unwrap(elementAdapter)); getRuntimeContext().objectChanged(owningAdapter); }
private Class<?> findAndRemoveAddToMethod( final List<Facet> collectionFacets, final MethodRemover methodRemover, final Class<?> cls, final Method getMethod, final String capitalizedName, final FacetHolder collection) { // look for corresponding add and remove methods final Method method = findMethod(cls, OBJECT, ADD_TO_PREFIX + capitalizedName, void.class); removeMethod(methodRemover, method); final Class<?> addType = (method == null || method.getParameterTypes().length != 1) ? null : method.getParameterTypes()[0]; if (method != null) { collectionFacets.add(new CollectionAddToFacetViaMethod(method, collection)); } else { // TODO need to distinguish between Java collections, arrays and other collections! collectionFacets.add(new CollectionAddToFacetViaAccessor(getMethod, collection, getRuntimeContext())); } return addType; }
private Class<?> findAndRemoveAddToMethod( final List<Facet> collectionFacets, final MethodRemover methodRemover, final Class<?> cls, final Method getMethod, final String capitalizedName, final FacetHolder collection) { // look for corresponding add and remove methods final Method method = findMethod(cls, OBJECT, ADD_TO_PREFIX + capitalizedName, void.class); removeMethod(methodRemover, method); final Class<?> addType = (method == null || method.getParameterTypes().length != 1) ? null : method.getParameterTypes()[0]; if (method != null) { collectionFacets.add(new CollectionAddToFacetViaMethod(method, collection)); } else { // TODO need to distinguish between Java collections, arrays and other collections! collectionFacets.add(new CollectionAddToFacetViaAccessor(getMethod, collection, getRuntimeContext())); } return addType; }
public void add(final NakedObject owningAdapter, final NakedObject elementAdapter) { final Collection collection = (Collection) NakedObjectInvokeUtils.invoke(method, owningAdapter); collection.add(NakedObjectUtils.unwrap(elementAdapter)); getRuntimeContext().objectChanged(owningAdapter); }