@JsonCreator public static Domain create( @JsonProperty("values") ValueSet values, @JsonProperty("nullAllowed") boolean nullAllowed) { return new Domain(values, nullAllowed); }
public static Domain none(Type type) { return new Domain(ValueSet.none(type), false); }
public static Domain all(Type type) { return new Domain(ValueSet.all(type), true); }
public static Domain onlyNull(Type type) { return new Domain(ValueSet.none(type), true); }
public static Domain singleValue(Type type, Object value) { return new Domain(ValueSet.of(type, value), false); }
public static Domain notNull(Type type) { return new Domain(ValueSet.all(type), false); }
public Domain complement() { return new Domain(values.complement(), !nullAllowed); }
public static Domain multipleValues(Type type, List<Object> values) { if (values.isEmpty()) { throw new IllegalArgumentException("values cannot be empty"); } if (values.size() == 1) { return singleValue(type, values.get(0)); } return new Domain(ValueSet.of(type, values.get(0), values.subList(1, values.size()).toArray()), false); }
public static Domain union(List<Domain> domains) { if (domains.isEmpty()) { throw new IllegalArgumentException("domains cannot be empty for union"); } if (domains.size() == 1) { return domains.get(0); } boolean nullAllowed = false; List<ValueSet> valueSets = new ArrayList<>(domains.size()); for (Domain domain : domains) { valueSets.add(domain.getValues()); nullAllowed = nullAllowed || domain.nullAllowed; } ValueSet unionedValues = valueSets.get(0).union(valueSets.subList(1, valueSets.size())); return new Domain(unionedValues, nullAllowed); }
public Domain intersect(Domain other) { checkCompatibility(other); return new Domain(values.intersect(other.getValues()), this.isNullAllowed() && other.isNullAllowed()); }
public Domain union(Domain other) { checkCompatibility(other); return new Domain(values.union(other.getValues()), this.isNullAllowed() || other.isNullAllowed()); }
public Domain subtract(Domain other) { checkCompatibility(other); return new Domain(values.subtract(other.getValues()), this.isNullAllowed() && !other.isNullAllowed()); }
QNameMap qmap = new QNameMap(); qmap.setDefaultNamespace("http://libvirt.org/schemas/domain/qemu/1.0"); qmap.setDefaultPrefix("qemu"); StaxDriver staxDriver = new StaxDriver(qmap); XStream xstream = new XStream(staxDriver); xstream.autodetectAnnotations(true); xstream.alias("domain", Domain.class); Domain d = new Domain("kvm","linux"); String xml = xstream.toXML(d);
class DomainService(){ def persistAndGetNewDomain(){ new Domain().save(flush:true) } }
@JsonCreator public static Domain create( @JsonProperty("values") ValueSet values, @JsonProperty("nullAllowed") boolean nullAllowed) { return new Domain(values, nullAllowed); }
Domain domain = new Domain(); domain.setName(domainString); domainFacade.create(domain); List<Domain> domains = new ArrayList<Domain>(); domains.add(domain); problem.setDomains(domains); problemFacade.create(problem);
public Domain union(Domain other) { checkCompatibility(other); return new Domain(values.union(other.getValues()), this.isNullAllowed() || other.isNullAllowed()); }
public Domain subtract(Domain other) { checkCompatibility(other); return new Domain(values.subtract(other.getValues()), this.isNullAllowed() && !other.isNullAllowed()); }
public Domain intersect(Domain other) { checkCompatibility(other); return new Domain(values.intersect(other.getValues()), this.isNullAllowed() && other.isNullAllowed()); }