use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class AbstractPersistenceProvider method initBindingManager.
public void initBindingManager() {
bindingManager.wDefValue("inputStream", (Object) null);
bindingManager.wGet("inputStream").wAddRequestEventHandler(new IdentityRequestEventHandler() {
public Object notifyRequested(IEntity source, FeatureDescriptor feature, Object value) {
return inputStream;
}
});
bindingManager.wDefValue("outputStream", (Object) null);
bindingManager.wGet("outputStream").wAddRequestEventHandler(new IdentityRequestEventHandler() {
public Object notifyRequested(IEntity source, FeatureDescriptor feature, Object value) {
return outputStream;
}
});
if (!bindingManager.wIsSet("encoding")) {
bindingManager.wDefValue("encoding", "");
bindingManager.wGet("encoding").wAddRequestEventHandler(new IdentityRequestEventHandler() {
public String notifyRequested(IEntity source, FeatureDescriptor feature, String value) {
return getDefaultEncoding();
}
});
}
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class GrammarsContentAssistVisitor method calculateAsNameValues.
public static Set<String> calculateAsNameValues(IEntity e) {
Grammar grammar = Matcher.findAncestor(Grammar, e);
if (grammar != null) {
Production production = Matcher.findAncestor(Production, e);
String entityName = production.getName().getValue();
ILanguageKit languageKit = getLanguageKitIfExists(grammar);
if (languageKit != null) {
EntityDescriptor<?> ed = languageKit.getEntityDescriptorEnum().valueOf(entityName);
if (ed != null) {
Set<String> names = new HashSet<String>();
for (FeatureDescriptor fd : ed.getEntityFeatureDescriptors()) names.add(fd.getName());
return names;
}
}
}
return Collections.emptySet();
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class XmlSpecific2XsdBuilderAdapter method elementEntity_.
@Override
public MappingContext elementEntity_(EntityDescriptor<?> context, QName name, Attributes attributes) {
if (containsReferenceAttribute(attributes)) {
EntityDescriptor<?> ed = null;
if (Particles.equals(context) && matches("element", name))
ed = ElementRef;
else if (matches("attribute", name))
ed = AttributeUseRef;
else if (matches("attributeGroup", name))
ed = AttributeGroupRef;
else if (matches("group", name))
ed = ModelGroupRef;
FeatureDescriptor fd = calculateFeatureDescriptor(context, name);
if (!EntityUtils.isComposite(context))
builder.wFeature(fd);
builder.wEntity_(ed);
attributeEntities(ed, attributes);
return MappingContext.create(ed, fd, false);
} else
return super.elementEntity_(context, name, attributes);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class XmlSpecific2XsiBuilderAdapter method attributeEntities.
protected void attributeEntities(EntityDescriptor<?> context, Attributes attributes) {
String uri = context.getLanguageKit().getURI();
boolean isAttributeFormQualified = MappingStrategyUtils.hasMappingStrategy(uri) && MappingStrategyUtils.getMappingStrategy(uri).isAttributesFormQualified();
IEntityIterator<Attribute> iterator = IteratorFactory.<Attribute>childIterator();
iterator.reset(attributes);
// add attribute features
while (iterator.hasNext()) {
Attribute attribute = iterator.next();
QName name = QName.create(ns, isAttributeFormQualified ? NamespaceUtils.getDefaultNamespace(ns) : uri, attribute.getName());
String value = attribute.getValue().getValue();
if (hasAttributeEntityMapping(context, name)) {
FeatureDescriptor fd = getAttributeFeatureMapping(context, name);
EntityDescriptor<?> ed = getAttributeEntityMapping(context, name);
attributeEntity(fd, ed, value);
iterator.remove();
}
}
// add any attributes feature
anyAttributeEntities(context, attributes);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class XmlSpecific2XsiBuilderAdapter method structuralEntity_.
protected MappingContext structuralEntity_(EntityDescriptor<?> context, QName name) {
if (!hasStructuralEntityMapping(context, name))
return null;
FeatureDescriptor fd = getStructuralFeatureMapping(context, name);
EntityDescriptor<?> ed = getStructuralEntityMapping(context, name);
if (!EntityUtils.isComposite(context))
builder.wFeature(fd);
builder.wEntity_(ed);
return MappingContext.create(ed, fd, true);
}
Aggregations