Search in sources :

Example 1 with MappedResource

use of org.apache.tools.ant.types.resources.MappedResource in project ant by apache.

the class PropertySet method iterator.

/**
 * 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();
}
Also used : Properties(java.util.Properties) Iterator(java.util.Iterator) Enumeration(java.util.Enumeration) RegexpMatcher(org.apache.tools.ant.util.regexp.RegexpMatcher) Set(java.util.Set) HashMap(java.util.HashMap) BuildException(org.apache.tools.ant.BuildException) FileNameMapper(org.apache.tools.ant.util.FileNameMapper) Stack(java.util.Stack) ArrayList(java.util.ArrayList) RegexpMatcherFactory(org.apache.tools.ant.util.regexp.RegexpMatcherFactory) HashSet(java.util.HashSet) PropertyResource(org.apache.tools.ant.types.resources.PropertyResource) List(java.util.List) Stream(java.util.stream.Stream) TreeMap(java.util.TreeMap) MappedResource(org.apache.tools.ant.types.resources.MappedResource) Map(java.util.Map) Entry(java.util.Map.Entry) Optional(java.util.Optional) Project(org.apache.tools.ant.Project) FileNameMapper(org.apache.tools.ant.util.FileNameMapper) PropertyResource(org.apache.tools.ant.types.resources.PropertyResource) MappedResource(org.apache.tools.ant.types.resources.MappedResource) PropertyResource(org.apache.tools.ant.types.resources.PropertyResource) FileNameMapper(org.apache.tools.ant.util.FileNameMapper) MappedResource(org.apache.tools.ant.types.resources.MappedResource)

Aggregations

ArrayList (java.util.ArrayList)1 Enumeration (java.util.Enumeration)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Optional (java.util.Optional)1 Properties (java.util.Properties)1 Set (java.util.Set)1 Stack (java.util.Stack)1 TreeMap (java.util.TreeMap)1 Stream (java.util.stream.Stream)1 BuildException (org.apache.tools.ant.BuildException)1 Project (org.apache.tools.ant.Project)1 MappedResource (org.apache.tools.ant.types.resources.MappedResource)1 PropertyResource (org.apache.tools.ant.types.resources.PropertyResource)1 FileNameMapper (org.apache.tools.ant.util.FileNameMapper)1 RegexpMatcher (org.apache.tools.ant.util.regexp.RegexpMatcher)1