Collection<ParameterDeclaration> params = getParameters();
if (params.size() != 1) {
throw new IllegalArgumentException(getPosition() + ": a local element declaration must have only one parameter.");
}
ParameterDeclaration param = params.iterator().next();
if (!(param.getType() instanceof DeclaredType)) {
throw new IllegalArgumentException(getPosition() + ": parameter type must be a declared type.");
}
elementTypeDeclaration = ((DeclaredType) param.getType()).getDeclaration();
this.facets.addAll(Facet.gatherFacets(registry));
this.facets.addAll(Facet.gatherFacets(delegate));
}