private void copy(final Directory directory, final Map<String, Object> metadata) { final TagDescriptor<?> descriptor = MetadataHelper.getDescriptor(directory); final LazyDynaClass directoryClass = new LazyDynaClass(directory.getName(), null, directory.getTags() .parallelStream() .map(t -> new DynaProperty(t.getTagName().replaceAll(NON_WORD_CHARS, ""), String.class)) .toArray(DynaProperty[]::new)); directoryClass.setReturnNull(true); final DynaBean directoryMetadata = new LazyDynaBean(directoryClass); directory.getTags().stream().forEach(t -> directoryMetadata.set( t.getTagName().replaceAll(NON_WORD_CHARS, ""), descriptor.getDescription(t.getTagType()) )); metadata.put(directory.getName().replaceAll(NON_WORD_CHARS, ""), directoryMetadata); }
public DynaClass getDynaClass() { final LazyDynaClass dynaClass = new LazyDynaClass(); for (final Map.Entry<String, Class<?>> entry : propertyTypes.entrySet()) { dynaClass.add(entry.getKey(), entry.getValue()); } return dynaClass; }
protected void setUp() throws Exception { DynaProperty name = new DynaProperty("name", int.class); bean = new LazyDynaBean(new LazyDynaClass("target", new DynaProperty[] { name } )); }