/** * Ensures this data type is not a reference. * * <p>Calling this method as the first line of every bean method of * this data type (setXyz, addXyz, createXyz) ensure proper handling * of the refid attribute.</p> * * @throws BuildException if the refid attribute was already set, since * refid and all other attributes are mutually exclusive. */ protected final void assertNotReference() { if (isReference()) { throw tooManyAttributes(); } noAttributeSet = false; }
/** * Get the mapper attribute. * @return the mapper attribute. */ public Mapper getMapper() { if (isReference()) { return getRef().mapper; } dieOnCircularReference(); return mapper; }
/** * A debug toString. * This gets a comma separated list of key=value pairs for * the properties in the set. * The output order is sorted according to the keys' <i>natural order</i>. * @return a string rep of this object. */ @Override public String toString() { if (isReference()) { return getRef().toString(); } dieOnCircularReference(); return new TreeMap<>(getPropertyMap()).entrySet().stream() .map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.joining(", ")); }
/** * Get the dynamic attribute. * @return true if the property set is to be evaluated each time it is used. */ public boolean getDynamic() { if (isReference()) { return getRef().dynamic; } dieOnCircularReference(); return dynamic; }
/** * Fulfill the ResourceCollection contract. * @return the size of this ResourceCollection. */ @Override public int size() { return isReference() ? getRef().size() : getProperties().size(); }
/** * Fulfill the ResourceCollection contract. * @return whether this is a filesystem-only resource collection. */ @Override public boolean isFilesystemOnly() { if (isReference()) { return getRef().isFilesystemOnly(); } dieOnCircularReference(); return false; }
/** * Fulfill the ResourceCollection interface. * @return an Iterator of Resources. * @since Ant 1.7 */ @Override public Iterator<Resource> iterator() { if (isReference()) { return getRef().iterator(); } dieOnCircularReference(); Stream<Resource> result = getPropertyNames(getEffectiveProperties()) .stream().map(name -> new PropertyResource(getProject(), name)); Optional<FileNameMapper> m = Optional.ofNullable(getMapper()).map(Mapper::getImplementation); if (m.isPresent()) { result = result.map(p -> new MappedResource(p, m.get())); } return result.iterator(); }
if (isReference()) { getRef().addPropertyNames(names, props);
@Override protected synchronized void dieOnCircularReference(Stack<Object> stk, Project p) throws BuildException { if (isChecked()) { return; } if (isReference()) { super.dieOnCircularReference(stk, p); } else { if (mapper != null) { pushAndInvokeCircularReferenceCheck(mapper, stk, p); } for (PropertySet propertySet : setRefs) { pushAndInvokeCircularReferenceCheck(propertySet, stk, p); } setChecked(true); } }
if (isReference()) { return getRef().getPropertyMap();