import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import java.util.Optional;
import java.util.Set;
-
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
private final Set<DataSchemaNode> realChildSchemas;
private final Map<QName, DataSchemaNode> mappedChildSchemas;
- public DataSchemaContainerProxy(final Set<DataSchemaNode> realChildSchema) {
+ DataSchemaContainerProxy(final Set<DataSchemaNode> realChildSchema) {
realChildSchemas = realChildSchema;
- mappedChildSchemas = new HashMap<QName, DataSchemaNode>();
- for(DataSchemaNode schema : realChildSchemas) {
- mappedChildSchemas.put(schema.getQName(),schema);
+ mappedChildSchemas = new HashMap<>();
+ for (DataSchemaNode schema : realChildSchemas) {
+ mappedChildSchemas.put(schema.getQName(), schema);
}
}
@Override
- public DataSchemaNode getDataChildByName(final QName name) {
- return mappedChildSchemas.get(name);
+ public Optional<DataSchemaNode> findDataChildByName(final QName name) {
+ return Optional.ofNullable(mappedChildSchemas.get(name));
}
@Override
return realChildSchemas;
}
- @Override
- public DataSchemaNode getDataChildByName(final String arg0) {
- throw new UnsupportedOperationException();
- }
-
@Override
public Set<GroupingDefinition> getGroupings() {
return Collections.emptySet();
public Set<UsesNode> getUses() {
return Collections.emptySet();
}
-
}