All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.as.clustering.infinispan.subsystem.PathAddressUtils Maven / Gradle / Ivy

The newest version!
package org.jboss.as.clustering.infinispan.subsystem;

import org.jboss.as.controller.PathAddress;
import org.jboss.as.controller.PathElement;

/**
 * PathAddressUtils.
 *
 * @author Tristan Tarrant
 * @since 8.1
 */
public class PathAddressUtils {

    public static int indexOf(PathAddress parentAddress, PathElement element) {
        int size = parentAddress.size();
        String key = element.getKey();
        for(int i = 0; i < size; i++) {
            PathElement p = parentAddress.getElement(i);
            if (p.getKey().equals(key))
                return i;
        }
        return -1;
    }

    public static int indexOfKey(PathAddress address, String key) {
        for(int i=0; i < address.size(); i++) {
            if (address.getElement(i).getKey().equals(key))
                return i;
        }
        return -1;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy