
com.draagon.meta.io.util.PathTracker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of metaobjects-metadata Show documentation
Show all versions of metaobjects-metadata Show documentation
MetaObjects for Model-driven development - MetaData Libraries
The newest version!
package com.draagon.meta.io.util;
import com.draagon.meta.MetaData;
import java.util.ArrayList;
import java.util.List;
public class PathTracker {
private List pathList = new ArrayList<>();
public void inc( MetaData md ) {
if ( md == null ) inc( "[null]" );
else inc( "["+md.getTypeName()+":"+md.getName()+"]" );
}
public void inc( String path ) {
pathList.add( "/"+path );
}
public String dec() {
return pathList.remove( pathList.size()-1 );
}
public String getPathAndClear() {
String path = toString();
pathList.clear();
return path;
}
public boolean isAtRoot() {
return pathList.isEmpty();
}
public String toString() {
StringBuilder b = new StringBuilder();
for ( String p : pathList ) b.append( p );
return b.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy