@Test public void concurentAccessOnPropertyAccessorList() { Person peter = new Person("Peter"); Person juergen = new Person("Jurgen"); peter.setChild(juergen); List<PropertyPathStart> propertyAccessorList = new CopyOnWriteArrayList<PropertyPathStart>(); PropertyPathStart start = new PropertyPathStart(); start.setName("name"); start.setSignaturePosition(0); start.setContentType(ParameterContentType.PARAM); PropertyPath pathOne = new PropertyPath("child"); start.setPathToContinue(pathOne); propertyAccessorList.add(start); start = new PropertyPathStart(); start.setName("this"); start.setContentType(ParameterContentType.FIELD); pathOne = new PropertyPath("notValid"); start.setPathToContinue(pathOne); propertyAccessorList.add(start); start = new PropertyPathStart(); start.setName("name"); start.setSignaturePosition(1); start.setContentType(ParameterContentType.PARAM); pathOne = new PropertyPath("child"); start.setPathToContinue(pathOne); propertyAccessorList.add(start); assertThat(propertyAccessorList, hasSize(3)); Iterator<PropertyPathStart> i = propertyAccessorList.iterator(); i.next(); List<ParameterContentData> parameterContentList = propertyAccessor.getParameterContentData(propertyAccessorList, peter, new Object[] { peter }, null, false); assertThat(propertyAccessorList, hasSize(1)); assertThat(parameterContentList, is(notNullValue())); assertThat(parameterContentList, hasSize(1)); assertThat(parameterContentList.get(0).getContent(), is("Jurgen")); assertThat(parameterContentList.get(0).getSignaturePosition(), is(0)); assertThat(parameterContentList.get(0).getName(), is("name")); }
@Override public List<ParameterContentData> getParameterContentData(List<PropertyPathStart> propertyAccessorList, Object clazz, Object[] parameters, Object returnValue, boolean exception) { List<ParameterContentData> parameterContentData = new ArrayList<ParameterContentData>(); for (PropertyPathStart start : propertyAccessorList) { try { String content = this.getPropertyContent(start, clazz, parameters, returnValue, exception); ParameterContentData paramContentData = new ParameterContentData(); paramContentData.setContent(content); paramContentData.setContentType(start.getContentType()); paramContentData.setName(start.getName()); paramContentData.setSignaturePosition(start.getSignaturePosition()); parameterContentData.add(paramContentData); } catch (PropertyAccessException e) { if (log.isErrorEnabled()) { log.error("Cannot access the property: " + start + " for class " + clazz + ". Will be removed from the list to prevent further errors! (" + e.getMessage() + ")"); } propertyAccessorList.remove(start); } } return parameterContentData; }
PropertyAccessor implements IPropertyAccessor { @Override public List<ParameterContentData> getParameterContentData(List<PropertyPathStart> propertyAccessorList, Object clazz, Object[] parameters, Object returnValue, boolean exception) { List<ParameterContentData> parameterContentData = new ArrayList<ParameterContentData>(); for (PropertyPathStart start : propertyAccessorList) { try { String content = this.getPropertyContent(start, clazz, parameters, returnValue, exception); ParameterContentData paramContentData = new ParameterContentData(); paramContentData.setContent(content); paramContentData.setContentType(start.getContentType()); paramContentData.setName(start.getName()); paramContentData.setSignaturePosition(start.getSignaturePosition()); parameterContentData.add(paramContentData); } catch (PropertyAccessException e) { if (log.isErrorEnabled()) { log.error("Cannot access the property: " + start + " for class " + clazz + ". Will be removed from the list to prevent further errors! (" + e.getMessage() + ")"); } propertyAccessorList.remove(start); } } return parameterContentData; } }
PropertyAccessor implements IPropertyAccessor { @Override public List<ParameterContentData> getParameterContentData(List<PropertyPathStart> propertyAccessorList, Object clazz, Object[] parameters, Object returnValue, boolean exception) { List<ParameterContentData> parameterContentData = new ArrayList<ParameterContentData>(); for (PropertyPathStart start : propertyAccessorList) { try { String content = this.getPropertyContent(start, clazz, parameters, returnValue, exception); ParameterContentData paramContentData = new ParameterContentData(); paramContentData.setContent(content); paramContentData.setContentType(start.getContentType()); paramContentData.setName(start.getName()); paramContentData.setSignaturePosition(start.getSignaturePosition()); parameterContentData.add(paramContentData); } catch (PropertyAccessException e) { if (log.isErrorEnabled()) { log.error("Cannot access the property: " + start + " for class " + clazz + ". Will be removed from the list to prevent further errors! (" + e.getMessage() + ")"); } propertyAccessorList.remove(start); } } return parameterContentData; }  }
PropertyAccessor implements IPropertyAccessor { @Override public List<ParameterContentData> getParameterContentData(List<PropertyPathStart> propertyAccessorList, Object clazz, Object[] parameters, Object returnValue, boolean exception) { List<ParameterContentData> parameterContentData = new ArrayList<ParameterContentData>(); for (PropertyPathStart start : propertyAccessorList) { try { String content = this.getPropertyContent(start, clazz, parameters, returnValue, exception); ParameterContentData paramContentData = new ParameterContentData(); paramContentData.setContent(content); paramContentData.setContentType(start.getContentType()); paramContentData.setName(start.getName()); paramContentData.setSignaturePosition(start.getSignaturePosition()); parameterContentData.add(paramContentData); } catch (PropertyAccessException e) { if (log.isErrorEnabled()) { log.error("Cannot access the property: " + start + " for class " + clazz + ". Will be removed from the list to prevent further errors! (" + e.getMessage() + ")"); } propertyAccessorList.remove(start); } } return parameterContentData; }  @Override String getPropertyContent(PropertyPathStart propertyPathStart, Object clazz, Object[] parameters, Object returnValue, boolean exception); @Override List<ParameterContentData> getParameterContentData(List<PropertyPathStart> propertyAccessorList, Object clazz, Object[] parameters, Object returnValue, boolean exception); }
PropertyAccessor implements IPropertyAccessor { @Override public List<ParameterContentData> getParameterContentData(List<PropertyPathStart> propertyAccessorList, Object clazz, Object[] parameters, Object returnValue, boolean exception) { List<ParameterContentData> parameterContentData = new ArrayList<ParameterContentData>(); for (PropertyPathStart start : propertyAccessorList) { try { String content = this.getPropertyContent(start, clazz, parameters, returnValue, exception); ParameterContentData paramContentData = new ParameterContentData(); paramContentData.setContent(content); paramContentData.setContentType(start.getContentType()); paramContentData.setName(start.getName()); paramContentData.setSignaturePosition(start.getSignaturePosition()); parameterContentData.add(paramContentData); } catch (PropertyAccessException e) { if (log.isErrorEnabled()) { log.error("Cannot access the property: " + start + " for class " + clazz + ". Will be removed from the list to prevent further errors! (" + e.getMessage() + ")"); } propertyAccessorList.remove(start); } } return parameterContentData; }  @Override String getPropertyContent(PropertyPathStart propertyPathStart, Object clazz, Object[] parameters, Object returnValue, boolean exception); @Override List<ParameterContentData> getParameterContentData(List<PropertyPathStart> propertyAccessorList, Object clazz, Object[] parameters, Object returnValue, boolean exception);  }