aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/mammoth/tests/documents/DocumentElementMakers.java
blob: f2d5317cf66cbae9f7267c8e162b233b0ccb29c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package org.zwobble.mammoth.tests.documents;

import com.google.common.collect.ImmutableList;
import com.natpryce.makeiteasy.Instantiator;
import com.natpryce.makeiteasy.Property;
import com.natpryce.makeiteasy.PropertyLookup;
import org.zwobble.mammoth.documents.DocumentElement;
import org.zwobble.mammoth.documents.HasChildren;
import org.zwobble.mammoth.documents.Paragraph;

import java.util.List;
import java.util.Optional;

import static com.natpryce.makeiteasy.Property.newProperty;

public class DocumentElementMakers {
    public static final Property<HasChildren, List<DocumentElement>> CHILDREN = newProperty();

    public static final Instantiator<Paragraph> PARAGRAPH = new Instantiator<Paragraph>() {
        @Override
        public Paragraph instantiate(PropertyLookup<Paragraph> propertyLookup) {
            return new Paragraph(
                Optional.empty(),
                propertyLookup.valueOf(CHILDREN, ImmutableList.of()));
        }
    };
}