@Override
public E buildEffective() {
- final E existing = effectiveInstance;
- return existing != null ? existing : (effectiveInstance = definition.getFactory().createEffective(this));
+ final E existing;
+ return (existing = effectiveInstance) != null ? existing : loadEffective();
+ }
+
+ private E loadEffective() {
+ return effectiveInstance = definition.getFactory().createEffective(this);
}
/**
return false;
}
- // Exists only to support SubstatementContext/InferredStatementContext
+ // Exists only to support {SubstatementContext,InferredStatementContext}.getSchemaPath()
+ @Deprecated
final @NonNull Optional<SchemaPath> substatementGetSchemaPath() {
SchemaPath local = schemaPath;
if (local == null) {
synchronized (this) {
local = schemaPath;
if (local == null) {
- local = createSchemaPath(coerceParentContext());
- schemaPath = local;
+ schemaPath = local = createSchemaPath(coerceParentContext());
}
}
}
return Optional.ofNullable(local);
}
+ @Deprecated
private SchemaPath createSchemaPath(final Mutable<?, ?, ?> parent) {
final Optional<SchemaPath> maybeParentPath = parent.getSchemaPath();
verify(maybeParentPath.isPresent(), "Parent %s does not have a SchemaPath", parent);
final Object argument = getStatementArgument();
if (argument instanceof QName) {
final QName qname = (QName) argument;
- if (StmtContextUtils.producesDeclared(this, UsesStatement.class)) {
+ if (producesDeclared(UsesStatement.class)) {
return maybeParentPath.orElse(null);
}
return parentPath.createChild(qname);
}
if (argument instanceof SchemaNodeIdentifier
- && (StmtContextUtils.producesDeclared(this, AugmentStatement.class)
- || StmtContextUtils.producesDeclared(this, RefineStatement.class)
- || StmtContextUtils.producesDeclared(this, DeviationStatement.class))) {
+ && (producesDeclared(AugmentStatement.class) || producesDeclared(RefineStatement.class)
+ || producesDeclared(DeviationStatement.class))) {
- return parentPath.createChild(((SchemaNodeIdentifier) argument).getPathFromRoot());
+ return parentPath.createChild(((SchemaNodeIdentifier) argument).getNodeIdentifiers());
}
// FIXME: this does not look right