public class ModuleBuilder implements Builder {
private final ModuleImpl instance;
private final String name;
+ private URI namespace;
private String prefix;
private Date revision;
+ private int augmentsResolved;
+
private final Set<ModuleImport> imports = new HashSet<ModuleImport>();
/**
@Override
public Module build() {
instance.setImports(imports);
+ instance.setNamespace(namespace);
// TYPEDEFS
final Set<TypeDefinition<?>> typedefs = buildModuleTypedefs(addedTypedefs);
return moduleNodes.get(path);
}
+ public Set<DataSchemaNodeBuilder> getChildNodes() {
+ final Set<DataSchemaNodeBuilder> childNodes = new HashSet<DataSchemaNodeBuilder>();
+ for (Map.Entry<List<String>, DataSchemaNodeBuilder> entry : addedChilds
+ .entrySet()) {
+ List<String> path = entry.getKey();
+ DataSchemaNodeBuilder child = entry.getValue();
+ if (path.size() == 2) {
+ childNodes.add(child);
+ }
+ }
+ return childNodes;
+ }
+
public Map<List<String>, TypeAwareBuilder> getDirtyNodes() {
return dirtyNodes;
}
return name;
}
+ public URI getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(final URI namespace) {
+ this.namespace = namespace;
+ }
+
public String getPrefix() {
return prefix;
}
return revision;
}
+ public int getAugmentsResolved() {
+ return augmentsResolved;
+ }
+
+ public void augmentResolved() {
+ augmentsResolved++;
+ }
+
public void addDirtyNode(final List<String> path) {
final List<String> dirtyNodePath = new ArrayList<String>(path);
final TypeAwareBuilder nodeBuilder = (TypeAwareBuilder) moduleNodes
dirtyNodes.put(dirtyNodePath, nodeBuilder);
}
- public void setNamespace(final URI namespace) {
- instance.setNamespace(namespace);
- }
-
public void setRevision(final Date revision) {
this.revision = revision;
instance.setRevision(revision);
List<String> pathToCase = new ArrayList<String>(parentPath);
ChoiceCaseBuilder builder = new ChoiceCaseBuilder(caseName);
- final ChoiceBuilder parent = (ChoiceBuilder) moduleNodes
+ final ChildNodeBuilder parent = (ChildNodeBuilder) moduleNodes
.get(pathToCase);
if (parent != null) {
if (parent instanceof AugmentationSchemaBuilder) {
}
pathToCase.add(caseName.getLocalName());
- addedChilds.put(pathToCase, builder);
moduleNodes.put(pathToCase, builder);
return builder;
moduleNodes.put(path, union);
}
+ public void addIdentityrefType(String baseString, List<String> parentPath) {
+ List<String> pathToIdentityref = new ArrayList<String>(parentPath);
+ TypeAwareBuilder parent = (TypeAwareBuilder) moduleNodes
+ .get(pathToIdentityref);
+ IdentityrefTypeBuilder identityref = new IdentityrefTypeBuilder(baseString);
+ parent.setType(identityref);
+ dirtyNodes.put(pathToIdentityref, parent);
+ }
+
public DeviationBuilder addDeviation(String targetPath,
List<String> parentPath) {
final List<String> pathToDeviation = new ArrayList<String>(parentPath);
return builder;
}
- public IdentitySchemaNodeBuilder addIdentity(QName qname) {
+ public IdentitySchemaNodeBuilder addIdentity(QName qname, List<String> parentPath) {
+ List<String> pathToIdentity = new ArrayList<String>(parentPath);
IdentitySchemaNodeBuilder builder = new IdentitySchemaNodeBuilder(qname);
+ pathToIdentity.add(qname.getLocalName());
+ moduleNodes.put(pathToIdentity, builder);
addedIdentities.add(builder);
return builder;
}