String classType = pcel.element("classType").getText(); PropertyClass property = (PropertyClass) Class.forName(classType).newInstance(); property.setName(name); property.setObject(this); property.fromXML(pcel);
public PropertyClass(String name, String prettyname, PropertyMetaClass xWikiClass) { super(); setName(name); setPrettyName(prettyname); setxWikiClass(xWikiClass); setUnmodifiable(false); setDisabled(false); }
@Override public void beginWikiClassProperty(String name, String type, FilterEventParameters parameters) throws WikiStreamException { ComponentManager componentManager = this.componentManagerProvider.get(); PropertyClassProvider provider; // First try to use the specified class type as hint. try { if (componentManager.hasComponent(PropertyClassProvider.class, type)) { provider = componentManager.getInstance(PropertyClassProvider.class, type); } else { // In previous versions the class type was the full Java class name of the property class // implementation. Extract the hint by removing the Java package prefix and the Class suffix. String classType = StringUtils.removeEnd(StringUtils.substringAfterLast(type, "."), "Class"); provider = componentManager.getInstance(PropertyClassProvider.class, classType); } } catch (ComponentLookupException e) { throw new WikiStreamException(String.format( "Failed to get instance of the property class provider for type [%s]", type), e); } this.currentClassPropertyMeta = provider.getDefinition(); // We should use PropertyClassInterface (instead of PropertyClass, its default implementation) but it // doesn't have the set methods and adding them would breaks the backwards compatibility. We make the // assumption that all property classes extend PropertyClass. this.currentClassProperty = (PropertyClass) provider.getInstance(); this.currentClassProperty.setName(name); this.currentClassProperty.setObject(this.currentXClass); this.currentXClass.safeput(name, this.currentClassProperty); }
prop2.setName(property.getName()); prop2.setObject(property.getObject()); ltransaction.rollback();
String classType = (String) result[1]; PropertyClass property = (PropertyClass) Class.forName(classType).newInstance(); property.setName(name); property.setObject(bclass); session.load(property, property);
newProperty.setName(newName);
PropertyClass pclass = (PropertyClass) pmclass.newObject(context); pclass.setObject(bclass); pclass.setName(propName); pclass.setPrettyName(propName); bclass.put(propName, pclass);