@Override public CollectionAccessEvent createInteractionEvent() { return new CollectionAccessEvent(unwrap(getTarget()), getIdentifier()); }
@Override public CollectionAccessEvent createInteractionEvent() { return new CollectionAccessEvent(unwrap(getTarget()), getIdentifier()); }
private Object handleGetterMethodOnCollection( final Method method, final Object[] args, final NakedObject targetAdapter, final OneToManyAssociation otma, final String memberName) { if (args.length != 0) { throw new IllegalArgumentException("Invoking a 'get' should have no arguments"); } resolveIfRequired(targetAdapter); final NakedObject currentReferencedAdapter = otma.get(targetAdapter); final Object currentReferencedObj = NakedObjectUtils.unwrap(currentReferencedAdapter); final CollectionAccessEvent ev = new CollectionAccessEvent(getDelegate(), otma.getIdentifier()); if (currentReferencedObj instanceof Collection) { final Collection<?> collectionViewObject = lookupViewObject(method, memberName, (Collection<?>) currentReferencedObj, otma); notifyListeners(ev); return collectionViewObject; } else if (currentReferencedObj instanceof Map) { final Map<?, ?> mapViewObject = lookupViewObject(method, memberName, (Map<?, ?>) currentReferencedObj, otma); notifyListeners(ev); return mapViewObject; } throw new IllegalArgumentException( String.format("Collection type '%s' not supported by framework", currentReferencedObj.getClass().getName())); }
private Object handleGetterMethodOnCollection( final Method method, final Object[] args, final NakedObject targetAdapter, final OneToManyAssociation otma, final String memberName) { if (args.length != 0) { throw new IllegalArgumentException("Invoking a 'get' should have no arguments"); } resolveIfRequired(targetAdapter); final NakedObject currentReferencedAdapter = otma.get(targetAdapter); final Object currentReferencedObj = NakedObjectUtils.unwrap(currentReferencedAdapter); final CollectionAccessEvent ev = new CollectionAccessEvent(getDelegate(), otma.getIdentifier()); if (currentReferencedObj instanceof Collection) { final Collection<?> collectionViewObject = lookupViewObject(method, memberName, (Collection<?>) currentReferencedObj, otma); notifyListeners(ev); return collectionViewObject; } else if (currentReferencedObj instanceof Map) { final Map<?, ?> mapViewObject = lookupViewObject(method, memberName, (Map<?, ?>) currentReferencedObj, otma); notifyListeners(ev); return mapViewObject; } throw new IllegalArgumentException( String.format("Collection type '%s' not supported by framework", currentReferencedObj.getClass().getName())); }
private Object handleGetterMethodOnCollection( final Method method, final Object[] args, final NakedObject targetAdapter, final OneToManyAssociation otma, final String memberName) { if (args.length != 0) { throw new IllegalArgumentException("Invoking a 'get' should have no arguments"); } resolveIfRequired(targetAdapter); final NakedObject currentReferencedAdapter = otma.get(targetAdapter); final Object currentReferencedObj = NakedObjectUtils.unwrap(currentReferencedAdapter); final CollectionAccessEvent ev = new CollectionAccessEvent(getDelegate(), otma.getIdentifier()); if (currentReferencedObj instanceof Collection) { final Collection<?> collectionViewObject = lookupViewObject(method, memberName, (Collection<?>) currentReferencedObj, otma); notifyListeners(ev); return collectionViewObject; } else if (currentReferencedObj instanceof Map) { final Map<?, ?> mapViewObject = lookupViewObject(method, memberName, (Map<?, ?>) currentReferencedObj, otma); notifyListeners(ev); return mapViewObject; } throw new IllegalArgumentException( String.format("Collection type '%s' not supported by framework", currentReferencedObj.getClass().getName())); }