use of org.opendaylight.mdsal.binding.runtime.api.ListRuntimeType in project mdsal by opendaylight.
the class KeyedListNodeCodecContext method create.
@SuppressWarnings("rawtypes")
static KeyedListNodeCodecContext create(final DataContainerCodecPrototype<ListRuntimeType> prototype) {
final Class<?> bindingClass = prototype.getBindingClass();
final Method keyMethod;
try {
keyMethod = bindingClass.getMethod(IDENTIFIABLE_KEY_NAME);
} catch (NoSuchMethodException e) {
throw new IllegalStateException("Required method not available", e);
}
final ListRuntimeType type = prototype.getType();
final IdentifiableItemCodec codec = prototype.getFactory().getPathArgumentCodec(bindingClass, type);
return type.statement().ordering() == Ordering.SYSTEM ? new Unordered<>(prototype, keyMethod, codec) : new Ordered<>(prototype, keyMethod, codec);
}
Aggregations