import static com.google.common.base.Verify.verifyNotNull;
+import com.google.common.annotations.Beta;
import com.google.common.base.VerifyException;
import com.google.common.collect.Iterables;
import com.google.common.collect.Streams;
return verifyNotNull(getStatementArgument(), "Statement context %s does not have an argument", this);
}
+ default <X, Y extends DeclaredStatement<X>> boolean producesDeclared(final Class<? super Y> type) {
+ return type.isAssignableFrom(getPublicDefinition().getDeclaredRepresentationClass());
+ }
+
+ default <X, Y extends DeclaredStatement<X>, Z extends EffectiveStatement<A, D>> boolean producesEffective(
+ final Class<? super Z> type) {
+ return type.isAssignableFrom(getPublicDefinition().getEffectiveRepresentationClass());
+ }
+
/**
* Return the {@link SchemaPath} of this statement. Not all statements have a SchemaPath, in which case
* {@link Optional#empty()} is returned.
*
* @return Optional SchemaPath
+ * @deprecated Use of SchemaPath in the context of effective statements is going away. Consider not providing this
+ * information, if your users can exist without it.
*/
+ @Deprecated
@NonNull Optional<SchemaPath> getSchemaPath();
boolean isConfiguration();
* @return Value, or null if there is no element
* @throws NamespaceNotAvailableException when the namespace is not available.
*/
- @NonNull <K, V, T extends K, N extends IdentifierNamespace<K, V>> V getFromNamespace(Class<N> type, T key);
+ <K, V, T extends K, N extends IdentifierNamespace<K, V>> @Nullable V getFromNamespace(Class<N> type, T key);
<K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAllFromNamespace(Class<N> type);
*
* @return Original definition, if this statement was copied.
*/
- Optional<StmtContext<?, ?, ?>> getOriginalCtx();
+ Optional<StmtContext<A, D, E>> getOriginalCtx();
/**
* Return the context of the previous copy of this statement -- effectively walking towards the source origin
*
* @return Context of the previous copy of this statement, if this statement has been copied.
*/
- Optional<? extends StmtContext<?, ?, ?>> getPreviousCopyCtx();
+ Optional<StmtContext<A, D, E>> getPreviousCopyCtx();
ModelProcessingPhase getCompletedPhase();
return childCopyOf(stmt, type, null);
}
+ @Beta
+ @NonNull Optional<? extends Mutable<?, ?, ?>> copyAsChildOf(Mutable<?, ?, ?> parent, CopyType type,
+ @Nullable QNameModule targetModule);
+
@Override
default Collection<? extends StmtContext<?, ?, ?>> declaredSubstatements() {
return mutableDeclaredSubstatements();
void setRootIdentifier(SourceIdentifier identifier);
void setIsSupportedToBuildEffective(boolean isSupportedToBuild);
-
- // FIXME: this seems to be unused, but looks useful.
- void setCompletedPhase(ModelProcessingPhase completedPhase);
}
}