public String getSource() { return EmfFormatter.objPath(source); }
/** Dump the object. * * @param object the object. * @return the string representation of the object. * @since 0.7 */ public static String dump(EObject object) { return EmfFormatter.objToStr(object); }
private static void printInt(int current, int max, Appendable buffer) throws IOException { int length = getNumberOfDigits(current); int maxLength = getNumberOfDigits(max); buffer.append(Integer.toString(current)); for(int i = maxLength; i > length; i--) { buffer.append(SPACE); } }
buf.append(f.getEType().getName()).append(SPACE); buf.append(f.getName()).append(SPACE); objToStrImpl(eobj.eGet(f), innerIdent, buf, ignoredFeatures); } else { buf.append("ref "); buf.append(f.getEType().getName()).append(SPACE); buf.append(f.getName()).append(SPACE); refToStr(eobj, r, innerIdent, buf); objToStrImpl(at, innerIdent, buf, ignoredFeatures); else buf.append("<same as container object>"); buf.append(e.getEStructuralFeature().getName()); buf.append("->"); objToStrImpl(e.getValue(), innerIdent, buf, ignoredFeatures); return ; for (Object o : coll) { buf.append(innerIdent); printInt(counter++, coll.size(), buf); buf.append(": "); objToStrImpl(o, innerIdent, buf, ignoredFeatures); buf.append("\n");
public static String objToStr(Object obj, Predicate<EStructuralFeature> ignoredFeatures) { Appendable buf = new StringBuilder(1024); try { objToStrImpl(obj, "", buf, ignoredFeatures); } catch (Exception e) { throw new WrappedException(e); } return buf.toString(); }
buf.append(f.getEType().getName()).append(SPACE); buf.append(f.getName()).append(SPACE); objToStrImpl(eobj.eGet(f), innerIdent, buf, ignoredFeatures); } else { buf.append("ref "); buf.append(f.getEType().getName()).append(SPACE); buf.append(f.getName()).append(SPACE); refToStr(eobj, r, innerIdent, buf); objToStrImpl(at, innerIdent, buf, ignoredFeatures); else buf.append("<same as container object>"); buf.append(e.getEStructuralFeature().getName()); buf.append("->"); objToStrImpl(e.getValue(), innerIdent, buf, ignoredFeatures); return ; for (Object o : coll) { buf.append(innerIdent); printInt(counter++, coll.size(), buf); buf.append(": "); objToStrImpl(o, innerIdent, buf, ignoredFeatures); buf.append("\n");
public static String objToStr(Object obj, Predicate<EStructuralFeature> ignoredFeatures) { Appendable buf = new StringBuilder(1024); try { objToStrImpl(obj, "", buf, ignoredFeatures); } catch (Exception e) { throw new WrappedException(e); } return buf.toString(); }
@Override public String toString(String prefix) { return value instanceof EObject ? EmfFormatter.objPath((EObject) value) : value.toString(); } }
private static void printInt(int current, int max, Appendable buffer) throws IOException { int length = getNumberOfDigits(current); int maxLength = getNumberOfDigits(max); buffer.append(Integer.toString(current)); for(int i = maxLength; i > length; i--) { buffer.append(SPACE); } }
public static String objPath(EObject obj) { if (obj == null) return "null"; StringBuffer b = new StringBuffer(); objPath(b, obj); return b.toString(); }
public static String objPath( EObject obj) { StringBuffer b = new StringBuffer(); objPath(b, obj); return b.toString(); }
protected ISerializationContext getSerializationContext(EObject semanticObject) { Iterator<ISerializationContext> contexts = contextFinder.findByContentsAndContainer(semanticObject, null) .iterator(); if (!contexts.hasNext()) throw new RuntimeException("No Context for " + EmfFormatter.objPath(semanticObject) + " could be found"); return contexts.next(); }
@Override public boolean add(EObject e) { boolean result = super.add(e); if (result) { from.put(e, new Throwable()); } else { throw new RuntimeException("Cannot root twice: " + EmfFormatter.objToStr(e), from.get(e)); } return result; }
protected ISerializationContext getContext(EObject semanticObject) { Iterable<ISerializationContext> contexts = contextFinder.findByContentsAndContainer(semanticObject, null); if (Iterables.size(contexts) != 1) { StringBuilder msg = new StringBuilder(); msg.append("One context is expected, but " + Iterables.size(contexts) + " have been found\n"); msg.append("Contexts: " + Joiner.on(", ").join(contexts)); msg.append("Semantic Object: " + EmfFormatter.objPath(semanticObject)); Assert.fail(msg.toString()); } return contexts.iterator().next(); }
public static String objToStr(Object obj, EStructuralFeature... ignoredFeatures) { final Set<EStructuralFeature> ignoreUs = (ignoredFeatures != null && ignoredFeatures.length != 0) ? ( ignoredFeatures.length > 1 ? new HashSet<EStructuralFeature>(Arrays.asList(ignoredFeatures)) : Collections.singleton(ignoredFeatures[0]) ) : Collections.<EStructuralFeature>emptySet(); return objToStr(obj, new Predicate<EStructuralFeature>() { public boolean apply(EStructuralFeature input) { return ignoreUs.contains(input); } }); }