@Encoding.Naming(standard = Encoding.StandardNaming.ADD) @Encoding.Init void add( final T element) { this.set = this.set.add(element); }
@Encoding.Naming(standard = Encoding.StandardNaming.ADD_ALL) @Encoding.Init void addAll( final Iterable<T> element) { this.set = this.set.addAll(element); }
/** * Check preconditions for the type. */ @Value.Check default void checkPreconditions() { final SortedSet<SMFAttributeName> both = this.requiredAttributes().keySet().intersect( this.optionalAttributes().keySet()); Preconditions.checkPrecondition( both, both.isEmpty(), s -> "The intersection of the required and optional attributes must be empty"); } }
private void failMissedAttributes() { final Set<SMFAttributeName> names = this.header.attributesByName().keySet().diff( this.attributes_attempted.keySet()); if (!names.isEmpty()) { names.forEach( name -> this.fail( "No data specified for attribute: " + name.value(), Optional.empty())); } }
@Override public SMFSerializerType serializerCreate( final SMFFormatVersion version, final Path path, final OutputStream stream) throws UnsupportedOperationException { if (SUPPORTED.contains(version)) { return new SMFTV1Serializer(version, path, stream); } throw new UnsupportedOperationException( String.format( "Version %d.%d is not supported", Integer.valueOf(version.major()), Integer.valueOf(version.minor()))); }
/** * Check preconditions for the type. */ @Value.Check default void checkPreconditions() { final SortedSet<SMFAttributeName> both = this.requiredAttributes().keySet().intersect( this.optionalAttributes().keySet()); Preconditions.checkPrecondition( both, both.isEmpty(), s -> "The intersection of the required and optional attributes must be empty"); } }