protected static BeanEntityLayout makeLayout(Class<? extends AbstractBeanEntity> type) { BeanEntityLayout res = cache.get(type); if (res != null) { return res; } DynamicClassLoader dlc = new DynamicClassLoader(type.getClassLoader()); Map<String, BeanAttributeGetter> attrs = new HashMap<>(); List<TypedName<?>> names = new ArrayList<>(); for (Method m: type.getMethods()) { EntityAttribute annot = m.getAnnotation(EntityAttribute.class); if (annot != null) { BeanAttributeGetter gfunc = generateGetter(dlc, type, m); attrs.put(annot.value(), gfunc); names.add(TypedName.create(annot.value(), TypeToken.of(m.getGenericReturnType()))); } } AttributeSet aset = AttributeSet.create(names); ImmutableList.Builder<BeanAttributeGetter> mhlb = ImmutableList.builder(); for (String name: aset.nameSet()) { mhlb.add(attrs.get(name)); } res = new BeanEntityLayout(aset, mhlb.build()); cache.put(type, res); return res; }
protected static BeanEntityLayout makeLayout(Class<? extends AbstractBeanEntity> type) { BeanEntityLayout res = cache.get(type); if (res != null) { return res; } DynamicClassLoader dlc = new DynamicClassLoader(type.getClassLoader()); Map<String, BeanAttributeGetter> attrs = new HashMap<>(); List<TypedName<?>> names = new ArrayList<>(); for (Method m: type.getMethods()) { EntityAttribute annot = m.getAnnotation(EntityAttribute.class); if (annot != null) { BeanAttributeGetter gfunc = generateGetter(dlc, type, m); attrs.put(annot.value(), gfunc); names.add(TypedName.create(annot.value(), TypeToken.of(m.getGenericReturnType()))); } } AttributeSet aset = AttributeSet.create(names); ImmutableList.Builder<BeanAttributeGetter> mhlb = ImmutableList.builder(); for (String name: aset.nameSet()) { mhlb.add(attrs.get(name)); } res = new BeanEntityLayout(aset, mhlb.build()); cache.put(type, res); return res; }