private String getCollectionMethod(Map<String, String> map, Class<?> pojoClass) { if (pojoClass == Object.class) { return null; } String method = map.get(pojoClass.getName()); if (method != null) { return method; } return getCollectionMethod(map, pojoClass.getSuperclass()); }
private String getCollectionMethod(Map<String, String> map, Class<?> pojoClass) { if (pojoClass == Object.class) { return null; } String method = map.get(pojoClass.getName()); if (method != null) { return method; } else { return getCollectionMethod(map, pojoClass.getSuperclass()); } }
private String getCollectionMethod(Map<String, String> map, Class<?> pojoClass) { if (pojoClass == Object.class) { return null; } String method = map.get(pojoClass.getName()); if (method != null) { return method; } return getCollectionMethod(map, pojoClass.getSuperclass()); }
private String getCollectionMethod(Class<?> cls, boolean getter) { Map<String, String> map = getter ? collectionGetters : collectionSetters; String methodName = getCollectionMethod(map, cls); if (methodName == null) { try { methodName = (getter ? "get" : "set") + cls.getSimpleName(); Class<?>[] params = getter ? new Class[]{} : new Class[]{List.class}; cls.getMethod(methodName, params); } catch (Exception ex) { String type = getter ? "getter" : "setter"; reportError("Collection " + type + " method for " + cls.getName() + " has not been specified and no default " + methodName + " is available", null); } } return methodName; }
private String getCollectionMethod(Class<?> cls, boolean getter) { Map<String, String> map = getter ? collectionGetters : collectionSetters; String methodName = getCollectionMethod(map, cls); if (methodName == null) { try { methodName = (getter ? "get" : "set") + cls.getSimpleName(); Class<?>[] params = getter ? new Class[]{} : new Class[]{List.class}; cls.getMethod(methodName, params); } catch (Exception ex) { String type = getter ? "getter" : "setter"; reportError("Collection " + type + " method for " + cls.getName() + " has not been specified and no default " + methodName + " is available", null); } } return methodName; }
private String getCollectionMethod(Class<?> cls, boolean getter) { Map<String, String> map = getter ? collectionGetters : collectionSetters; String methodName = getCollectionMethod(map, cls); if (methodName == null) { try { methodName = (getter ? "get" : "set") + cls.getSimpleName(); Class<?>[] params = getter ? new Class[]{} : new Class[]{List.class}; cls.getMethod(methodName, params); } catch (Exception ex) { String type = getter ? "getter" : "setter"; reportError("Collection " + type + " method for " + cls.getName() + " has not been specified and no default " + methodName + " is available", null); } } return methodName; }
protected Feed createFeedFromCollectionWrapper(Factory factory, Object o, Class<?> pojoClass) throws Exception { Feed feed = factory.newFeed(); boolean writerUsed = buildFeed(feed, o, pojoClass); if (feed.getEntries().size() > 0) { return feed; } String methodName = getCollectionMethod(o.getClass(), true); Object collection = null; Method m = null; try { m = o.getClass().getMethod(methodName, new Class[]{}); collection = m.invoke(o, new Object[]{}); } catch (Exception ex) { reportError("Collection for " + o.getClass().getName() + " can not be retrieved", ex); } setFeedFromCollection(factory, feed, o, pojoClass, collection, m.getReturnType(), m.getGenericReturnType(), writerUsed); return feed; }
protected Feed createFeedFromCollectionWrapper(Factory factory, Object o, Class<?> pojoClass) throws Exception { Feed feed = factory.newFeed(); boolean writerUsed = buildFeed(feed, o, pojoClass); if (feed.getEntries().size() > 0) { return feed; } String methodName = getCollectionMethod(o.getClass(), true); Object collection = null; Method m = null; try { m = o.getClass().getMethod(methodName, new Class[]{}); collection = m.invoke(o, new Object[]{}); } catch (Exception ex) { reportError("Collection for " + o.getClass().getName() + " can not be retrieved", ex); } setFeedFromCollection(factory, feed, o, pojoClass, collection, m.getReturnType(), m.getGenericReturnType(), writerUsed); return feed; }
protected Feed createFeedFromCollectionWrapper(Factory factory, Object o, Class<?> pojoClass) throws Exception { Feed feed = factory.newFeed(); boolean writerUsed = buildFeed(feed, o, pojoClass); if (feed.getEntries().size() > 0) { return feed; } String methodName = getCollectionMethod(o.getClass(), true); Object collection = null; Method m = null; try { m = o.getClass().getMethod(methodName, new Class[]{}); collection = m.invoke(o, new Object[]{}); } catch (Exception ex) { reportError("Collection for " + o.getClass().getName() + " can not be retrieved", ex); } setFeedFromCollection(factory, feed, o, pojoClass, collection, m.getReturnType(), m.getGenericReturnType(), writerUsed); return feed; }
String methodName = getCollectionMethod(cls, false); Method m = cls.getMethod(methodName, new Class[]{List.class}); Class<Object> realCls
String methodName = getCollectionMethod(cls, false); Method m = cls.getMethod(methodName, new Class[]{List.class}); Class<Object> realCls
String methodName = getCollectionMethod(cls, false); Method m = cls.getMethod(methodName, new Class[]{List.class}); Class<Object> realCls