<commit_before>/*
 * Copyright (c) 2014, 2015 Red Hat, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

package org.opendaylight.neutron.northbound.api;

import java.lang.reflect.Field;
import java.util.List;
import org.opendaylight.neutron.spi.INeutronObject;

public interface INeutronRequest<T extends INeutronObject<T>> {
    default T getSingleton() {
        // return this.sinleton
        Class cls = getClass();
        try {
            Field field = cls.getDeclaredField("singleton");
            @SuppressWarnings("unchecked")
            T value = (T) field.get(this);
            return value;
        } catch (IllegalAccessException | NoSuchFieldException e) {
            throw new IllegalArgumentException(e);
        }
    }

    default boolean isSingleton() {
        // return this.sinleton != null
        Class cls = getClass();
        try {
            Field field = cls.getDeclaredField("singleton");
            return field.get(this) != null;
        } catch (IllegalAccessException | NoSuchFieldException e) {
            throw new IllegalArgumentException(e);
        }
    }

    default List<T> getBulk() {
        // return this.bulkRequest
        Class cls = getClass();
        try {
            Field field = cls.getDeclaredField("bulkRequest");
            @SuppressWarnings("unchecked")
            List<T> value = (List<T>) field.get(this);
            return value;
        } catch (IllegalAccessException | NoSuchFieldException e) {
            throw new IllegalArgumentException(e);
        }
    }
}<commit_msg>fix Java generics warning in INeutronRequest<commit_after>/*
 * Copyright (c) 2014, 2015 Red Hat, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

package org.opendaylight.neutron.northbound.api;

import java.lang.reflect.Field;
import java.util.List;
import org.opendaylight.neutron.spi.INeutronObject;

public interface INeutronRequest<T extends INeutronObject<T>> {
    default T getSingleton() {
        // return this.sinleton
        Class<?> cls = getClass();
        try {
            Field field = cls.getDeclaredField("singleton");
            @SuppressWarnings("unchecked")
            T value = (T) field.get(this);
            return value;
        } catch (IllegalAccessException | NoSuchFieldException e) {
            throw new IllegalArgumentException(e);
        }
    }

    default boolean isSingleton() {
        // return this.sinleton != null
        Class<?> cls = getClass();
        try {
            Field field = cls.getDeclaredField("singleton");
            return field.get(this) != null;
        } catch (IllegalAccessException | NoSuchFieldException e) {
            throw new IllegalArgumentException(e);
        }
    }

    default List<T> getBulk() {
        // return this.bulkRequest
        Class<?> cls = getClass();
        try {
            Field field = cls.getDeclaredField("bulkRequest");
            @SuppressWarnings("unchecked")
            List<T> value = (List<T>) field.get(this);
            return value;
        } catch (IllegalAccessException | NoSuchFieldException e) {
            throw new IllegalArgumentException(e);
        }
    }
}
{'fraction_non_alphanumeric': 0.10111420612813371, 'fraction_numerical': 0.006685236768802228, 'mean_word_length': 2.4134980988593155, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4049270', 'n_tokens_mistral': 994, 'n_tokens_neox': 987, 'n_words': 261}