Refine search
/** * Returns the lineage of the specified class ordered by specificity (the class itself is at position 0 since it is most specific in its lineage). */ public static Class<?>[] getLineage(final Class<?> clazz) { final LineageInfo lineageInfo = getLineageInfo(clazz); return lineageInfo == null ? EMPTY_CLASS_ARRAY : lineageInfo.lineage.toArray(new Class<?>[lineageInfo.lineage.size()]); }
static <E> Attribute<E, ?>[] toArray(Collection<Attribute<E, ?>> attributes, Predicate<Attribute<E, ?>> filter) { LinkedHashSet<Attribute> filtered = new LinkedHashSet<>(); for (Attribute<E, ?> attribute : attributes) { if (filter == null || filter.test(attribute)) { filtered.add(attribute); } } Attribute<E, ?>[] array = new Attribute[filtered.size()]; return filtered.toArray(array); }
@Override public String[] getMechanismNames(final Map<String, ?> props) { final LinkedHashSet<String> names = new LinkedHashSet<String>(); for (SaslServerFactory factory : factories) { if (factory != null) { Collections.addAll(names, factory.getMechanismNames(props)); } } return names.toArray(new String[names.size()]); } }
public static Locale[] localesFromStrings(String[] localeNames) { // We need to remove duplicates caused by the conversion of "he" to "iw", et cetera. // Java needs the obsolete code, ICU needs the modern code, but we let ICU know about // both so that we never need to convert back when talking to it. LinkedHashSet<Locale> set = new LinkedHashSet<Locale>(); for (String localeName : localeNames) { set.add(localeFromString(localeName)); } return set.toArray(new Locale[set.size()]); }
/** * Returns the lineage of the specified class ordered by specificity (the class itself is at position 0 since it is most specific in its lineage). */ public static Class<?>[] getLineage(final Class<?> clazz) { final LineageInfo lineageInfo = getLineageInfo(clazz); return lineageInfo == null ? EMPTY_CLASS_ARRAY : lineageInfo.lineage.toArray(new Class<?>[lineageInfo.lineage.size()]); }
/** * @see org.wildfly.security.http.HttpServerAuthenticationMechanismFactory#getMechanismNames(java.util.Map) */ @Override public String[] getMechanismNames(Map<String, ?> properties) { LinkedHashSet<String> names = new LinkedHashSet<>(); for (HttpServerAuthenticationMechanismFactory current : factories) { if (current != null) { Collections.addAll(names, current.getMechanismNames(properties)); } } if (log.isTraceEnabled()) { log.tracef("No %s provided by factories in %s: %s", HttpServerAuthenticationMechanismFactory.class.getSimpleName(), getClass().getSimpleName(), Arrays.toString(factories)); } return names.toArray(new String[names.size()]); }
/** * Evaluate this selector against the given list of JSSE supported mechanisms. * * @param supportedMechanisms the supported mechanisms * @return the enabled mechanisms (not {@code null}) */ public final String[] evaluate(String[] supportedMechanisms) { if (ElytronMessages.tls.isTraceEnabled()) { StringBuilder b = new StringBuilder(supportedMechanisms.length * 16); b.append("Evaluating filter \"").append(this).append("\" on supported mechanisms:"); for (String s : supportedMechanisms) { b.append("\n ").append(s); } ElytronMessages.tls.trace(b); } final MechanismDatabase database = MechanismDatabase.getInstance(); final LinkedHashMap<MechanismDatabase.Entry, String> supportedMap = new LinkedHashMap<>(supportedMechanisms.length); for (String supportedMechanism : supportedMechanisms) { final MechanismDatabase.Entry entry = database.getCipherSuite(supportedMechanism); if (entry != null) { ElytronMessages.tls.tracef("Found supported mechanism %s", supportedMechanism); supportedMap.put(entry, supportedMechanism); } else { ElytronMessages.tls.tracef("Dropping unknown mechanism %s", supportedMechanism); } } final LinkedHashSet<String> enabledSet = new LinkedHashSet<String>(supportedMap.size()); doEvaluate(enabledSet, supportedMap); return enabledSet.toArray(new String[enabledSet.size()]); }
public String[] getNamesByAnnotation(Class<? extends Annotation> klass, IocContext context) { List<String> names = new ArrayList<String>(loader.getNamesByAnnotation(createLoading(), klass)); IocContext cntx; if (null == context || context == this.context) cntx = this.context; else cntx = new ComboContext(context, this.context); for (String name : cntx.names()) { ObjectProxy op = cntx.fetch(name); if (op.getObj() != null && klass.getAnnotation(klass) != null) names.add(name); } LinkedHashSet<String> re = new LinkedHashSet<String>(); for (String name : names) { if (Strings.isBlank(name) || "null".equals(name)) continue; re.add(name); } return re.toArray(new String[re.size()]); }
public String[] getNamesByType(Class<?> klass, IocContext context) { List<String> names = new ArrayList<String>(loader.getNamesByTypes(createLoading(), klass)); IocContext cntx; if (null == context || context == this.context) cntx = this.context; else cntx = new ComboContext(context, this.context); for (String name : cntx.names()) { ObjectProxy op = cntx.fetch(name); if (op.getObj() != null && klass.isAssignableFrom(op.getObj().getClass())) names.add(name); } LinkedHashSet<String> re = new LinkedHashSet<String>(); for (String name : names) { if (Strings.isBlank(name) || "null".equals(name)) continue; re.add(name); } return re.toArray(new String[re.size()]); }
static PojoWithArrayAndSet filledPojoWithArrayAndSet() { LinkedHashSet<Status> someEnumAsSet = new LinkedHashSet<Status>(); someEnumAsSet.add(Status.PENDING); someEnumAsSet.add(Status.STARTED); someEnumAsSet.add(Status.COMPLETED); LinkedHashSet<Bar> someBarAsSet = new LinkedHashSet<Bar>(); someBarAsSet.add(bar); someBarAsSet.add(negativeBar); LinkedHashSet<Float> someFloatAsSet = new LinkedHashSet<Float>(); someFloatAsSet.add(123.321f); someFloatAsSet.add(-456.654f); return new PojoWithArrayAndSet(someEnumAsSet, someEnumAsSet.toArray(new Status[someEnumAsSet.size()]), someBarAsSet, someBarAsSet.toArray(new Bar[someBarAsSet.size()]), someFloatAsSet, someFloatAsSet.toArray(new Float[someFloatAsSet .size()]), new Double[] { 112233.332211d, 445566.665544d }, new double[] { -112233.332211d, -445566.665544d }); }
for (String libraryName : map.keySet()) { LinkedHashSet<Class> classSet = map.get(libraryName); Class[] classArray = classSet.toArray(new Class[classSet.size()]); File[] files = generateAndCompile(classArray, libraryName, count == 0, count == map.size() - 1); if (files != null && files.length > 0) {
extensionNames.add( BaseMessages.getString( PKG, "Spoon.Dialog.OpenFile.AllFiles" ) ); String[] exts = new String[extensions.size() + 1]; exts[0] = allExtensions.toString(); System.arraycopy( extensions.toArray( new String[extensions.size()] ), 0, exts, 1, extensions.size() ); String[] extNames = new String[extensionNames.size() + 1]; extNames[0] = BaseMessages.getString( PKG, "Spoon.Dialog.OpenFile.AllTypes" ); System.arraycopy( extensionNames.toArray( new String[extensionNames.size()] ), 0, extNames, 1, extensionNames .size() );