PartsMap and TextsMap now delegate to Map.
This commit is contained in:
parent
e6b603fd69
commit
fd49b34756
@ -1,22 +1,18 @@
|
|||||||
package com.jessebrault.ssg.part
|
package com.jessebrault.ssg.part
|
||||||
|
|
||||||
|
import groovy.transform.ToString
|
||||||
|
|
||||||
|
@ToString(includeFields = true)
|
||||||
class PartsMap {
|
class PartsMap {
|
||||||
|
|
||||||
|
@Delegate
|
||||||
private final Map<String, EmbeddablePart> partsMap = [:]
|
private final Map<String, EmbeddablePart> partsMap = [:]
|
||||||
|
|
||||||
PartsMap(Collection<Part> parts) {
|
PartsMap(Collection<Part> parts) {
|
||||||
Objects.requireNonNull(parts)
|
Objects.requireNonNull(parts)
|
||||||
parts.each {
|
parts.each {
|
||||||
this.partsMap.put(it.name, new EmbeddablePart(it))
|
this.put(it.name, new EmbeddablePart(it))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EmbeddablePart get(String name) {
|
|
||||||
this.partsMap.get(Objects.requireNonNull(name))
|
|
||||||
}
|
|
||||||
|
|
||||||
EmbeddablePart getAt(String name) {
|
|
||||||
this.get(Objects.requireNonNull(name))
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,18 @@
|
|||||||
package com.jessebrault.ssg.text
|
package com.jessebrault.ssg.text
|
||||||
|
|
||||||
|
import groovy.transform.ToString
|
||||||
|
|
||||||
|
@ToString(includeFields = true)
|
||||||
class TextsMap {
|
class TextsMap {
|
||||||
|
|
||||||
|
@Delegate
|
||||||
private final Map<String, EmbeddableText> textsMap = [:]
|
private final Map<String, EmbeddableText> textsMap = [:]
|
||||||
|
|
||||||
TextsMap(Collection<Text> texts) {
|
TextsMap(Collection<Text> texts) {
|
||||||
Objects.requireNonNull(texts)
|
Objects.requireNonNull(texts)
|
||||||
texts.each {
|
texts.each {
|
||||||
this.textsMap.put(it.path, new EmbeddableText(it))
|
this.put(it.path, new EmbeddableText(it))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EmbeddableText get(String path) {
|
|
||||||
this.textsMap.get(Objects.requireNonNull(path))
|
|
||||||
}
|
|
||||||
|
|
||||||
EmbeddableText getAt(String path) {
|
|
||||||
this.get(Objects.requireNonNull(path))
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user