You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2020/06/16 09:38:50 UTC

[GitHub] [cassandra] blerer commented on a change in pull request #633: Cassandra 14825

blerer commented on a change in pull request #633:
URL: https://github.com/apache/cassandra/pull/633#discussion_r440720504



##########
File path: src/java/org/apache/cassandra/cql3/SchemaElement.java
##########
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cassandra.cql3;
+
+import java.util.Comparator;
+import java.util.Locale;
+
+import org.apache.cassandra.cql3.SchemaElement.SchemaElementType;
+
+/**
+ * A schema element (keyspace, udt, udf, uda, table, index, view).
+ */
+public interface SchemaElement
+{
+    /**
+     * Comparator used to sort {@code Describable} name.
+     */
+    Comparator<SchemaElement> NAME_COMPARATOR = (o1, o2) -> o1.getElementName().compareToIgnoreCase(o2.getElementName());
+
+    enum SchemaElementType
+    {
+        KEYSPACE,
+        TYPE,
+        FUNCTION,
+        AGGREGATE,
+        TABLE,
+        INDEX,
+        MATERIALIZED_VIEW;
+
+        @Override
+        public String toString()
+        {
+            return super.toString().toLowerCase(Locale.US);
+        }
+    }
+
+    /**
+     * Return the schema element type
+     *
+     * @return the schema element type
+     */
+    SchemaElementType getElementType();
+
+    /**
+     * Returns the CQL name of the keyspace to which this schema element belong.
+     *
+     * @return the keyspace name.
+     */
+    String getElementKeyspace();
+
+    /**
+     * Returns the CQL name of this schema element.
+     *
+     * @return the name of this schema element.
+     */
+    String getElementName();

Review comment:
       `getElementName()` cannot be renamed `name()` as it conflicts with the `name()` method in the `AbstractFunction` sub-classes. I renamed it `elementName`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org