@Test public void testGetChildObjectNotExist() throws Exception { assertNull(writerUtil.getChildObject(targetTestClassInstance, new SegmentContext("nothing"))); }
public Object getChildObject(Object parentObject, SegmentContext segment) throws AtlasException { String fieldName = segment.getName(); if (LOG.isDebugEnabled()) { LOG.debug( "Retrieving child '" + fieldName + "'.\n\tparentObject: " + parentObject); } if (parentObject == null) { if (LOG.isDebugEnabled()) { LOG.debug("Cannot find child '" + fieldName + "', parent is null."); } return null; } Method getterMethod = resolveGetterMethod(parentObject.getClass(), fieldName); if (getterMethod == null) { if (LOG.isDebugEnabled()) { LOG.debug(String.format( "Unable to detect getter method for: %s on parent: %s", fieldName, parentObject)); } return null; } getterMethod.setAccessible(true); Object childObject; try { childObject = getterMethod.invoke(parentObject); } catch (Exception e) { throw new AtlasException(e); } if (LOG.isDebugEnabled()) { if (childObject == null) { LOG.debug("Could not find child object for path: " + fieldName); } else { LOG.debug("Found child object for path '" + fieldName + "': " + childObject); } } return childObject; }
JavaFieldWriterUtil { public Object getChildObject(Object parentObject, SegmentContext segment) throws AtlasException { String fieldName = segment.getName(); if (LOG.isDebugEnabled()) { LOG.debug( "Retrieving child '" + fieldName + "'.\n\tparentObject: " + parentObject); } if (parentObject == null) { if (LOG.isDebugEnabled()) { LOG.debug("Cannot find child '" + fieldName + "', parent is null."); } return null; } Method getterMethod = resolveGetterMethod(parentObject.getClass(), fieldName); if (getterMethod == null) { if (LOG.isDebugEnabled()) { LOG.debug(String.format( "Unable to detect getter method for: %s on parent: %s", fieldName, parentObject)); } return null; } getterMethod.setAccessible(true); Object childObject; try { childObject = getterMethod.invoke(parentObject); } catch (Exception e) { throw new AtlasException(e); } if (LOG.isDebugEnabled()) { if (childObject == null) { LOG.debug("Could not find child object for path: " + fieldName); } else { LOG.debug("Found child object for path '" + fieldName + "': " + childObject); } } return childObject; } }
JavaFieldWriterUtil { public Object getChildObject(Object parentObject, SegmentContext segment) throws AtlasException { String fieldName = segment.getName(); if (LOG.isDebugEnabled()) { LOG.debug( "Retrieving child '" + fieldName + "'.\n\tparentObject: " + parentObject); } if (parentObject == null) { if (LOG.isDebugEnabled()) { LOG.debug("Cannot find child '" + fieldName + "', parent is null."); } return null; } Method getterMethod = resolveGetterMethod(parentObject.getClass(), fieldName); if (getterMethod == null) { if (LOG.isDebugEnabled()) { LOG.debug(String.format( "Unable to detect getter method for: %s on parent: %s", fieldName, parentObject)); } return null; } getterMethod.setAccessible(true); Object childObject; try { childObject = getterMethod.invoke(parentObject); } catch (Exception e) { throw new AtlasException(e); } if (LOG.isDebugEnabled()) { if (childObject == null) { LOG.debug("Could not find child object for path: " + fieldName); } else { LOG.debug("Found child object for path '" + fieldName + "': " + childObject); } } return childObject; } JavaFieldWriterUtil(AtlasConversionService conversionService);  JavaFieldWriterUtil(ClassLoader classLoader, AtlasConversionService conversionService); }
JavaFieldWriterUtil { public Object getChildObject(Object parentObject, SegmentContext segment) throws AtlasException { String fieldName = segment.getName(); if (LOG.isDebugEnabled()) { LOG.debug( "Retrieving child '" + fieldName + "'.\n\tparentObject: " + parentObject); } if (parentObject == null) { if (LOG.isDebugEnabled()) { LOG.debug("Cannot find child '" + fieldName + "', parent is null."); } return null; } Method getterMethod = resolveGetterMethod(parentObject.getClass(), fieldName); if (getterMethod == null) { if (LOG.isDebugEnabled()) { LOG.debug(String.format( "Unable to detect getter method for: %s on parent: %s", fieldName, parentObject)); } return null; } getterMethod.setAccessible(true); Object childObject; try { childObject = getterMethod.invoke(parentObject); } catch (Exception e) { throw new AtlasException(e); } if (LOG.isDebugEnabled()) { if (childObject == null) { LOG.debug("Could not find child object for path: " + fieldName); } else { LOG.debug("Found child object for path '" + fieldName + "': " + childObject); } } return childObject; } JavaFieldWriterUtil(AtlasConversionService conversionService);  JavaFieldWriterUtil(ClassLoader classLoader, AtlasConversionService conversionService); Object instantiateObject(Class<?> clz); Class<?> loadClass(String name); Class<?> getDefaultCollectionImplClass(CollectionType type); Object getChildObject(Object parentObject, SegmentContext segment); Object createComplexChildObject(Object parentObject, SegmentContext segmentContext, Class<?> clazz); Object createComplexChildObject(Object parentObject, SegmentContext segmentContext); void setChildObject(Object parentObject, Object childObject, SegmentContext segmentContext); Class<?> resolveChildClass(Object parentObject, SegmentContext segment); Object getCollectionItem(Object collectionObject, SegmentContext segmentContext); Object adjustCollectionSize(Object collectionObject, SegmentContext segmentContext); @SuppressWarnings({ "rawtypes", "unchecked" }) Object createComplexCollectionItem(Object collectionObject, Class<?> itemType, SegmentContext segmentContext); Object createComplexCollectionItem(Object parentObject, Object collectionObject, SegmentContext segmentContext); Class<?> resolveCollectionItemClass(Object parentObject, SegmentContext segmentContext); @SuppressWarnings({ "rawtypes", "unchecked" }) void setCollectionItem(Object collectionObject, Object item, SegmentContext segmentContext); Map<Class<?>, Class<?>> getDefaultCollectionImplClasses(); }
JavaFieldWriterUtil { public Object getChildObject(Object parentObject, SegmentContext segment) throws AtlasException { String fieldName = segment.getName(); if (LOG.isDebugEnabled()) { LOG.debug( "Retrieving child '" + fieldName + "'.\n\tparentObject: " + parentObject); } if (parentObject == null) { if (LOG.isDebugEnabled()) { LOG.debug("Cannot find child '" + fieldName + "', parent is null."); } return null; } Method getterMethod = resolveGetterMethod(parentObject.getClass(), fieldName); if (getterMethod == null) { if (LOG.isDebugEnabled()) { LOG.debug(String.format( "Unable to detect getter method for: %s on parent: %s", fieldName, parentObject)); } return null; } getterMethod.setAccessible(true); Object childObject; try { childObject = getterMethod.invoke(parentObject); } catch (Exception e) { throw new AtlasException(e); } if (LOG.isDebugEnabled()) { if (childObject == null) { LOG.debug("Could not find child object for path: " + fieldName); } else { LOG.debug("Found child object for path '" + fieldName + "': " + childObject); } } return childObject; } JavaFieldWriterUtil(AtlasConversionService conversionService);  JavaFieldWriterUtil(ClassLoader classLoader, AtlasConversionService conversionService); Object instantiateObject(Class<?> clz); Class<?> loadClass(String name); Class<?> getDefaultCollectionImplClass(CollectionType type); Object getChildObject(Object parentObject, SegmentContext segment); Object createComplexChildObject(Object parentObject, SegmentContext segmentContext, Class<?> clazz); Object createComplexChildObject(Object parentObject, SegmentContext segmentContext); void setChildObject(Object parentObject, Object childObject, SegmentContext segmentContext); Class<?> resolveChildClass(Object parentObject, SegmentContext segment); Object getCollectionItem(Object collectionObject, SegmentContext segmentContext); Object adjustCollectionSize(Object collectionObject, SegmentContext segmentContext); @SuppressWarnings({ "rawtypes", "unchecked" }) Object createComplexCollectionItem(Object collectionObject, Class<?> itemType, SegmentContext segmentContext); Object createComplexCollectionItem(Object parentObject, Object collectionObject, SegmentContext segmentContext); Class<?> resolveCollectionItemClass(Object parentObject, SegmentContext segmentContext); @SuppressWarnings({ "rawtypes", "unchecked" }) void setCollectionItem(Object collectionObject, Object item, SegmentContext segmentContext); Map<Class<?>, Class<?>> getDefaultCollectionImplClasses();  }