Search in sources :

Example 1 with ListRuntimeType

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);
}
Also used : ListRuntimeType(org.opendaylight.mdsal.binding.runtime.api.ListRuntimeType) Method(java.lang.reflect.Method)

Aggregations

Method (java.lang.reflect.Method)1 ListRuntimeType (org.opendaylight.mdsal.binding.runtime.api.ListRuntimeType)1