Module org.mule.runtime.dsl.api
Class DefaultComponentLocation
java.lang.Object
org.mule.runtime.dsl.api.component.config.DefaultComponentLocation
- All Implemented Interfaces:
Serializable,org.mule.runtime.api.component.location.ComponentLocation
@NoExtend
public class DefaultComponentLocation
extends Object
implements org.mule.runtime.api.component.location.ComponentLocation, Serializable
A component location describes where the component is defined in the configuration of the artifact.
For instance:
- COMPONENT_NAME - global component defined with name COMPONENT_NAME
- FLOW_NAME/source - a source defined within a flow
- FLOW_NAME/processors/0 - the first processor defined within a flow with name FLOW_NAME
- FLOW_NAME/processors/4/1 - the first processors defined inside another processor which is positioned fifth within a flow with name FLOW_NAME
- FLOW_NAME/errorHandler/0 - the first on-error within the error handler
- FLOW_NAME/0/errorHandler/3 - the third on-error within the error handler of the first element of the flow with name FLOW_NAME
DefaultComponentLocation.DefaultLocationParts in FLOW_NAME/processors/1 are:
- 'processors' as partPath and no component identifier since this part is synthetic to indicate the part of the flow referenced by the next index
- '1' as partPath and 'mule:payload' as component identifier assuming that the second processor of the flow was a set-payload component
- Since:
- 4.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA location part represent an specific location of a component within another component. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultComponentLocation(Optional<String> name, List<DefaultComponentLocation.DefaultLocationPart> parts) DefaultComponentLocation(Optional<String> name, List<DefaultComponentLocation.DefaultLocationPart> parts, List<URI> importChain) -
Method Summary
Modifier and TypeMethodDescriptionappendConnectionPart(Optional<org.mule.runtime.api.component.TypedComponentIdentifier> partIdentifier, Optional<String> fileName, OptionalInt lineInFile, OptionalInt startColumn) Utility method that adds a connection part to the location.appendLocationPart(String partPath, Optional<org.mule.runtime.api.component.TypedComponentIdentifier> partIdentifier, Optional<String> fileName, Optional<Integer> lineInFile, Optional<Integer> startColumn) Deprecated.appendLocationPart(String partPath, Optional<org.mule.runtime.api.component.TypedComponentIdentifier> partIdentifier, Optional<String> fileName, OptionalInt lineInFile, OptionalInt startColumn) Creates a new instance of ComponentLocation adding the specified part.Utility method that adds a processors part to the location.Utility method that adds a router part to the location.protected org.mule.runtime.api.component.TypedComponentIdentifierbooleanstatic org.mule.runtime.api.component.location.ComponentLocationCreates a virtualComponentLocationfor a single element, using the core namespace and using UNKNOWN as type.static DefaultComponentLocationfromSingleComponent(String component) Deprecated.usefrom(String)instead.org.mule.runtime.api.component.TypedComponentIdentifiergetLine()getName()List<org.mule.runtime.api.component.location.LocationPart>getParts()inthashCode()toString()
-
Field Details
-
LOCATION_PART_SEPARATOR
- See Also:
-
-
Constructor Details
-
DefaultComponentLocation
public DefaultComponentLocation(Optional<String> name, List<DefaultComponentLocation.DefaultLocationPart> parts) - Parameters:
name- the name of the global element in which the specific component is located.parts- the set of parts to locate the component.
-
DefaultComponentLocation
public DefaultComponentLocation(Optional<String> name, List<DefaultComponentLocation.DefaultLocationPart> parts, List<URI> importChain) - Parameters:
name- the name of the global element in which the specific component is located.parts- the set of parts to locate the component.importChain- aListcontaining an element for the location of everyimporttag leading to the file containing the owning component.
-
-
Method Details
-
from
Creates a virtualComponentLocationfor a single element, using the core namespace and using UNKNOWN as type. Only meant for situations where a real location cannot be obtained.- Parameters:
component- the name of the element- Returns:
- a location for it
- Since:
- 1.4.0
-
fromSingleComponent
Deprecated.usefrom(String)instead.Creates a virtualComponentLocationfor a single element, using the core namespace and using UNKNOWN as type. Only meant for situations where a real location cannot be obtained.- Parameters:
component- the name of the element- Returns:
- a location for it
-
getName
-
getParts
- Specified by:
getPartsin interfaceorg.mule.runtime.api.component.location.ComponentLocation
-
getComponentIdentifier
public org.mule.runtime.api.component.TypedComponentIdentifier getComponentIdentifier()- Specified by:
getComponentIdentifierin interfaceorg.mule.runtime.api.component.location.ComponentLocation
-
getFileName
- Specified by:
getFileNamein interfaceorg.mule.runtime.api.component.location.ComponentLocation
-
getImportChain
- Specified by:
getImportChainin interfaceorg.mule.runtime.api.component.location.ComponentLocation
-
getLineInFile
- Specified by:
getLineInFilein interfaceorg.mule.runtime.api.component.location.ComponentLocation
-
getStartColumn
- Specified by:
getStartColumnin interfaceorg.mule.runtime.api.component.location.ComponentLocation
-
getLine
- Specified by:
getLinein interfaceorg.mule.runtime.api.component.location.ComponentLocation
-
getColumn
- Specified by:
getColumnin interfaceorg.mule.runtime.api.component.location.ComponentLocation
-
getLocation
- Specified by:
getLocationin interfaceorg.mule.runtime.api.component.location.ComponentLocation- Returns:
- a string representation of the
DefaultComponentLocation.
-
getRootContainerName
- Specified by:
getRootContainerNamein interfaceorg.mule.runtime.api.component.location.ComponentLocation
-
appendLocationPart
public DefaultComponentLocation appendLocationPart(String partPath, Optional<org.mule.runtime.api.component.TypedComponentIdentifier> partIdentifier, Optional<String> fileName, OptionalInt lineInFile, OptionalInt startColumn) Creates a new instance of ComponentLocation adding the specified part.- Parameters:
partPath- the path of this partpartIdentifier- the component identifier of the part if it's not a synthetic partfileName- the file name in which the component was definedlineInFile- the line number in which the component was definedstartColumn- the column number in which the component was defined- Returns:
- a new instance with the given location part appended.
- Since:
- 1.3
-
appendLocationPart
@Deprecated public DefaultComponentLocation appendLocationPart(String partPath, Optional<org.mule.runtime.api.component.TypedComponentIdentifier> partIdentifier, Optional<String> fileName, Optional<Integer> lineInFile, Optional<Integer> startColumn) Deprecated.since 1.3 useappendLocationPart(String, Optional, Optional, OptionalInt, OptionalInt)instead.Creates a new instance of ComponentLocation adding the specified part.- Parameters:
partPath- the path of this partpartIdentifier- the component identifier of the part if it's not a synthetic part- Returns:
- a new instance with the given location part appended.
-
appendProcessorsPart
Utility method that adds a processors part to the location. This is the part used for nested processors in configuration components.- Returns:
- a new instance with the processors location part appended.
-
appendRoutePart
Utility method that adds a router part to the location. This is the part used for nested processors in configuration components.- Returns:
- a new instance with the processors location part appended.
-
appendConnectionPart
public DefaultComponentLocation appendConnectionPart(Optional<org.mule.runtime.api.component.TypedComponentIdentifier> partIdentifier, Optional<String> fileName, OptionalInt lineInFile, OptionalInt startColumn) Utility method that adds a connection part to the location. Keep in mind that this method in no way validates that the actual location is a valid one. Clients should add the required logic before calling this method to make sure that the final location corresponds to a correct element.- Returns:
- a new instance with the connection location part appended.
-
calculateComponentIdentifier
protected org.mule.runtime.api.component.TypedComponentIdentifier calculateComponentIdentifier(List<DefaultComponentLocation.DefaultLocationPart> parts) -
equals
-
hashCode
public int hashCode() -
toString
-
appendLocationPart(String, Optional, Optional, OptionalInt, OptionalInt)instead.