Class InvalidSelector
- java.lang.Object
-
- org.spongepowered.asm.mixin.injection.selectors.InvalidSelector
-
- All Implemented Interfaces:
ITargetSelector
public class InvalidSelector extends java.lang.Object implements ITargetSelector
Since the contract ofTargetSelector.parse(java.lang.Iterable<?>, org.spongepowered.asm.mixin.injection.selectors.ISelectorContext)prohibits returing null, instances of this selector are returned when supplied arguments are unparseable in order to throw exceptions only during validation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.spongepowered.asm.mixin.injection.selectors.ITargetSelector
ITargetSelector.Configure
-
-
Constructor Summary
Constructors Constructor Description InvalidSelector(java.lang.String input)InvalidSelector(java.lang.Throwable cause)InvalidSelector(java.lang.Throwable cause, java.lang.String input)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ITargetSelectorattach(ISelectorContext context)Attach this selector to the specified context.ITargetSelectorconfigure(ITargetSelector.Configure request, java.lang.String... args)Configure and return a modified version of this selector by consuming the supplied arguments.intgetMaxMatchCount()Maximum number of candidates this selector can matchintgetMinMatchCount()Minimum number of candidates this selector must match<TNode> MatchResultmatch(ElementNode<TNode> node)Test whether this selector matches the supplied element nodeITargetSelectornext()Get the next target selector in this path (or null if this selector is the last selector in the chain.java.lang.StringtoString()ITargetSelectorvalidate()Perform basic sanity-check validation of the selector, checks that the parsed out parameters are basically sane
-
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
next
public ITargetSelector next()
Description copied from interface:ITargetSelectorGet the next target selector in this path (or null if this selector is the last selector in the chain. Called at recurse points in the subject in order to match against the child subject.Can return null
- Specified by:
nextin interfaceITargetSelector
-
configure
public ITargetSelector configure(ITargetSelector.Configure request, java.lang.String... args)
Description copied from interface:ITargetSelectorConfigure and return a modified version of this selector by consuming the supplied arguments. Results from this method should be idempotent in terms of the configuration of the returned object, but do not have to necessarily return the same object if the callee already matches the supplied configuration, or if the requested mutation is not supported by the selector, though this is generally the case.In other words, calling configure(Configure.ORPHAN) when this object is already an orphan or does not support orphaning, may simply return this object, or might return an identically-configured copy.
Must not return null, defaults to returning unmodified selector.
- Specified by:
configurein interfaceITargetSelector- Parameters:
request- Requested operationargs- Configuration arguments- Returns:
- Configured selector, may return this selector if the specified condition is already satisfied
-
validate
public ITargetSelector validate() throws InvalidSelectorException
Description copied from interface:ITargetSelectorPerform basic sanity-check validation of the selector, checks that the parsed out parameters are basically sane- Specified by:
validatein interfaceITargetSelector- Returns:
- fluent (this selector)
- Throws:
InvalidSelectorException- if any sanity check fails
-
attach
public ITargetSelector attach(ISelectorContext context) throws InvalidSelectorException
Description copied from interface:ITargetSelectorAttach this selector to the specified context. Should return this selector unmodified if all is well, or a new selector to be used for further processing of the supplied context. If the supplied context is invalid, anInvalidSelectorExceptionis thrown.- Specified by:
attachin interfaceITargetSelector- Parameters:
context- Context to attach to- Returns:
- Attached selector
- Throws:
InvalidSelectorException
-
getMinMatchCount
public int getMinMatchCount()
Description copied from interface:ITargetSelectorMinimum number of candidates this selector must match- Specified by:
getMinMatchCountin interfaceITargetSelector
-
getMaxMatchCount
public int getMaxMatchCount()
Description copied from interface:ITargetSelectorMaximum number of candidates this selector can match- Specified by:
getMaxMatchCountin interfaceITargetSelector
-
match
public <TNode> MatchResult match(ElementNode<TNode> node)
Description copied from interface:ITargetSelectorTest whether this selector matches the supplied element node- Specified by:
matchin interfaceITargetSelector- Type Parameters:
TNode- node type- Parameters:
node- node node to test- Returns:
- true if this selector can match the supplied field
-
-