use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class ArtifactsUtils method createPattern.
private static IEntity createPattern(IEntity child) {
IEntity pattern = EntityUtils.clone(child);
EntityDescriptor<?> ed = pattern.wGetEntityDescriptor();
for (FeatureDescriptor fd : ed.getEntityFeatureDescriptors()) {
if (!name.equals(fd))
pattern.wSet(fd, CommonsEntityAdapterFactory.createVariable(fd.getEntityDescriptor(), fd.getName()));
}
return pattern;
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class SemanticsUtils method createTerm.
public static IEntity createTerm(String edUri, FreshNameGenerator nameGenerator) {
EntityDescriptor<?> ed = CommonsDataTypePersistenceParser.getEntityDescriptor(edUri, false, null);
if (ed == null || (!EntityUtils.isSimple(ed) && !EntityUtils.isFragment(ed)))
return SemanticsEntityFactory.instance.createEntityType(edUri);
int size = ed.featureSize();
IEntity[] values = new IEntity[size];
SemanticsEntityFactory sf = SemanticsEntityFactory.instance;
for (int i = 0; i < size; i++) {
FeatureDescriptor fd = ed.getEntityFeatureDescriptor(i);
values[i] = sf.buildTypedVariable().set(SemanticsFeatureDescriptorEnum.variable, sf.createVariable(nameGenerator.nextFreshName(fd.getName()))).set(SemanticsFeatureDescriptorEnum.signature, sf.createEntityType(fd.getEntityDescriptor().toString())).getResult();
}
return CommonsEntityFactory.instance.createStageUpFragment(GenericEntityFactory.instance.create(ed, values).wGetAdapter(CommonsEntityDescriptorEnum.Any));
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class MappingStrategyUtils method getElementNCName.
public static String getElementNCName(IEntity entity) {
EntityDescriptor<?> context;
FeatureDescriptor fd;
IEntity parent = entity.wGetParent();
if (EntityUtils.isNull(parent)) {
context = CommonsEntityDescriptorEnum.RootFragment;
fd = CommonsFeatureDescriptorEnum.rootEntity;
} else {
context = parent.wGetEntityDescriptor();
fd = parent.wGetFeatureDescriptor(entity);
}
IMappingStrategy strategy = getMappingStrategy(context.getLanguageKit().getURI());
return strategy == null ? null : strategy.getElementNCName(context, entity.wGetEntityDescriptor(), fd);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class MappingStrategyUtils method getAttributeNCName.
public static String getAttributeNCName(IEntity entity) {
EntityDescriptor<?> context;
FeatureDescriptor fd;
IEntity parent = entity.wGetParent();
if (EntityUtils.isNull(parent)) {
context = CommonsEntityDescriptorEnum.RootFragment;
fd = CommonsFeatureDescriptorEnum.rootEntity;
} else {
context = parent.wGetEntityDescriptor();
fd = parent.wGetFeatureDescriptor(entity);
}
IMappingStrategy strategy = getMappingStrategy(context.getLanguageKit().getURI());
return strategy == null ? null : strategy.getAttributeNCName(context, entity.wGetEntityDescriptor(), fd);
}
use of org.whole.lang.reflect.FeatureDescriptor in project whole by wholeplatform.
the class JDTTransformerVisitor method setAnnotations.
private void setAnnotations(IEntity annotations, List<?> jdtAnnotations) {
IEntity parent = annotations.wGetParent();
FeatureDescriptor fd = parent.wGetFeatureDescriptor(annotations);
for (Iterator<?> i = jdtAnnotations.iterator(); i.hasNext(); ) {
Annotation annotation = (Annotation) i.next();
acceptChild((Annotation) annotation);
parent.wGet(fd).wAdd(exp);
}
}
Aggregations