org.wildfly.security.authz.Attributes.size()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中org.wildfly.security.authz.Attributes.size()方法的一些代码示例,展示了Attributes.size()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attributes.size()方法的具体详情如下:
包路径:org.wildfly.security.authz.Attributes
类名称:Attributes
方法名:size

Attributes.size介绍

[英]Get the number of keys in this attribute collection.
[中]获取此属性集合中的键数。

代码示例

代码示例来源:origin: wildfly/wildfly

/**
 * Determine if the given key has values in this collection.
 *
 * @param key the key
 * @return {@code true} if the key has values, {@code false} otherwise
 */
default boolean containsKey(String key) {
  return key != null && size(key) > 0;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Determine if this collection is empty.
 *
 * @return {@code true} if the collection is empty, {@code false} otherwise
 */
default boolean isEmpty() {
  return size() == 0;
}

代码示例来源:origin: wildfly/wildfly

@Override
public int size(String key) {
  return Attributes.this.size(key);
}

代码示例来源:origin: wildfly/wildfly

@Override
public int size() {
  return Attributes.this.size();
}

代码示例来源:origin: wildfly/wildfly

public int size() {
    return attributes.size(key);
  }
}

代码示例来源:origin: wildfly/wildfly

public int size() {
    return Attributes.this.size();
  }
};

代码示例来源:origin: wildfly/wildfly

/**
 * Get the last value mapped to the given key.
 *
 * @param key the key
 * @return the value
 * @throws IndexOutOfBoundsException if there are no values for the given key
 */
default String getLast(String key) {
  return get(key, size(key) - 1);
}

代码示例来源:origin: wildfly/wildfly

/**
 * Add a value after the last mapping for the given key.
 *
 * @param key the key
 * @param value the value
 */
default void addLast(String key, String value) {
  add(key, size(key), value);
}

代码示例来源:origin: wildfly/wildfly

/**
 * Remove the last value mapped to the given key.
 *
 * @param key the key
 * @return the value
 * @throws IndexOutOfBoundsException if there are no values for the given key
 */
default String removeLast(String key) {
  return remove(key, size(key) - 1);
}

代码示例来源:origin: wildfly/wildfly

/**
 * Get the index of the first occurrence of the given value at the given key, if any.
 *
 * @param key the key
 * @param value the value
 * @return the index, or -1 if the value was not found at the given key
 */
default int indexOf(String key, String value) {
  final int size = size(key);
  for (int i = 0; i < size; i ++) {
    if (get(key, i).equals(value)) {
      return i;
    }
  }
  return -1;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Get the index of the last occurrence of the given value at the given key, if any.
 *
 * @param key the key
 * @param value the value
 * @return the index, or -1 if the value was not found at the given key
 */
default int lastIndexOf(String key, String value) {
  final int size = size(key);
  for (int i = size - 1; i >= 0; i --) {
    if (get(key, i).equals(value)) {
      return i;
    }
  }
  return -1;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Conditionally set a specific value of a given key to a new value, if the existing value matches the {@code expect}
 * parameter.
 *
 * @param key the key
 * @param idx the index
 * @param expect the expected value
 * @param update the value to set
 * @return {@code true} if the actual value matched the expected value and was updated, {@code false} otherwise
 * @throws IndexOutOfBoundsException if {@code idx} is less than 0 or greater than or equal to {@code size(key)}
 */
default boolean set(String key, int idx, String expect, String update) {
  Assert.checkNotNullParam("update", update);
  if (expect == null || idx < 0 || idx >= size(key) || ! get(key, idx).equals(expect)) {
    return false;
  }
  set(key, idx, update);
  return true;
}

代码示例来源:origin: wildfly/wildfly

/**
 * Construct a new instance copying mappings from an original attributes collection.
 *
 * @param original the original collection
 */
public MapAttributes(Attributes original) {
  Assert.checkNotNullParam("original", original);
  Map<String, EntriesList> map = new HashMap<>(original.size());
  for (Entry entry : original.entries()) {
    final EntriesList entriesList = new EntriesList(entry);
    if (! entriesList.isEmpty()) map.put(entry.getKey(), entriesList);
  }
  this.map = map;
}

代码示例来源:origin: wildfly/wildfly

if (attributes.size(mapping.getName()) != 0) {
  log.ldapRealmDoesNotSupportSettingFilteredAttribute(mapping.getName(), name);
if (attributes.size(mapping.getName()) == 1) {
  renameTo = attributes.get(mapping.getName(), 0);
} else {
if (attributes.size(mapping.getName()) == 0) {
  BasicAttribute attribute = new BasicAttribute(mapping.getLdapName());
  modItems.add(new ModificationItem(DirContext.REMOVE_ATTRIBUTE, attribute));

代码示例来源:origin: org.wildfly.security/wildfly-elytron

/**
 * Determine if the given key has values in this collection.
 *
 * @param key the key
 * @return {@code true} if the key has values, {@code false} otherwise
 */
default boolean containsKey(String key) {
  return key != null && size(key) > 0;
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-auth-server

/**
 * Determine if the given key has values in this collection.
 *
 * @param key the key
 * @return {@code true} if the key has values, {@code false} otherwise
 */
default boolean containsKey(String key) {
  return key != null && size(key) > 0;
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
 * Determine if the given key has values in this collection.
 *
 * @param key the key
 * @return {@code true} if the key has values, {@code false} otherwise
 */
default boolean containsKey(String key) {
  return key != null && size(key) > 0;
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

/**
 * Get the last value mapped to the given key.
 *
 * @param key the key
 * @return the value
 * @throws IndexOutOfBoundsException if there are no values for the given key
 */
default String getLast(String key) {
  return get(key, size(key) - 1);
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

/**
 * Remove the last value mapped to the given key.
 *
 * @param key the key
 * @return the value
 * @throws IndexOutOfBoundsException if there are no values for the given key
 */
default String removeLast(String key) {
  return remove(key, size(key) - 1);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

/**
 * Remove the last value mapped to the given key.
 *
 * @param key the key
 * @return the value
 * @throws IndexOutOfBoundsException if there are no values for the given key
 */
default String removeLast(String key) {
  return remove(key, size(key) - 1);
}

相关文章