Package org.pgcodekeeper.core.schema
Class PgObjLocation
java.lang.Object
org.pgcodekeeper.core.ContextLocation
org.pgcodekeeper.core.schema.PgObjLocation
- All Implemented Interfaces:
Serializable
Represents the location of a database object in source code.
Contains position information, object details, and context for parsing and analysis.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder class for constructing PgObjLocation instances.static enumEnumeration of location types for database objects. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleancompare(PgObjLocation loc) Compares this location with another location for equality.copyWithOffset(int offset, int lineOffset, int inLineOffset, String filePath) Creates a copy of this location with adjusted position offsets.booleanCompares this location with another object for equality.Gets the column name.getObj()intGets the object name.Gets the fully qualified name of the object.Gets the schema name.getSql()getTable()Gets the table name.getType()Gets the database object type.inthashCode()Computes a hash code based on all location attributes.booleanisDanger()Checks if this location has a danger warning.booleanisGlobal()Checks if this location represents a global reference.voidsetWarning(DangerStatement danger) toString()Methods inherited from class org.pgcodekeeper.core.ContextLocation
getCharPositionInLine, getFilePath, getLineNumber, getOffset
-
Method Details
-
equals
Description copied from class:ContextLocationCompares this location with another object for equality.- Overrides:
equalsin classContextLocation- Parameters:
obj- the object to compare with- Returns:
- true if the other object is a ContextLocation with identical file path, offset, line number and character position
-
hashCode
public int hashCode()Description copied from class:ContextLocationComputes a hash code based on all location attributes.- Overrides:
hashCodein classContextLocation- Returns:
- a hash code value for this location
-
setWarning
-
isDanger
public boolean isDanger()Checks if this location has a danger warning.- Returns:
- true if there is a danger warning
-
getDanger
-
getObj
-
getObjLength
public int getObjLength() -
getAction
-
getSql
-
getLocationType
-
isGlobal
public boolean isGlobal()Checks if this location represents a global reference.- Returns:
- true if the location is a definition or reference type
-
getObjName
Gets the object name.- Returns:
- object name or empty string if no object
-
getSchema
Gets the schema name.- Returns:
- schema name or null if no object
-
getTable
Gets the table name.- Returns:
- table name or null if no object
-
getColumn
Gets the column name.- Returns:
- column name or null if no object
-
getType
Gets the database object type.- Returns:
- object type or null if no object
-
getQualifiedName
Gets the fully qualified name of the object.- Returns:
- qualified name or null if no object
-
getBareName
- Returns:
- name stripped of arguments for function signatures
-
compare
Compares this location with another location for equality.- Parameters:
loc- the location to compare with- Returns:
- true if the locations refer to the same object
-
copyWithOffset
Creates a copy of this location with adjusted position offsets.- Parameters:
offset- the offset adjustmentlineOffset- the line number adjustmentinLineOffset- the character position adjustmentfilePath- the new file path- Returns:
- a new PgObjLocation with adjusted position
-
toString
-