The getIdentifier() (now getName()) method was calling toCql(), now it

just returns the internal variable. Changed the member variable from
identifier to name. This makes if match the way it is used in the code.
This commit is contained in:
john-mcpeek
2014-02-11 22:38:22 -05:00
parent 3dd7e532ef
commit 5449d0c276
7 changed files with 20 additions and 20 deletions

View File

@@ -10,7 +10,7 @@ public class CqlIdentifier {
public static final String QUOTED_IDENTIFIER_REGEX = "[a-zA-Z_]([a-zA-Z0-9_]|\"{2}+)*";
public static final Pattern QUOTED_IDENTIFIER_PATTERN = Pattern.compile(QUOTED_IDENTIFIER_REGEX);
private String identifier;
private String name;
private boolean quoted;
public CqlIdentifier(String identifier) {
@@ -26,19 +26,19 @@ public class CqlIdentifier {
* <li>If the given identifier is illegal, an {@link IllegalArgumentException} is thrown.</li>
* </ul>
*/
public CqlIdentifier(String identifier, boolean forceQuoting) {
if (isUnquotedIdentifier(identifier) && forceQuoting == false) {
this.identifier = identifier;
} else if (isQuotedIdentifier(identifier)) {
this.identifier = identifier;
public CqlIdentifier(String name, boolean forceQuoting) {
if (isUnquotedIdentifier(name) && forceQuoting == false) {
this.name = name;
} else if (isQuotedIdentifier(name)) {
this.name = name;
quoted = true;
} else {
throw new IllegalArgumentException("[" + identifier + "] is not a valid CQL quoted or unquoted identifier");
throw new IllegalArgumentException("[" + name + "] is not a valid CQL quoted or unquoted identifier");
}
}
public String toCql() {
String id = quoted ? CqlStringUtils.doubleQuote(identifier) : identifier;
String id = quoted ? CqlStringUtils.doubleQuote(name) : name;
return id;
}
@@ -51,8 +51,8 @@ public class CqlIdentifier {
return toCql();
}
public String getIdentifier() {
return toCql();
public String getName() {
return name;
}
public boolean isQuoted() {
@@ -85,7 +85,7 @@ public class CqlIdentifier {
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((identifier == null) ? 0 : identifier.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + (quoted ? 1231 : 1237);
return result;
}
@@ -99,10 +99,10 @@ public class CqlIdentifier {
if (getClass() != obj.getClass())
return false;
CqlIdentifier other = (CqlIdentifier) obj;
if (identifier == null) {
if (other.identifier != null)
if (name == null) {
if (other.name != null)
return false;
} else if (!identifier.equals(other.identifier))
} else if (!name.equals(other.name))
return false;
if (quoted != other.quoted)
return false;

View File

@@ -35,7 +35,7 @@ public abstract class ColumnChangeSpecification {
}
public String getName() {
return identifier.getIdentifier();
return identifier.getName();
}
public String getNameAsIdentifier() {

View File

@@ -146,7 +146,7 @@ public class ColumnSpecification {
}
public String getName() {
return identifier.getIdentifier();
return identifier.getName();
}
public String getNameAsIdentifier() {

View File

@@ -92,7 +92,7 @@ public class CreateIndexSpecification extends IndexNameSpecification<CreateIndex
}
public String getTableName() {
return identifier.getIdentifier();
return identifier.getName();
}
public String getTableNameAsIdentifier() {

View File

@@ -42,7 +42,7 @@ public abstract class IndexNameSpecification<T extends IndexNameSpecification<T>
}
public String getName() {
return identifier.getIdentifier();
return identifier.getName();
}
public String getNameAsIdentifier() {

View File

@@ -28,7 +28,7 @@ public abstract class KeyspaceActionSpecification<T extends KeyspaceActionSpecif
}
public String getName() {
return identifier.getIdentifier();
return identifier.getName();
}
public String getNameAsIdentifier() {

View File

@@ -42,7 +42,7 @@ public abstract class TableNameSpecification<T extends TableNameSpecification<T>
}
public String getName() {
return identifier.getIdentifier();
return identifier.getName();
}
public String getNameAsIdentifier() {