org.jsimpledb.vaadin.Util Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsimpledb-vaadin Show documentation
Show all versions of jsimpledb-vaadin Show documentation
JSimpleDB classes supporting Vaadin applications.
The newest version!
/*
* Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
*/
package org.jsimpledb.vaadin;
import com.google.common.base.Preconditions;
import java.util.SortedMap;
import java.util.TreeMap;
import org.jsimpledb.JClass;
import org.jsimpledb.JField;
/**
* Utility routines.
*/
final class Util {
private Util() {
}
/**
* Get the {@link JField}s that are common to all of the given types.
*
* @param jclasses types to inspect
* @return map containing common {@link JField}s, or null if {@code jclasses} is empty
*/
static SortedMap getCommonJFields(Iterable extends JClass>> jclasses) {
Preconditions.checkArgument(jclasses != null, "null jclasses");
TreeMap jfields = null;
for (JClass> jclass : jclasses) { // TODO: keep only fields with the same name; prefer indexed (sub-)fields
if (jfields == null)
jfields = new TreeMap<>(jclass.getJFieldsByStorageId());
else
jfields.keySet().retainAll(jclass.getJFieldsByStorageId().keySet());
}
return jfields;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy