public class EmptySpecification extends java.lang.Object implements Specification<java.lang.Object,java.lang.Object>
Modifier and Type | Field and Description |
---|---|
static EmptySpecification |
INSTANCE |
Modifier and Type | Method and Description |
---|---|
void |
apply(java.lang.Object o)
Applies the specification data to the given object
Will do nothing if the object is not of type A or B
|
java.lang.Object |
create()
Creates an instance of the reforged data object
|
java.lang.Object |
create(boolean shallow)
Creates an instance of the reforged data object
If shallow is true not all fields will be instantiated - shallow should be false by default
|
<T> java.util.Optional<Requirement<java.lang.Object,java.lang.Object,T>> |
getRequirement(java.lang.Class<? extends Requirement<java.lang.Object,java.lang.Object,T>> clazz)
Attempts to get a requirement from the specification
Will return
Optional.empty() if not found |
<T> java.util.Set<Requirement<java.lang.Object,java.lang.Object,T>> |
getRequirements(java.lang.Class<? extends Requirement<java.lang.Object,java.lang.Object,T>> clazz)
Attempts to get a list of requirements from the specification
|
<T> java.util.Optional<T> |
getValue(java.lang.Class<? extends Requirement<java.lang.Object,java.lang.Object,T>> clazz)
Attempts to get a value from the specification
Will return
Optional.empty() if not found |
boolean |
matches(java.lang.Object o)
Checks if an object matches the specification data
Will return false if the object is neither A or B
|
net.minecraft.nbt.CompoundNBT |
write(net.minecraft.nbt.CompoundNBT nbt)
Writes the specification to NBT
|
public static final EmptySpecification INSTANCE
public boolean matches(java.lang.Object o)
Specification
matches
in interface Specification<java.lang.Object,java.lang.Object>
o
- The object being checkedpublic void apply(java.lang.Object o)
Specification
apply
in interface Specification<java.lang.Object,java.lang.Object>
o
- The object being updatedpublic net.minecraft.nbt.CompoundNBT write(net.minecraft.nbt.CompoundNBT nbt)
Specification
write
in interface Specification<java.lang.Object,java.lang.Object>
nbt
- The NBT being written topublic <T> java.util.Optional<T> getValue(java.lang.Class<? extends Requirement<java.lang.Object,java.lang.Object,T>> clazz)
Specification
Optional.empty()
if not foundgetValue
in interface Specification<java.lang.Object,java.lang.Object>
T
- The type of the requirementclazz
- The data type being searched forpublic <T> java.util.Optional<Requirement<java.lang.Object,java.lang.Object,T>> getRequirement(java.lang.Class<? extends Requirement<java.lang.Object,java.lang.Object,T>> clazz)
Specification
Optional.empty()
if not foundgetRequirement
in interface Specification<java.lang.Object,java.lang.Object>
T
- The type of the requirementclazz
- The data type being searched forpublic <T> java.util.Set<Requirement<java.lang.Object,java.lang.Object,T>> getRequirements(java.lang.Class<? extends Requirement<java.lang.Object,java.lang.Object,T>> clazz)
Specification
getRequirements
in interface Specification<java.lang.Object,java.lang.Object>
T
- The type of the requirementclazz
- The data type being searched forpublic java.lang.Object create()
Specification
create
in interface Specification<java.lang.Object,java.lang.Object>
public java.lang.Object create(boolean shallow)
Specification
create
in interface Specification<java.lang.Object,java.lang.Object>