org.eclipse.xtext.resource.AbstractEObjectDescription Java Examples
The following examples show how to use
org.eclipse.xtext.resource.AbstractEObjectDescription.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResourceDescriptionDeltaTest.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
@SuppressWarnings("PMD.CyclomaticComplexity") private IResourceDescription createDescriptionWithFingerprints(final String... fragmentsAndFingerprints) { final URI resourceURI = URI.createURI("foo:/foo.foo"); return new AbstractResourceDescription() { public Iterable<QualifiedName> getImportedNames() { return ImmutableSet.of(); } public Iterable<IReferenceDescription> getReferenceDescriptions() { return ImmutableSet.of(); } public URI getURI() { return resourceURI; } @Override protected List<IEObjectDescription> computeExportedObjects() { return Lists.transform(Lists.newArrayList(fragmentsAndFingerprints), new Function<String, IEObjectDescription>() { public IEObjectDescription apply(final String from) { final String fragment = from.split(":")[0]; final String fingerprint = from.indexOf(':') != -1 ? from.split(":")[1] : from; return new AbstractEObjectDescription() { public QualifiedName getQualifiedName() { return QualifiedName.create(fragment); } public QualifiedName getName() { return getQualifiedName(); } public URI getEObjectURI() { return resourceURI.appendFragment(fragment); } public EObject getEObjectOrProxy() { return null; } public EClass getEClass() { return null; } @Override public String[] getUserDataKeys() { return new String[] {IFingerprintComputer.OBJECT_FINGERPRINT}; } @Override public String getUserData(final String name) { return name.equals(IFingerprintComputer.OBJECT_FINGERPRINT) ? Integer.toString(fingerprint.hashCode()) : null; // NOPMD } }; } }); } }; }