[ONOS-4922] Javamodel package creation for YANG utils.
Change-Id: Iff1745a8c04881b44db3f2f687967f984c38e2c7
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaFileInfo.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/JavaFileInfo.java
similarity index 95%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaFileInfo.java
rename to datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/JavaFileInfo.java
index 1c37e06..8b2d49f 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaFileInfo.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/JavaFileInfo.java
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-package org.onosproject.yangutils.translator.tojava;
+package org.onosproject.yangutils.datamodel.javadatamodel;
import java.io.Serializable;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
-
/**
* Represents cached java file handle, which supports the addition of member attributes and
* methods.
@@ -75,7 +73,7 @@
* definition.
*
* @param fileTypes the types of files being generated corresponding to the
- * YANG definition
+ * YANG definition
*/
public void setGeneratedFileTypes(int fileTypes) {
genFileTypes = fileTypes;
@@ -86,7 +84,7 @@
* definition.
*
* @param fileTypes the types of files being generated corresponding to the
- * YANG definition
+ * YANG definition
*/
public void addGeneratedFileTypes(int fileTypes) {
genFileTypes |= fileTypes;
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/JavaQualifiedTypeInfo.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/JavaQualifiedTypeInfo.java
new file mode 100644
index 0000000..49208bc
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/JavaQualifiedTypeInfo.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import java.io.Serializable;
+
+/**
+ * Represents the information about individual imports in the generated file.
+ */
+public class JavaQualifiedTypeInfo
+ implements Serializable {
+
+ private static final long serialVersionUID = 806201634L;
+
+ /**
+ * Package location where the imported class/interface is defined.
+ */
+ protected String pkgInfo;
+
+ /**
+ * Class/interface being referenced.
+ */
+ protected String classInfo;
+
+ /**
+ * Returns class info.
+ *
+ * @return class info
+ */
+ public String getClassInfo() {
+ return classInfo;
+ }
+
+ /**
+ * Returns package info.
+ *
+ * @return package info
+ */
+ public String getPkgInfo() {
+ return pkgInfo;
+ }
+
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaAugment.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaAugment.java
new file mode 100644
index 0000000..b1d7e44
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaAugment.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangAugment;
+
+/**
+ * Represents YANG java augment.
+ */
+public class YangJavaAugment extends YangAugment {
+
+ private static final long serialVersionUID = 208201601L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaCase.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaCase.java
new file mode 100644
index 0000000..356825f
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaCase.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangCase;
+
+/**
+ * Represents YANG java case.
+ */
+public class YangJavaCase extends YangCase {
+
+ private static final long serialVersionUID = 208201602L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaChoice.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaChoice.java
new file mode 100644
index 0000000..1b4412d
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaChoice.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangChoice;
+
+/**
+ * Represents YANG java choice.
+ */
+public class YangJavaChoice extends YangChoice {
+
+ private static final long serialVersionUID = 208201603L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaContainer.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaContainer.java
new file mode 100644
index 0000000..5b579cd
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaContainer.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangContainer;
+
+/**
+ * Represents YANG java container.
+ */
+public class YangJavaContainer extends YangContainer {
+
+ private static final long serialVersionUID = 208201604L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaEnumeration.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaEnumeration.java
new file mode 100644
index 0000000..2fbc954
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaEnumeration.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangEnumeration;
+
+/**
+ * Represents YANG java enumeration.
+ */
+public class YangJavaEnumeration extends YangEnumeration {
+
+ private static final long serialVersionUID = 208201605L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaGrouping.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaGrouping.java
new file mode 100644
index 0000000..78088cc
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaGrouping.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangGrouping;
+
+/**
+ * Represents YANG java grouping.
+ */
+public class YangJavaGrouping extends YangGrouping {
+
+ private static final long serialVersionUID = 208201606L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaIdentity.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaIdentity.java
new file mode 100644
index 0000000..3dc6fa3
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaIdentity.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangIdentity;
+
+/**
+ * Represents YANG java identity.
+ */
+public class YangJavaIdentity extends YangIdentity {
+
+ private static final long serialVersionUID = 208201616L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaInput.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaInput.java
new file mode 100644
index 0000000..a4578cd
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaInput.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangInput;
+
+/**
+ * Represents YANG java input.
+ */
+public class YangJavaInput extends YangInput {
+
+ private static final long serialVersionUID = 208201607L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaLeaf.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaLeaf.java
new file mode 100644
index 0000000..d580091
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaLeaf.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangLeaf;
+
+/**
+ * Represent YANG java leaf.
+ */
+public class YangJavaLeaf extends YangLeaf {
+
+ private static final long serialVersionUID = 208201617L;
+
+ protected JavaQualifiedTypeInfo javaQualifiedTypeInfo;
+
+ /**
+ * Returns java qualified type info.
+ *
+ * @return java qualified type info
+ */
+ public JavaQualifiedTypeInfo getJavaQualifiedTypeInfo() {
+ return javaQualifiedTypeInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaLeafList.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaLeafList.java
new file mode 100644
index 0000000..01867da
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaLeafList.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangLeafList;
+
+/**
+ * Represents YANG java leaf list.
+ */
+public class YangJavaLeafList extends YangLeafList {
+
+ private static final long serialVersionUID = 208201618L;
+
+ protected JavaQualifiedTypeInfo javaQualifiedTypeInfo;
+
+ /**
+ * Returns java qualified type info.
+ *
+ * @return java qualified type info
+ */
+ public JavaQualifiedTypeInfo getJavaQualifiedTypeInfo() {
+ return javaQualifiedTypeInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaList.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaList.java
new file mode 100644
index 0000000..499f89f
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaList.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangList;
+
+/**
+ * Represent YANG java list.
+ */
+public class YangJavaList extends YangList {
+
+ private static final long serialVersionUID = 208201608L;
+
+ /**
+ * Contains the information of the java file being generated.
+ */
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaModule.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaModule.java
new file mode 100644
index 0000000..46915db
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaModule.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangModule;
+
+/**
+ * Represents YANG java module.
+ */
+public class YangJavaModule extends YangModule {
+
+ private static final long serialVersionUID = 208201609L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaNotification.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaNotification.java
new file mode 100644
index 0000000..653f37b
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaNotification.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangNotification;
+
+/**
+ * Represents YANG java notification.
+ */
+public class YangJavaNotification extends YangNotification {
+
+ private static final long serialVersionUID = 208201610L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaOutput.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaOutput.java
new file mode 100644
index 0000000..08fe3bd
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaOutput.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangOutput;
+
+/**
+ * Represents YANG java output.
+ */
+public class YangJavaOutput extends YangOutput {
+
+ private static final long serialVersionUID = 208201611L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaRpc.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaRpc.java
new file mode 100644
index 0000000..382f36c
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaRpc.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangRpc;
+
+/**
+ * Represents YANG java rpc.
+ */
+public class YangJavaRpc extends YangRpc {
+
+ private static final long serialVersionUID = 208201612L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaSubModule.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaSubModule.java
new file mode 100644
index 0000000..34d90c4
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaSubModule.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangSubModule;
+
+/**
+ * Represents YANG java submodule.
+ */
+public class YangJavaSubModule extends YangSubModule {
+
+ private static final long serialVersionUID = 208201612L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaType.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaType.java
new file mode 100644
index 0000000..3fd2fb6
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaType.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangType;
+
+/**
+ * Represents YANG java type.
+ */
+public class YangJavaType extends YangType {
+
+ protected JavaQualifiedTypeInfo javaQualifiedTypeInfo;
+
+ /**
+ * Returns java qualified type info.
+ *
+ * @return java qualified type info
+ */
+ public JavaQualifiedTypeInfo getJavaQualifiedTypeInfo() {
+ return javaQualifiedTypeInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaTypeDef.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaTypeDef.java
new file mode 100644
index 0000000..345d53b
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaTypeDef.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangTypeDef;
+
+/**
+ * Represents YANG java typedef.
+ */
+public class YangJavaTypeDef extends YangTypeDef {
+
+ private static final long serialVersionUID = 208201613L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaUnion.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaUnion.java
new file mode 100644
index 0000000..1111d48
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaUnion.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangUnion;
+
+/**
+ * Represent YANG java union.
+ */
+public class YangJavaUnion extends YangUnion {
+
+ private static final long serialVersionUID = 208201614L;
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaUses.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaUses.java
new file mode 100644
index 0000000..1e1e363
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangJavaUses.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.onosproject.yangutils.datamodel.javadatamodel;
+
+import org.onosproject.yangutils.datamodel.YangUses;
+
+/**
+ * Represent YANG java uses.
+ */
+public class YangJavaUses extends YangUses {
+
+ private static final long serialVersionUID = 208201615L;
+
+ protected JavaFileInfo javaFileInfo;
+
+ /**
+ * Returns java file info.
+ *
+ * @return java file info
+ */
+ public JavaFileInfo getJavaFileInfo() {
+ return javaFileInfo;
+ }
+}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangPluginConfig.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangPluginConfig.java
similarity index 97%
rename from plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangPluginConfig.java
rename to datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangPluginConfig.java
index 963bb8d..44ce306 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangPluginConfig.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangPluginConfig.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yangutils.utils.io.impl;
+package org.onosproject.yangutils.datamodel.javadatamodel;
/**
* Representation of plugin configurations required for YANG utils.
diff --git a/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangToJavaNamingConflictUtil.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangToJavaNamingConflictUtil.java
similarity index 97%
rename from plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangToJavaNamingConflictUtil.java
rename to datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangToJavaNamingConflictUtil.java
index d7b32e9..3bfd360 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangToJavaNamingConflictUtil.java
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/YangToJavaNamingConflictUtil.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.onosproject.yangutils.utils.io.impl;
+package org.onosproject.yangutils.datamodel.javadatamodel;
/**
* Representation of YANG to java naming conflict resolver util.
diff --git a/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/package-info.java b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/package-info.java
new file mode 100644
index 0000000..273febd
--- /dev/null
+++ b/datamodel/src/main/java/org/onosproject/yangutils/datamodel/javadatamodel/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016-present Open Networking Laboratory
+ *
+ * Licensed 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.
+ */
+
+/**
+ * Representation of YANG java data model.
+ */
+package org.onosproject.yangutils.datamodel.javadatamodel;
diff --git a/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java b/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
index 3e58009..deef94e 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/plugin/manager/YangUtilManager.java
@@ -39,8 +39,8 @@
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
-import org.onosproject.yangutils.utils.io.impl.YangToJavaNamingConflictUtil;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
import org.sonatype.plexus.build.incremental.BuildContext;
import static org.apache.maven.plugins.annotations.LifecyclePhase.GENERATE_SOURCES;
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaAttributeInfo.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaAttributeInfo.java
index c6b3bb7..0f64e2f 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaAttributeInfo.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaAttributeInfo.java
@@ -48,7 +48,7 @@
* The class info will be used to set the attribute type and package info
* will be use for qualified name.
*/
- private JavaQualifiedTypeInfo importInfo;
+ private JavaQualifiedTypeInfoTranslator importInfo;
/**
* If conflict occurs.
@@ -69,9 +69,9 @@
/**
* Creates object of java attribute info.
*
- * @param attrType YANG type
- * @param name attribute name
- * @param isListAttr is list attribute
+ * @param attrType YANG type
+ * @param name attribute name
+ * @param isListAttr is list attribute
* @param isQualifiedName is qualified name
*/
public JavaAttributeInfo(YangType<?> attrType, String name, boolean isListAttr, boolean isQualifiedName) {
@@ -139,7 +139,7 @@
*
* @param isList if the added attribute is a list of info
*/
- public void setListAttr(boolean isList) {
+ private void setListAttr(boolean isList) {
isListAttr = isList;
}
@@ -159,9 +159,9 @@
* manner.
*
* @param isQualified if the added attribute has to be accessed in a fully
- * qualified manner
+ * qualified manner
*/
- public void setIsQualifiedAccess(boolean isQualified) {
+ private void setIsQualifiedAccess(boolean isQualified) {
isQualifiedName = isQualified;
}
@@ -171,7 +171,7 @@
*
* @return import info
*/
- public JavaQualifiedTypeInfo getImportInfo() {
+ public JavaQualifiedTypeInfoTranslator getImportInfo() {
return importInfo;
}
@@ -180,59 +180,60 @@
*
* @param importInfo import info for the attribute type
*/
- public void setImportInfo(JavaQualifiedTypeInfo importInfo) {
+ public void setImportInfo(JavaQualifiedTypeInfoTranslator importInfo) {
this.importInfo = importInfo;
}
/**
- * Returns true if conflict between int and uint.
+ * Returns true if conflict between int and uInt.
*
- * @return true if conflict between int and uint
+ * @return true if conflict between int and uInt
*/
public boolean isIntConflict() {
return isIntConflict;
}
/**
- * Sets true if conflict between int and uint.
+ * Sets true if conflict between int and uInt.
*
- * @param intConflict true if conflict between int and uint
+ * @param intConflict true if conflict between int and uInt
*/
- public void setIntConflict(boolean intConflict) {
+ void setIntConflict(boolean intConflict) {
isIntConflict = intConflict;
}
/**
- * Returns true if conflict between long and ulong.
+ * Returns true if conflict between long and uLong.
*
- * @return true if conflict between long and ulong
+ * @return true if conflict between long and uLong
*/
public boolean isLongConflict() {
return isLongConflict;
}
/**
- * Sets true if conflict between long and ulong.
+ * Sets true if conflict between long and uLong.
*
- * @param longConflict true if conflict between long and ulong
+ * @param longConflict true if conflict between long and uLong
*/
- public void setLongConflict(boolean longConflict) {
+ void setLongConflict(boolean longConflict) {
isLongConflict = longConflict;
}
/**
* Returns java attribute info.
*
- * @param importInfo java qualified type info
- * @param attributeName attribute name
- * @param attributeType attribute type
+ * @param importInfo java qualified type info
+ * @param attributeName attribute name
+ * @param attributeType attribute type
* @param isQualifiedAccess is the attribute a qualified access
- * @param isListAttribute is list attribute
+ * @param isListAttribute is list attribute
* @return java attribute info.
*/
- public static JavaAttributeInfo getAttributeInfoForTheData(JavaQualifiedTypeInfo importInfo, String attributeName,
- YangType<?> attributeType, boolean isQualifiedAccess,
- boolean isListAttribute) {
+ public static JavaAttributeInfo getAttributeInfoForTheData(JavaQualifiedTypeInfoTranslator importInfo,
+ String attributeName,
+ YangType<?> attributeType, boolean isQualifiedAccess,
+ boolean isListAttribute) {
JavaAttributeInfo newAttr = new JavaAttributeInfo();
newAttr.setImportInfo(importInfo);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGenerator.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGenerator.java
index 1e0b14f..9993b9f 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGenerator.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGenerator.java
@@ -17,7 +17,7 @@
package org.onosproject.yangutils.translator.tojava;
import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
/**
* Abstraction of an entity which provides Code generator functionalities.
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java
index 79857eb..9c37bb8 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java
@@ -20,9 +20,10 @@
import org.onosproject.yangutils.datamodel.TraversalType;
import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
import org.onosproject.yangutils.translator.exception.InvalidNodeForTranslatorException;
import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.datamodel.TraversalType.CHILD;
import static org.onosproject.yangutils.datamodel.TraversalType.PARENT;
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaFileInfoContainer.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaFileInfoContainer.java
index 485df77..0ab417a 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaFileInfoContainer.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaFileInfoContainer.java
@@ -15,6 +15,8 @@
*/
package org.onosproject.yangutils.translator.tojava;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+
/**
* Represents data model nodes which are required to generate java classes, need to support
* java file info.
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java
index abccc4c..c859b21 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportData.java
@@ -22,8 +22,7 @@
import static org.onosproject.yangutils.utils.UtilConstants.ABSTRACT_EVENT;
import static org.onosproject.yangutils.utils.UtilConstants.BIG_INTEGER;
-import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO_CLASS_IMPORT_CLASS;
-import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO_CLASS_IMPORT_PKG;
+import static org.onosproject.yangutils.utils.UtilConstants.BITSET;
import static org.onosproject.yangutils.utils.UtilConstants.COLLECTION_IMPORTS;
import static org.onosproject.yangutils.utils.UtilConstants.EMPTY_STRING;
import static org.onosproject.yangutils.utils.UtilConstants.EVENT_LISTENER;
@@ -34,7 +33,6 @@
import static org.onosproject.yangutils.utils.UtilConstants.JAVA_LANG;
import static org.onosproject.yangutils.utils.UtilConstants.JAVA_MATH;
import static org.onosproject.yangutils.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_CLASS;
-import static org.onosproject.yangutils.utils.UtilConstants.BITSET;
import static org.onosproject.yangutils.utils.UtilConstants.JAVA_UTIL_OBJECTS_IMPORT_PKG;
import static org.onosproject.yangutils.utils.UtilConstants.LIST;
import static org.onosproject.yangutils.utils.UtilConstants.LISTENER_REG;
@@ -44,6 +42,8 @@
import static org.onosproject.yangutils.utils.UtilConstants.ONOS_EVENT_PKG;
import static org.onosproject.yangutils.utils.UtilConstants.PERIOD;
import static org.onosproject.yangutils.utils.UtilConstants.SEMI_COLAN;
+import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO_CLASS_IMPORT_CLASS;
+import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_INFO_CLASS_IMPORT_PKG;
import static org.onosproject.yangutils.utils.UtilConstants.YANG_AUGMENTED_OP_PARAM_INFO_CLASS;
import static java.util.Collections.sort;
@@ -61,13 +61,13 @@
* Sorted set of import info, to be used to maintain the set of classes to
* be imported in the generated class.
*/
- private SortedSet<JavaQualifiedTypeInfo> importSet;
+ private SortedSet<JavaQualifiedTypeInfoTranslator> importSet;
/**
* Creates java import data object.
*/
public JavaImportData() {
- setImportSet(new TreeSet<JavaQualifiedTypeInfo>());
+ setImportSet(new TreeSet<>());
}
/**
@@ -75,7 +75,7 @@
*
* @return true if any of the attribute needs to be maintained as a list
*/
- public boolean getIfListImported() {
+ private boolean getIfListImported() {
return isListToImport;
}
@@ -84,7 +84,7 @@
*
* @param isList status to mention list is bing imported
*/
- public void setIfListImported(boolean isList) {
+ void setIfListImported(boolean isList) {
isListToImport = isList;
}
@@ -93,7 +93,7 @@
*
* @return the set containing the imported class/interface info
*/
- public SortedSet<JavaQualifiedTypeInfo> getImportSet() {
+ public SortedSet<JavaQualifiedTypeInfoTranslator> getImportSet() {
return importSet;
}
@@ -102,14 +102,14 @@
*
* @param importSet the set containing the imported class/interface info
*/
- private void setImportSet(SortedSet<JavaQualifiedTypeInfo> importSet) {
+ private void setImportSet(SortedSet<JavaQualifiedTypeInfoTranslator> importSet) {
this.importSet = importSet;
}
/**
* Adds an imported class/interface info if it is not already part of the
* collection.
- *
+ * <p>
* If already part of the collection, check if the packages are same, if so
* then return true, to denote it is already in the import collection, and
* it can be accessed without qualified access. If the packages do not
@@ -122,8 +122,8 @@
* @param classPkg generated class package
* @return qualified access status of the import node being added
*/
- public boolean addImportInfo(JavaQualifiedTypeInfo newImportInfo,
- String className, String classPkg) {
+ public boolean addImportInfo(JavaQualifiedTypeInfoTranslator newImportInfo,
+ String className, String classPkg) {
if (newImportInfo.getClassInfo().contentEquals(className)) {
/*
@@ -144,14 +144,14 @@
* qualified access.
*/
if (newImportInfo.getPkgInfo().contentEquals(classPkg)) {
- /**
+ /*
* Package of the referred attribute and the generated class is same, so no need import
* or qualified access.
*/
return false;
}
- for (JavaQualifiedTypeInfo curImportInfo : getImportSet()) {
+ for (JavaQualifiedTypeInfoTranslator curImportInfo : getImportSet()) {
if (curImportInfo.getClassInfo()
.contentEquals(newImportInfo.getClassInfo())) {
return !curImportInfo.getPkgInfo()
@@ -176,7 +176,7 @@
String importString;
List<String> imports = new ArrayList<>();
- for (JavaQualifiedTypeInfo importInfo : getImportSet()) {
+ for (JavaQualifiedTypeInfoTranslator importInfo : getImportSet()) {
if (!importInfo.getPkgInfo().equals(EMPTY_STRING) && importInfo.getClassInfo() != null
&& !importInfo.getPkgInfo().equals(JAVA_LANG)) {
importString = IMPORT + importInfo.getPkgInfo() + PERIOD + importInfo.getClassInfo() + SEMI_COLAN
@@ -199,7 +199,7 @@
*
* @return import for hash and equals method
*/
- public String getImportForHashAndEquals() {
+ String getImportForHashAndEquals() {
return IMPORT + JAVA_UTIL_OBJECTS_IMPORT_PKG + PERIOD + JAVA_UTIL_OBJECTS_IMPORT_CLASS;
}
@@ -208,7 +208,7 @@
*
* @return import for to string method
*/
- public String getImportForToString() {
+ String getImportForToString() {
return IMPORT + GOOGLE_MORE_OBJECT_IMPORT_PKG + PERIOD + GOOGLE_MORE_OBJECT_IMPORT_CLASS;
}
@@ -217,7 +217,7 @@
*
* @return import for to bitset method
*/
- public String getImportForToBitSet() {
+ String getImportForToBitSet() {
return IMPORT + JAVA_UTIL_OBJECTS_IMPORT_PKG + PERIOD + BITSET + SEMI_COLAN + NEW_LINE;
}
@@ -226,7 +226,7 @@
*
* @return import for list attribute
*/
- public String getImportForList() {
+ private String getImportForList() {
return IMPORT + COLLECTION_IMPORTS + PERIOD + LIST + SEMI_COLAN + NEW_LINE;
}
@@ -253,7 +253,7 @@
*
* @return import string for AbstractEvent class
*/
- public String getAbstractEventsImport() {
+ String getAbstractEventsImport() {
return IMPORT + ONOS_EVENT_PKG + PERIOD + ABSTRACT_EVENT + SEMI_COLAN + NEW_LINE;
}
@@ -262,7 +262,7 @@
*
* @return import string for EventListener class
*/
- public String getEventListenerImport() {
+ String getEventListenerImport() {
return IMPORT + ONOS_EVENT_PKG + PERIOD + EVENT_LISTENER + SEMI_COLAN + NEW_LINE;
}
@@ -271,7 +271,7 @@
*
* @return import string for map class
*/
- public String getMapImport() {
+ String getMapImport() {
return IMPORT + COLLECTION_IMPORTS + PERIOD + MAP + SEMI_COLAN + NEW_LINE;
}
@@ -280,7 +280,7 @@
*
* @return import string for hash map class
*/
- public String getHashMapImport() {
+ String getHashMapImport() {
return IMPORT + COLLECTION_IMPORTS + PERIOD + HASH_MAP + SEMI_COLAN + NEW_LINE;
}
@@ -289,7 +289,7 @@
*
* @return import string for hash map class
*/
- public String getYangAugmentedInfoImport() {
+ String getYangAugmentedInfoImport() {
return IMPORT + YANG_AUGMENTED_INFO_CLASS_IMPORT_PKG + PERIOD + YANG_AUGMENTED_INFO_CLASS_IMPORT_CLASS;
}
@@ -298,7 +298,7 @@
*
* @return import string for YangAugmentedOpParamInfo class
*/
- public String getYangAugmentedOpParamInfoImport() {
+ String getYangAugmentedOpParamInfoImport() {
return IMPORT + YANG_AUGMENTED_INFO_CLASS_IMPORT_PKG + PERIOD +
YANG_AUGMENTED_OP_PARAM_INFO_CLASS;
}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportDataContainer.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportDataContainer.java
deleted file mode 100644
index e86b468..0000000
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaImportDataContainer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Laboratory
- *
- * Licensed 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.onosproject.yangutils.translator.tojava;
-
-/**
- * Represents the information of the java import data.
- */
-public interface JavaImportDataContainer {
-
- /**
- * Returns the data of java imports to be included in generated file.
- *
- * @return data of java imports to be included in generated file
- */
- JavaImportData getJavaImportData();
-
- /**
- * Sets the data of java imports to be included in generated file.
- *
- * @param javaImportData data of java imports to be included in generated
- * file
- */
- void setJavaImportData(JavaImportData javaImportData);
-}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfoContainer.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfoContainer.java
index c6570c6..7791773 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfoContainer.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfoContainer.java
@@ -25,12 +25,12 @@
*
* @return java qualified type details
*/
- JavaQualifiedTypeInfo getJavaQualifiedInfo();
+ JavaQualifiedTypeInfoTranslator getJavaQualifiedInfo();
/**
* Assign the qualified type info.
*
* @param typeInfo qualified type information
*/
- void setJavaQualifiedInfo(JavaQualifiedTypeInfo typeInfo);
+ void setJavaQualifiedInfo(JavaQualifiedTypeInfoTranslator typeInfo);
}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfo.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfoTranslator.java
similarity index 82%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfo.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfoTranslator.java
index c7d4583..f2b8198 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfo.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/JavaQualifiedTypeInfoTranslator.java
@@ -20,10 +20,11 @@
import java.util.Objects;
import org.onosproject.yangutils.datamodel.YangNode;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaQualifiedTypeInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.javamodel.JavaLeafInfoContainer;
import org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType;
-import org.onosproject.yangutils.utils.io.impl.YangToJavaNamingConflictUtil;
+import org.onosproject.yangutils.translator.tojava.javamodel.JavaLeafInfoContainer;
import com.google.common.base.MoreObjects;
@@ -33,25 +34,15 @@
/**
* Represents the information about individual imports in the generated file.
*/
-public class JavaQualifiedTypeInfo
- implements Comparable<JavaQualifiedTypeInfo>, Serializable {
+public class JavaQualifiedTypeInfoTranslator extends JavaQualifiedTypeInfo
+ implements Comparable<JavaQualifiedTypeInfoTranslator>, Serializable {
private static final long serialVersionUID = 806201634L;
/**
- * Package location where the imported class/interface is defined.
- */
- private String pkgInfo;
-
- /**
- * Class/interface being referenced.
- */
- private String classInfo;
-
- /**
* Creates a java qualified type info object.
*/
- public JavaQualifiedTypeInfo() {
+ public JavaQualifiedTypeInfoTranslator() {
}
/**
@@ -97,7 +88,7 @@
*/
public static void updateLeavesJavaQualifiedInfo(JavaLeafInfoContainer leaf) {
- JavaQualifiedTypeInfo importInfo = leaf.getJavaQualifiedInfo();
+ JavaQualifiedTypeInfoTranslator importInfo = leaf.getJavaQualifiedInfo();
if (leaf.getDataType() == null) {
throw new TranslatorException("missing data type of leaf " + leaf.getName());
@@ -144,10 +135,10 @@
* import info for child class
* @return return the import info for this attribute
*/
- public static JavaQualifiedTypeInfo getQualifiedTypeInfoOfCurNode(YangNode curNode,
- String attributeName) {
+ public static JavaQualifiedTypeInfoTranslator getQualifiedTypeInfoOfCurNode(YangNode curNode,
+ String attributeName) {
- JavaQualifiedTypeInfo importInfo = new JavaQualifiedTypeInfo();
+ JavaQualifiedTypeInfoTranslator importInfo = new JavaQualifiedTypeInfoTranslator();
if (!(curNode instanceof JavaFileInfoContainer)) {
throw new TranslatorException("missing java file information to get the package details "
@@ -168,14 +159,14 @@
* @param conflictResolver plugin configurations
* @return return the import info for this attribute
*/
- public static JavaQualifiedTypeInfo getQualifiedInfoOfFromString(JavaAttributeInfo referredTypesAttrInfo,
- YangToJavaNamingConflictUtil conflictResolver) {
+ static JavaQualifiedTypeInfoTranslator getQualifiedInfoOfFromString(JavaAttributeInfo referredTypesAttrInfo,
+ YangToJavaNamingConflictUtil conflictResolver) {
/*
* Get the java qualified type information for the wrapper classes and
* set it in new java attribute information.
*/
- JavaQualifiedTypeInfo qualifiedInfoOfFromString = new JavaQualifiedTypeInfo();
+ JavaQualifiedTypeInfoTranslator qualifiedInfoOfFromString = new JavaQualifiedTypeInfoTranslator();
qualifiedInfoOfFromString.setClassInfo(
getJavaImportClass(referredTypesAttrInfo.getAttributeType(), true, conflictResolver));
@@ -195,8 +186,8 @@
if (this == obj) {
return true;
}
- if (obj instanceof JavaQualifiedTypeInfo) {
- JavaQualifiedTypeInfo other = (JavaQualifiedTypeInfo) obj;
+ if (obj instanceof JavaQualifiedTypeInfoTranslator) {
+ JavaQualifiedTypeInfoTranslator other = (JavaQualifiedTypeInfoTranslator) obj;
return Objects.equals(pkgInfo, other.pkgInfo) &&
Objects.equals(classInfo, other.classInfo);
}
@@ -209,7 +200,7 @@
* @param importInfo matched import
* @return if equal or not
*/
- public boolean exactMatch(JavaQualifiedTypeInfo importInfo) {
+ public boolean exactMatch(JavaQualifiedTypeInfoTranslator importInfo) {
return equals(importInfo)
&& Objects.equals(pkgInfo, importInfo.getPkgInfo())
&& Objects.equals(classInfo, importInfo.getClassInfo());
@@ -228,7 +219,7 @@
* @param other compared import info.
*/
@Override
- public int compareTo(JavaQualifiedTypeInfo other) {
+ public int compareTo(JavaQualifiedTypeInfoTranslator other) {
return getClassInfo().compareTo(other.getClassInfo());
}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaBeanFragmentFiles.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaBeanFragmentFiles.java
index a70f579..347877e 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaBeanFragmentFiles.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaBeanFragmentFiles.java
@@ -19,7 +19,8 @@
import java.io.File;
import java.io.IOException;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.CONSTRUCTOR_IMPL_MASK;
import static org.onosproject.yangutils.translator.tojava.utils.MethodsGenerator.getConstructor;
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaCodeFragmentFiles.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaCodeFragmentFiles.java
index 90b2daf..3a284bd 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaCodeFragmentFiles.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaCodeFragmentFiles.java
@@ -20,8 +20,9 @@
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangTypeHolder;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ALL_EVENT_CLASS_MASK;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
@@ -106,7 +107,7 @@
*
* @param beanTempFiles temp file handle for bean file generation
*/
- public void setBeanTempFiles(TempJavaBeanFragmentFiles beanTempFiles) {
+ private void setBeanTempFiles(TempJavaBeanFragmentFiles beanTempFiles) {
this.beanTempFiles = beanTempFiles;
}
@@ -124,7 +125,7 @@
*
* @param typeTempFiles temp file handle for data type file generation
*/
- public void setTypeTempFiles(TempJavaTypeFragmentFiles typeTempFiles) {
+ private void setTypeTempFiles(TempJavaTypeFragmentFiles typeTempFiles) {
this.typeTempFiles = typeTempFiles;
}
@@ -142,7 +143,7 @@
*
* @param serviceTempFiles temp file handle for service file generation
*/
- public void setServiceTempFiles(TempJavaServiceFragmentFiles serviceTempFiles) {
+ private void setServiceTempFiles(TempJavaServiceFragmentFiles serviceTempFiles) {
this.serviceTempFiles = serviceTempFiles;
}
@@ -160,7 +161,7 @@
*
* @param enumerationTempFiles temp file handle for enumeration file generation
*/
- public void setEnumerationTempFiles(
+ private void setEnumerationTempFiles(
TempJavaEnumerationFragmentFiles enumerationTempFiles) {
this.enumerationTempFiles = enumerationTempFiles;
}
@@ -179,7 +180,7 @@
*
* @param tempJavaEventFragmentFiles temp file handle for event file generation
*/
- public void setEventFragmentFiles(TempJavaEventFragmentFiles tempJavaEventFragmentFiles) {
+ private void setEventFragmentFiles(TempJavaEventFragmentFiles tempJavaEventFragmentFiles) {
this.tempJavaEventFragmentFiles = tempJavaEventFragmentFiles;
}
@@ -212,7 +213,7 @@
getServiceTempFiles().generateJavaFile(GENERATE_SERVICE_AND_MANAGER, curNode);
}
- /**
+ /*
* Creates event, event listener and event subject files.
*/
if (fileType == GENERATE_ALL_EVENT_CLASS_MASK) {
@@ -220,7 +221,7 @@
}
/*
- * Creats enumeration class file.
+ * Creates enumeration class file.
*/
if (fileType == GENERATE_ENUM_CLASS) {
getEnumerationTempFiles().generateJavaFile(GENERATE_ENUM_CLASS, curNode);
@@ -228,40 +229,14 @@
}
/**
- * Adds the new attribute info to the target generated temporary files.
- *
- * @param newAttrInfo the attribute info that needs to be added to temporary
- * files
- * @param pluginConfig plugin configurations
- * @throws IOException IO operation fail
- */
- public void addJavaSnippetInfoToApplicableTempFiles(JavaAttributeInfo newAttrInfo,
- YangPluginConfig pluginConfig)
- throws IOException {
-
- if (getBeanTempFiles() != null) {
- getBeanTempFiles()
- .addJavaSnippetInfoToApplicableTempFiles(newAttrInfo, pluginConfig);
- }
-
- /**
- * Creates user defined data type class file.
- */
- if (getTypeTempFiles() != null) {
- getTypeTempFiles()
- .addJavaSnippetInfoToApplicableTempFiles(newAttrInfo, pluginConfig);
- }
- }
-
- /**
* Add all the type in the current data model node as part of the
* generated temporary file.
*
* @param yangTypeHolder YANG java data model node which has type info, eg union / typedef
- * @param pluginConfig plugin configurations for naming convention
+ * @param pluginConfig plugin configurations for naming convention
* @throws IOException IO operation fail
*/
- public void addTypeInfoToTempFiles(YangTypeHolder yangTypeHolder, YangPluginConfig pluginConfig)
+ void addTypeInfoToTempFiles(YangTypeHolder yangTypeHolder, YangPluginConfig pluginConfig)
throws IOException {
getTypeTempFiles()
.addTypeInfoToTempFiles(yangTypeHolder, pluginConfig);
@@ -285,8 +260,8 @@
/**
* Adds default constructor for class.
*
- * @param modifier modifier for constructor.
- * @param toAppend string which need to be appended with the class name
+ * @param modifier modifier for constructor.
+ * @param toAppend string which need to be appended with the class name
* @param pluginConfig plugin configurations
* @return default constructor for class
* @throws IOException when fails to append to file
@@ -324,10 +299,10 @@
* Removes all temporary file handles.
*
* @param isErrorOccurred when translator fails to generate java files we need to close
- * all open file handles include temporary files and java files.
+ * all open file handles include temporary files and java files.
* @throws IOException when failed to delete the temporary files
*/
- public void freeTemporaryResources(boolean isErrorOccurred)
+ void freeTemporaryResources(boolean isErrorOccurred)
throws IOException {
if (getBeanTempFiles() != null) {
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEnumerationFragmentFiles.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEnumerationFragmentFiles.java
index 087788d..fe1578a 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEnumerationFragmentFiles.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEnumerationFragmentFiles.java
@@ -22,13 +22,14 @@
import java.util.List;
import java.util.Map;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
import org.onosproject.yangutils.datamodel.YangEnum;
import org.onosproject.yangutils.datamodel.YangEnumeration;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaType;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaTypeTranslator;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.ENUM_IMPL_MASK;
import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
@@ -225,7 +226,7 @@
* @return java attribute
*/
public JavaAttributeInfo getJavaAttributeForEnum(YangPluginConfig pluginConfig) {
- YangJavaType<?> javaType = new YangJavaType<>();
+ YangJavaTypeTranslator<?> javaType = new YangJavaTypeTranslator<>();
javaType.setDataType(YangDataTypes.INT32);
javaType.setDataTypeName("int");
javaType.updateJavaQualifiedInfo(pluginConfig.getConflictResolver());
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEventFragmentFiles.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEventFragmentFiles.java
index f225f06..01587b7 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEventFragmentFiles.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaEventFragmentFiles.java
@@ -22,9 +22,10 @@
import java.util.List;
import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaGrouping;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaGroupingTranslator;
import org.onosproject.yangutils.translator.tojava.utils.JavaExtendsListHolder;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_EVENT_SUBJECT_CLASS;
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_ENUM_MASK;
@@ -33,7 +34,7 @@
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_GETTER_MASK;
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.EVENT_SUBJECT_SETTER_MASK;
import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.getQualifiedTypeInfoOfCurNode;
+import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedTypeInfoOfCurNode;
import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateEventFile;
import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateEventListenerFile;
import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateEventSubjectFile;
@@ -319,7 +320,7 @@
//Creates event interface file.
setEventSubjectJavaFileHandle(getJavaFileHandle(curNode, curNodeInfo +
- TempJavaEventFragmentFiles.EVENT_SUBJECT_NAME_SUFFIX));
+ EVENT_SUBJECT_NAME_SUFFIX));
generateEventSubjectFile(getEventSubjectJavaFileHandle(), curNode);
}
@@ -428,7 +429,7 @@
pluginConfig.getConflictResolver()));
String notificationName = curNode.getName();
- JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
+ JavaQualifiedTypeInfoTranslator qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
getCapitalCase(currentInfo));
JavaAttributeInfo javaAttributeInfo = getAttributeInfoForTheData(qualifiedTypeInfo, getSmallCase(currentInfo),
@@ -492,7 +493,7 @@
YangNode childNode = curNode.getChild();
// Skip grouping, as it wont have the package name.
- while (childNode instanceof YangJavaGrouping) {
+ while (childNode instanceof YangJavaGroupingTranslator) {
childNode = childNode.getNextSibling();
}
JavaFileInfo childInfo = ((JavaFileInfoContainer) childNode).getJavaFileInfo();
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java
index 982f7c3..480c321 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaFragmentFiles.java
@@ -28,13 +28,14 @@
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangSubModule;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.javamodel.JavaLeafInfoContainer;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaGrouping;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModule;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModule;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaGroupingTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModuleTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModuleTranslator;
import org.onosproject.yangutils.translator.tojava.utils.JavaExtendsListHolder;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_CLASS_MASK;
@@ -56,8 +57,8 @@
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.SETTER_FOR_INTERFACE_MASK;
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.TO_STRING_IMPL_MASK;
import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.getQualifiedInfoOfFromString;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.getQualifiedTypeInfoOfCurNode;
+import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedInfoOfFromString;
+import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedTypeInfoOfCurNode;
import static org.onosproject.yangutils.translator.tojava.javamodel.AttributesJavaDataType.updateJavaFileInfo;
import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getJavaAttributeDefination;
import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getJavaClassDefClose;
@@ -240,7 +241,7 @@
/**
* Java file handle for builder op param class file.
*/
- private File builderOpParmClassJavaFileHandle;
+ private File builderOpParamClassJavaFileHandle;
/**
* Java file handle for impl class file.
@@ -300,7 +301,7 @@
/**
* Import info for case.
*/
- private JavaQualifiedTypeInfo caseImportInfo;
+ private JavaQualifiedTypeInfoTranslator caseImportInfo;
/**
* Is attribute added.
@@ -446,7 +447,7 @@
throw new TranslatorException("missing parent node to contain current node info in generated file");
}
- if (parent instanceof YangJavaGrouping) {
+ if (parent instanceof YangJavaGroupingTranslator) {
/*
* In case of grouping, there is no need to add the information, it
* will be taken care in uses
@@ -484,7 +485,7 @@
* Get the import info corresponding to the attribute for import in
* generated java files or qualified access
*/
- JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
+ JavaQualifiedTypeInfoTranslator qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
getCapitalCase(curNodeName));
if (!(targetNode instanceof TempJavaCodeFragmentFilesContainer)) {
throw new TranslatorException("Parent node does not have file info");
@@ -493,7 +494,7 @@
JavaFileInfo fileInfo = ((JavaFileInfoContainer) targetNode).getJavaFileInfo();
boolean isQualified;
- if ((targetNode instanceof YangJavaModule || targetNode instanceof YangJavaSubModule)
+ if ((targetNode instanceof YangJavaModuleTranslator || targetNode instanceof YangJavaSubModuleTranslator)
&& (qualifiedTypeInfo.getClassInfo().contentEquals(SERVICE)
|| qualifiedTypeInfo.getClassInfo().contentEquals(COMPONENT)
|| qualifiedTypeInfo.getClassInfo().contentEquals(getCapitalCase(ACTIVATE))
@@ -506,7 +507,7 @@
isQualified = true;
} else {
String className;
- if (targetNode instanceof YangJavaModule || targetNode instanceof YangJavaSubModule) {
+ if (targetNode instanceof YangJavaModuleTranslator || targetNode instanceof YangJavaSubModuleTranslator) {
className = getCapitalCase(fileInfo.getJavaName()) + "Service";
} else {
className = getCapitalCase(fileInfo.getJavaName());
@@ -599,17 +600,17 @@
*
* @return op param builder temporary file handle
*/
- private File getBuilderOpParmClassJavaFileHandle() {
- return builderOpParmClassJavaFileHandle;
+ private File getBuilderOpParamClassJavaFileHandle() {
+ return builderOpParamClassJavaFileHandle;
}
/**
* Sets the java file handle for op param builder class.
*
- * @param builderOpParmClassJavaFileHandle java file handle
+ * @param builderOpParamClassJavaFileHandle java file handle
*/
- private void setBuilderOpParmClassJavaFileHandle(File builderOpParmClassJavaFileHandle) {
- this.builderOpParmClassJavaFileHandle = builderOpParmClassJavaFileHandle;
+ private void setBuilderOpParamClassJavaFileHandle(File builderOpParamClassJavaFileHandle) {
+ this.builderOpParamClassJavaFileHandle = builderOpParamClassJavaFileHandle;
}
/**
@@ -1170,11 +1171,17 @@
String path = getTempDirPath(getAbsoluteDirPath());
File dir = new File(path);
if (!dir.exists()) {
- dir.mkdirs();
+ boolean isCreated = dir.mkdirs();
+ if (!isCreated) {
+ throw new IOException("failed to create temporary directory for " + fileName);
+ }
}
File file = new File(path + fileName + TEMP_FILE_EXTENSION);
if (!file.exists()) {
- file.createNewFile();
+ boolean isCreated = file.createNewFile();
+ if (!isCreated) {
+ throw new IOException("failed to create temporary files for " + fileName);
+ }
} else {
throw new IOException(fileName + " is reused due to YANG naming");
}
@@ -1273,7 +1280,7 @@
* @param pluginConfig plugin configurations
*/
void addParentInfoInCurNodeTempFile(YangNode curNode, YangPluginConfig pluginConfig) {
- caseImportInfo = new JavaQualifiedTypeInfo();
+ caseImportInfo = new JavaQualifiedTypeInfoTranslator();
YangNode parent = getParentNodeInGenCode(curNode);
if (!(parent instanceof JavaCodeGenerator)) {
throw new TranslatorException("missing parent node to contain current node info in generated file");
@@ -1358,7 +1365,7 @@
* @throws IOException IO operation fail
*/
void addCurNodeLeavesInfoToTempFiles(YangNode curNode,
- YangPluginConfig yangPluginConfig)
+ YangPluginConfig yangPluginConfig)
throws IOException {
if (!(curNode instanceof YangLeavesHolder)) {
throw new TranslatorException("Data model node does not have any leaves");
@@ -1411,7 +1418,7 @@
}
if ((getGeneratedTempFiles() & FROM_STRING_IMPL_MASK) != 0) {
- JavaQualifiedTypeInfo qualifiedInfoOfFromString = getQualifiedInfoOfFromString(newAttrInfo,
+ JavaQualifiedTypeInfoTranslator qualifiedInfoOfFromString = getQualifiedInfoOfFromString(newAttrInfo,
pluginConfig.getConflictResolver());
/*
* Create a new java attribute info with qualified information of
@@ -1570,7 +1577,7 @@
if (curNode instanceof YangAugmentableNode) {
addYangAugmentedOpParamInfoImport(imports);
}
- JavaQualifiedTypeInfo qualifiedTypeInfo = new JavaQualifiedTypeInfo();
+ JavaQualifiedTypeInfoTranslator qualifiedTypeInfo = new JavaQualifiedTypeInfoTranslator();
qualifiedTypeInfo.setClassInfo(getCapitalCase(DEFAULT) + getCapitalCase(getJavaFileInfo()
.getJavaName()));
qualifiedTypeInfo.setPkgInfo(getJavaFileInfo().getPackage());
@@ -1592,14 +1599,14 @@
* Create builder class file.
*/
if ((fileType & BUILDER_CLASS_MASK) != 0) {
- setBuilderOpParmClassJavaFileHandle(getJavaFileHandle(getOpParamBuilderImplClassName()));
- setBuilderOpParmClassJavaFileHandle(
- generateOpParamBuilderClassFile(getBuilderOpParmClassJavaFileHandle(), curNode,
+ setBuilderOpParamClassJavaFileHandle(getJavaFileHandle(getOpParamBuilderImplClassName()));
+ setBuilderOpParamClassJavaFileHandle(
+ generateOpParamBuilderClassFile(getBuilderOpParamClassJavaFileHandle(), curNode,
isAttributePresent()));
/*
* Append impl class to builder class and close it.
*/
- mergeJavaFiles(getBuilderOpParmClassJavaFileHandle(), getOpParamClassJavaFileHandle());
+ mergeJavaFiles(getBuilderOpParamClassJavaFileHandle(), getOpParamClassJavaFileHandle());
validateLineLength(getOpParamClassJavaFileHandle());
addBitSetImport(imports, false);
@@ -1689,7 +1696,7 @@
*/
private void removeAugmentedInfoImport(List<String> imports) {
imports.remove(getJavaImportData().getYangAugmentedInfoImport());
- for (JavaQualifiedTypeInfo type : getJavaImportData().getImportSet()) {
+ for (JavaQualifiedTypeInfoTranslator type : getJavaImportData().getImportSet()) {
if (type.getClassInfo().equals(YANG_AUGMENTED_INFO)) {
getJavaImportData().getImportSet().remove(type);
getJavaExtendsListHolder().getExtendsList().remove(type);
@@ -1715,7 +1722,7 @@
closeFile(getBuilderClassJavaFileHandle(), true);
}
if ((getGeneratedJavaFiles() & OPERATION_BUILDER_CLASS_MASK) != 0) {
- closeFile(getBuilderOpParmClassJavaFileHandle(), true);
+ closeFile(getBuilderOpParamClassJavaFileHandle(), true);
}
if ((getGeneratedJavaFiles() & BUILDER_INTERFACE_MASK) != 0) {
closeFile(getBuilderInterfaceJavaFileHandle(), true);
@@ -1755,7 +1762,7 @@
* @return status of the qualified access to the attribute
*/
boolean getIsQualifiedAccessOrAddToImportList(
- JavaQualifiedTypeInfo importInfo) {
+ JavaQualifiedTypeInfoTranslator importInfo) {
return getJavaImportData().addImportInfo(importInfo, getGeneratedJavaClassName(),
getJavaFileInfo().getPackage());
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java
index bae2df5..98221f1 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaServiceFragmentFiles.java
@@ -21,10 +21,11 @@
import java.util.List;
import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModule;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModule;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModuleTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModuleTranslator;
import org.onosproject.yangutils.translator.tojava.utils.JavaExtendsListHolder;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.RPC_IMPL_MASK;
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.RPC_INTERFACE_MASK;
@@ -213,12 +214,12 @@
.getJavaImportData().getImports();
createPackage(curNode);
boolean isNotification = false;
- if (curNode instanceof YangJavaModule) {
- if (!((YangJavaModule) curNode).getNotificationNodes().isEmpty()) {
+ if (curNode instanceof YangJavaModuleTranslator) {
+ if (!((YangJavaModuleTranslator) curNode).getNotificationNodes().isEmpty()) {
isNotification = true;
}
- } else if (curNode instanceof YangJavaSubModule) {
- if (!((YangJavaSubModule) curNode).getNotificationNodes().isEmpty()) {
+ } else if (curNode instanceof YangJavaSubModuleTranslator) {
+ if (!((YangJavaSubModuleTranslator) curNode).getNotificationNodes().isEmpty()) {
isNotification = true;
}
}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java
index 8e05be5..13da55c 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaTypeFragmentFiles.java
@@ -24,10 +24,11 @@
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangType;
import org.onosproject.yangutils.datamodel.YangTypeHolder;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaType;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaTypeTranslator;
import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT32;
import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT64;
@@ -39,7 +40,7 @@
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.FROM_STRING_IMPL_MASK;
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.OF_STRING_IMPL_MASK;
import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.getQualifiedInfoOfFromString;
+import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedInfoOfFromString;
import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateTypeDefClassFile;
import static org.onosproject.yangutils.translator.tojava.utils.JavaFileGenerator.generateUnionClassFile;
import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.createPackage;
@@ -250,7 +251,7 @@
List<YangType<?>> typeList = yangTypeHolder.getTypeList();
if (typeList != null) {
for (YangType<?> yangType : typeList) {
- if (!(yangType instanceof YangJavaType)) {
+ if (!(yangType instanceof YangJavaTypeTranslator)) {
throw new TranslatorException("Type does not have Java info");
}
JavaAttributeInfo javaAttributeInfo = getAttributeForType(yangType, pluginConfig);
@@ -270,7 +271,7 @@
* @return java attribute
*/
private JavaAttributeInfo getAttributeForType(YangType yangType, YangPluginConfig pluginConfig) {
- YangJavaType<?> javaType = (YangJavaType<?>) yangType;
+ YangJavaTypeTranslator<?> javaType = (YangJavaTypeTranslator<?>) yangType;
javaType.updateJavaQualifiedInfo(pluginConfig.getConflictResolver());
String typeName = javaType.getDataTypeName();
typeName = getCamelCase(typeName, pluginConfig.getConflictResolver());
@@ -317,11 +318,11 @@
}
/**
- * Adds of method and constructor when there is no conflictiing types.
+ * Adds of method and constructor when there is no conflicting types.
*
* @param javaAttributeInfo java attribute info
* @param pluginConfig plugin configurations
- * @throws IOException when fails to do IO opearions
+ * @throws IOException when fails to do IO operations
*/
private void addMethodsWhenNoConflictingTypes(JavaAttributeInfo javaAttributeInfo,
YangPluginConfig pluginConfig) throws IOException {
@@ -394,7 +395,7 @@
*/
private void addFromStringMethod(JavaAttributeInfo newAttrInfo, YangPluginConfig pluginConfig) throws IOException {
- JavaQualifiedTypeInfo qualifiedInfoOfFromString = getQualifiedInfoOfFromString(newAttrInfo,
+ JavaQualifiedTypeInfoTranslator qualifiedInfoOfFromString = getQualifiedInfoOfFromString(newAttrInfo,
pluginConfig.getConflictResolver());
/*
* Create a new java attribute info with qualified information of
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TraversalType.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TraversalType.java
index dd7db35..35f529a 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TraversalType.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TraversalType.java
@@ -34,7 +34,7 @@
/**
* Sibling node traversal.
*/
- SIBILING,
+ SIBLING,
/**
* Parent node traversal.
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangDataModelFactory.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangDataModelFactory.java
index 9ba4068..77fb569 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangDataModelFactory.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangDataModelFactory.java
@@ -36,26 +36,26 @@
import org.onosproject.yangutils.datamodel.YangUses;
import org.onosproject.yangutils.datamodel.utils.GeneratedLanguage;
import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaAugment;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaCase;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaChoice;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaContainer;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaEnumeration;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaGrouping;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaIdentity;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaInput;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaLeaf;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaLeafList;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaList;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModule;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaNotification;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaOutput;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaRpc;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModule;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaType;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaTypeDef;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaUnion;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaUses;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaAugmentTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaCaseTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaChoiceTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaContainerTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaEnumerationTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaGroupingTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaIdentityTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaInputTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaLeafTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaLeafListTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaListTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModuleTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaNotificationTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaOutputTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaRpcTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModuleTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaTypeTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaTypeDefTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaUnionTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaUsesTranslator;
/**
* Represents factory to create data model objects based on the target file type.
@@ -78,7 +78,7 @@
public static YangModule getYangModuleNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaModule();
+ return new YangJavaModuleTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -96,7 +96,7 @@
public static YangAugment getYangAugmentNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaAugment();
+ return new YangJavaAugmentTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -114,7 +114,7 @@
public static YangCase getYangCaseNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaCase();
+ return new YangJavaCaseTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -132,7 +132,7 @@
public static YangChoice getYangChoiceNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaChoice();
+ return new YangJavaChoiceTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -150,7 +150,7 @@
public static YangContainer getYangContainerNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaContainer();
+ return new YangJavaContainerTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -168,7 +168,7 @@
public static YangIdentity getYangIdentityNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaIdentity();
+ return new YangJavaIdentityTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -186,7 +186,7 @@
public static YangGrouping getYangGroupingNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaGrouping();
+ return new YangJavaGroupingTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -204,7 +204,7 @@
public static YangList getYangListNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaList();
+ return new YangJavaListTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -222,7 +222,7 @@
public static YangSubModule getYangSubModuleNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaSubModule();
+ return new YangJavaSubModuleTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -240,7 +240,7 @@
public static YangTypeDef getYangTypeDefNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaTypeDef();
+ return new YangJavaTypeDefTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -258,7 +258,7 @@
public static YangUnion getYangUnionNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaUnion();
+ return new YangJavaUnionTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -276,7 +276,7 @@
public static YangUses getYangUsesNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaUses();
+ return new YangJavaUsesTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -294,7 +294,7 @@
public static YangNotification getYangNotificationNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaNotification();
+ return new YangJavaNotificationTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -312,7 +312,7 @@
public static YangLeaf getYangLeaf(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaLeaf();
+ return new YangJavaLeafTranslator();
}
default: {
throw new RuntimeException("Only YANG to Java is supported.");
@@ -330,7 +330,7 @@
public static YangLeafList getYangLeafList(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaLeafList();
+ return new YangJavaLeafListTranslator();
}
default: {
throw new RuntimeException("Only YANG to Java is supported.");
@@ -348,7 +348,7 @@
public static YangRpc getYangRpcNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaRpc();
+ return new YangJavaRpcTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -366,7 +366,7 @@
public static YangInput getYangInputNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaInput();
+ return new YangJavaInputTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -384,7 +384,7 @@
public static YangOutput getYangOutputNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaOutput();
+ return new YangJavaOutputTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -399,10 +399,10 @@
* generated
* @return the corresponding inherited node based on the target language
*/
- public static YangJavaEnumeration getYangEnumerationNode(GeneratedLanguage targetLanguage) {
+ public static YangJavaEnumerationTranslator getYangEnumerationNode(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaEnumeration();
+ return new YangJavaEnumerationTranslator();
}
default: {
throw new TranslatorException("Only YANG to Java is supported.");
@@ -419,7 +419,7 @@
public static YangType getYangType(GeneratedLanguage targetLanguage) {
switch (targetLanguage) {
case JAVA_GENERATION: {
- return new YangJavaType();
+ return new YangJavaTypeTranslator();
}
default: {
throw new RuntimeException("Only YANG to Java is supported.");
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java
index 3489eea..7739e52 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/YangJavaModelUtils.java
@@ -26,19 +26,18 @@
import org.onosproject.yangutils.datamodel.YangCase;
import org.onosproject.yangutils.datamodel.YangChoice;
import org.onosproject.yangutils.datamodel.YangLeavesHolder;
-import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
-import org.onosproject.yangutils.datamodel.YangSubModule;
import org.onosproject.yangutils.datamodel.YangTranslatorOperatorNode;
import org.onosproject.yangutils.datamodel.YangTypeHolder;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.datamodel.utils.DataModelUtils;
import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaAugment;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaEnumeration;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModule;
-import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModule;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaAugmentTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaEnumerationTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaModuleTranslator;
+import org.onosproject.yangutils.translator.tojava.javamodel.YangJavaSubModuleTranslator;
import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.isRpcChildNodePresent;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_SERVICE_AND_MANAGER;
@@ -74,9 +73,9 @@
public static void updatePackageInfo(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
YangPluginConfig yangPluginConfig)
throws IOException {
- if (javaCodeGeneratorInfo instanceof YangJavaAugment) {
+ if (javaCodeGeneratorInfo instanceof YangJavaAugmentTranslator) {
javaCodeGeneratorInfo.getJavaFileInfo()
- .setJavaName(getAugmentClassName((YangJavaAugment) javaCodeGeneratorInfo,
+ .setJavaName(getAugmentClassName((YangJavaAugmentTranslator) javaCodeGeneratorInfo,
yangPluginConfig));
} else {
javaCodeGeneratorInfo.getJavaFileInfo()
@@ -137,13 +136,13 @@
javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
.getServiceTempFiles().addCurNodeLeavesInfoToTempFiles(
(YangNode) javaCodeGeneratorInfo, yangPluginConfig);
- if (javaCodeGeneratorInfo instanceof YangJavaModule) {
- if (!((YangJavaModule) javaCodeGeneratorInfo).getNotificationNodes().isEmpty()) {
- updateNotificaitonNodeInfo(javaCodeGeneratorInfo, yangPluginConfig);
+ if (javaCodeGeneratorInfo instanceof YangJavaModuleTranslator) {
+ if (!((YangJavaModuleTranslator) javaCodeGeneratorInfo).getNotificationNodes().isEmpty()) {
+ updateNotificationNodeInfo(javaCodeGeneratorInfo, yangPluginConfig);
}
- } else if (javaCodeGeneratorInfo instanceof YangJavaSubModule) {
- if (!((YangJavaSubModule) javaCodeGeneratorInfo).getNotificationNodes().isEmpty()) {
- updateNotificaitonNodeInfo(javaCodeGeneratorInfo, yangPluginConfig);
+ } else if (javaCodeGeneratorInfo instanceof YangJavaSubModuleTranslator) {
+ if (!((YangJavaSubModuleTranslator) javaCodeGeneratorInfo).getNotificationNodes().isEmpty()) {
+ updateNotificationNodeInfo(javaCodeGeneratorInfo, yangPluginConfig);
}
}
@@ -168,7 +167,7 @@
*/
javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
.addTypeInfoToTempFiles((YangTypeHolder) javaCodeGeneratorInfo, yangPluginConfig);
- } else if (javaCodeGeneratorInfo instanceof YangJavaEnumeration) {
+ } else if (javaCodeGeneratorInfo instanceof YangJavaEnumerationTranslator) {
/*
* Enumeration
*/
@@ -207,22 +206,22 @@
* @param yangPluginConfig plugin configurations
* @throws IOException when fails to do IO operations
*/
- private static void updateNotificaitonNodeInfo(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
+ private static void updateNotificationNodeInfo(JavaCodeGeneratorInfo javaCodeGeneratorInfo,
YangPluginConfig yangPluginConfig)
throws IOException {
- if (javaCodeGeneratorInfo instanceof YangJavaModule) {
- for (YangNode notificaiton : ((YangJavaModule) javaCodeGeneratorInfo).getNotificationNodes()) {
+ if (javaCodeGeneratorInfo instanceof YangJavaModuleTranslator) {
+ for (YangNode notification : ((YangJavaModuleTranslator) javaCodeGeneratorInfo).getNotificationNodes()) {
javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
.getEventFragmentFiles()
- .addJavaSnippetOfEvent(notificaiton, yangPluginConfig);
+ .addJavaSnippetOfEvent(notification, yangPluginConfig);
}
}
- if (javaCodeGeneratorInfo instanceof YangJavaSubModule) {
- for (YangNode notificaiton : ((YangJavaSubModule) javaCodeGeneratorInfo)
+ if (javaCodeGeneratorInfo instanceof YangJavaSubModuleTranslator) {
+ for (YangNode notification : ((YangJavaSubModuleTranslator) javaCodeGeneratorInfo)
.getNotificationNodes()) {
javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
.getEventFragmentFiles()
- .addJavaSnippetOfEvent(notificaiton, yangPluginConfig);
+ .addJavaSnippetOfEvent(notification, yangPluginConfig);
}
}
}
@@ -269,9 +268,9 @@
generateCodeOfNode(javaCodeGeneratorInfo, yangPlugin);
TempJavaCodeFragmentFiles tempJavaCodeFragmentFiles = javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles();
- if (javaCodeGeneratorInfo instanceof YangJavaAugment) {
+ if (javaCodeGeneratorInfo instanceof YangJavaAugmentTranslator) {
- JavaQualifiedTypeInfo yangAugmentedInfo = new JavaQualifiedTypeInfo();
+ JavaQualifiedTypeInfoTranslator yangAugmentedInfo = new JavaQualifiedTypeInfoTranslator();
yangAugmentedInfo.setClassInfo(YANG_AUGMENTED_INFO);
yangAugmentedInfo.setPkgInfo(YANG_AUGMENTED_INFO_CLASS_IMPORT_PKG);
javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles().getBeanTempFiles().getJavaExtendsListHolder()
@@ -280,7 +279,7 @@
}
if (javaCodeGeneratorInfo instanceof YangCase) {
YangNode parent = ((YangCase) javaCodeGeneratorInfo).getParent();
- JavaQualifiedTypeInfo parentsInfo = new JavaQualifiedTypeInfo();
+ JavaQualifiedTypeInfoTranslator parentsInfo = new JavaQualifiedTypeInfoTranslator();
String parentName = getCapitalCase(((JavaFileInfoContainer) parent).getJavaFileInfo().getJavaName());
String parentPkg = ((JavaFileInfoContainer) parent).getJavaFileInfo().getPackage();
parentsInfo.setClassInfo(parentName);
@@ -399,7 +398,7 @@
File codeGenDir = new File(info.getBaseCodeGenPath()
+ info.getPackageFilePath());
File[] files = codeGenDir.listFiles();
- if (files.length >= 1) {
+ if (files != null && files.length >= 1) {
for (File file : files) {
if (file.getName().contentEquals(getCapitalCase(info.getJavaName() + MANAGER + ".java"))) {
return false;
@@ -420,36 +419,31 @@
List<String> clsInfo = new ArrayList<>();
while (node.getParent() != null) {
- if (!(node instanceof YangModule)
- || !(node instanceof YangSubModule)) {
- if (node instanceof YangJavaAugment) {
- clsInfo.add(getAugmentClassName((YangAugment) node, yangPluginConfig));
- } else {
- clsInfo.add(getCamelCase(node.getName(), yangPluginConfig.getConflictResolver()));
- }
+ if (node instanceof YangJavaAugmentTranslator) {
+ clsInfo.add(getAugmentClassName((YangAugment) node, yangPluginConfig));
+ } else {
+ clsInfo.add(getCamelCase(node.getName(), yangPluginConfig.getConflictResolver()));
}
- if (node instanceof YangJavaModule
- || node instanceof YangJavaSubModule) {
- break;
- }
+
node = node.getParent();
}
StringBuilder pkg = new StringBuilder();
- if (node instanceof YangJavaModule) {
- YangJavaModule module = (YangJavaModule) node;
+ if (node instanceof YangJavaModuleTranslator) {
+ YangJavaModuleTranslator module = (YangJavaModuleTranslator) node;
pkg.append(getRootPackage(module.getVersion(), module.getNameSpace().getUri(), module
.getRevision().getRevDate(), yangPluginConfig.getConflictResolver()));
- } else if (node instanceof YangJavaSubModule) {
- YangJavaSubModule submodule = (YangJavaSubModule) node;
+ } else if (node instanceof YangJavaSubModuleTranslator) {
+ YangJavaSubModuleTranslator submodule = (YangJavaSubModuleTranslator) node;
pkg.append(getRootPackage(submodule.getVersion(),
submodule.getNameSpaceFromModule(submodule.getBelongsTo()),
submodule.getRevision().getRevDate(), yangPluginConfig.getConflictResolver()));
}
+ String concat = "";
for (int i = 1; i <= clsInfo.size(); i++) {
- pkg.append("." + clsInfo.get(clsInfo.size() - i));
+ concat = concat + "." + clsInfo.get(clsInfo.size() - i);
}
-
+ pkg.append(concat);
return pkg.toString().toLowerCase();
}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataType.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataType.java
index d54fd7d..4c29785 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataType.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataType.java
@@ -21,23 +21,22 @@
import org.onosproject.yangutils.datamodel.YangDerivedInfo;
import org.onosproject.yangutils.datamodel.YangEnumeration;
import org.onosproject.yangutils.datamodel.YangIdentity;
-import org.onosproject.yangutils.datamodel.YangLeafRef;
import org.onosproject.yangutils.datamodel.YangIdentityRef;
+import org.onosproject.yangutils.datamodel.YangLeafRef;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangType;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
import org.onosproject.yangutils.datamodel.YangUnion;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
-import org.onosproject.yangutils.utils.io.impl.YangToJavaNamingConflictUtil;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.getCurNodePackage;
import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getRootPackage;
-import static org.onosproject.yangutils.utils.UtilConstants.BIG_INTEGER;
import static org.onosproject.yangutils.utils.UtilConstants.BIG_DECIMAL;
+import static org.onosproject.yangutils.utils.UtilConstants.BIG_INTEGER;
import static org.onosproject.yangutils.utils.UtilConstants.BIT_SET;
import static org.onosproject.yangutils.utils.UtilConstants.BOOLEAN_DATA_TYPE;
import static org.onosproject.yangutils.utils.UtilConstants.BOOLEAN_WRAPPER;
@@ -155,7 +154,7 @@
return BOOLEAN_WRAPPER;
case ENUMERATION:
return getCapitalCase(
- getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(),
+ getCamelCase(((YangJavaEnumerationTranslator) yangType.getDataTypeExtendedInfo()).getName(),
pluginConfig));
case BITS:
return BIT_SET;
@@ -163,17 +162,17 @@
return BYTE + SQUARE_BRACKETS;
case LEAFREF:
YangType<?> referredType = getReferredTypeFromLeafref(yangType);
- return getJavaImportClass(referredType, isListAttr, pluginConfig);
+ return getJavaImportClass(referredType, true, pluginConfig);
case IDENTITYREF:
YangIdentityRef identityRef = (YangIdentityRef) yangType.getDataTypeExtendedInfo();
YangIdentity identity = identityRef.getReferredIdentity();
- return getCapitalCase(getCamelCase(((YangJavaIdentity) identity).
- getName(), pluginConfig));
+ return getCapitalCase(getCamelCase(identity.
+ getName(), pluginConfig));
case EMPTY:
return BOOLEAN_WRAPPER;
case UNION:
- return getCapitalCase(getCamelCase(((YangJavaUnion) yangType.getDataTypeExtendedInfo()).getName(),
- pluginConfig));
+ return getCapitalCase(getCamelCase(((YangJavaUnionTranslator) yangType
+ .getDataTypeExtendedInfo()).getName(), pluginConfig));
case INSTANCE_IDENTIFIER:
return STRING_DATA_TYPE;
case DERIVED:
@@ -190,7 +189,7 @@
return STRING_DATA_TYPE;
case ENUMERATION:
return getCapitalCase(
- getCamelCase(((YangJavaEnumeration) yangType.getDataTypeExtendedInfo()).getName(),
+ getCamelCase(((YangJavaEnumerationTranslator) yangType.getDataTypeExtendedInfo()).getName(),
pluginConfig));
case BITS:
return BIT_SET;
@@ -198,16 +197,16 @@
return BIG_DECIMAL;
case LEAFREF:
YangType<?> referredType = getReferredTypeFromLeafref(yangType);
- return getJavaImportClass(referredType, isListAttr, pluginConfig);
+ return getJavaImportClass(referredType, false, pluginConfig);
case IDENTITYREF:
YangIdentityRef identityRef = (YangIdentityRef) yangType.getDataTypeExtendedInfo();
YangIdentity identity = identityRef.getReferredIdentity();
- return getCapitalCase(getCamelCase(((YangJavaIdentity) identity).getName(), pluginConfig));
+ return getCapitalCase(getCamelCase(identity.getName(), pluginConfig));
case EMPTY:
return BOOLEAN_DATA_TYPE;
case UNION:
- return getCapitalCase(getCamelCase(((YangJavaUnion) yangType.getDataTypeExtendedInfo()).getName(),
- pluginConfig));
+ return getCapitalCase(getCamelCase(((YangJavaUnionTranslator) yangType
+ .getDataTypeExtendedInfo()).getName(), pluginConfig));
case INSTANCE_IDENTIFIER:
return STRING_DATA_TYPE;
case DERIVED:
@@ -255,7 +254,7 @@
return COLLECTION_IMPORTS;
case LEAFREF:
YangType<?> referredType = getReferredTypeFromLeafref(yangType);
- return getJavaImportPackage(referredType, isListAttr, conflictResolver);
+ return getJavaImportPackage(referredType, true, conflictResolver);
case IDENTITYREF:
return getIdentityRefPackage(yangType, conflictResolver);
case UNION:
@@ -281,7 +280,7 @@
return COLLECTION_IMPORTS;
case LEAFREF:
YangType<?> referredType = getReferredTypeFromLeafref(yangType);
- return getJavaImportPackage(referredType, isListAttr, conflictResolver);
+ return getJavaImportPackage(referredType, false, conflictResolver);
case IDENTITYREF:
return getIdentityRefPackage(yangType, conflictResolver);
case UNION:
@@ -309,11 +308,11 @@
throw new TranslatorException("type should have been derived.");
}
- if (!(((YangDerivedInfo<?>) var).getReferredTypeDef() instanceof YangTypeDef)) {
+ if (!(((YangDerivedInfo<?>) var).getReferredTypeDef() != null)) {
throw new TranslatorException("derived info is not an instance of typedef.");
}
- YangJavaTypeDef typedef = (YangJavaTypeDef) ((YangDerivedInfo<?>) var).getReferredTypeDef();
+ YangJavaTypeDefTranslator typedef = (YangJavaTypeDefTranslator) ((YangDerivedInfo<?>) var).getReferredTypeDef();
if (typedef.getJavaFileInfo().getPackage() == null) {
return getPackageFromParent(typedef.getParent(), conflictResolver);
}
@@ -333,7 +332,7 @@
throw new TranslatorException("type should have been union.");
}
- YangJavaUnion union = (YangJavaUnion) type.getDataTypeExtendedInfo();
+ YangJavaUnionTranslator union = (YangJavaUnionTranslator) type.getDataTypeExtendedInfo();
if (union.getJavaFileInfo().getPackage() == null) {
return getPackageFromParent(union.getParent(), conflictResolver);
}
@@ -352,7 +351,7 @@
if (!(type.getDataTypeExtendedInfo() instanceof YangEnumeration)) {
throw new TranslatorException("type should have been enumeration.");
}
- YangJavaEnumeration enumeration = (YangJavaEnumeration) type.getDataTypeExtendedInfo();
+ YangJavaEnumerationTranslator enumeration = (YangJavaEnumerationTranslator) type.getDataTypeExtendedInfo();
if (enumeration.getJavaFileInfo().getPackage() == null) {
return getPackageFromParent(enumeration.getParent(), conflictResolver);
}
@@ -372,12 +371,13 @@
throw new TranslatorException("type should have been identityref.");
}
YangIdentityRef identityRef = (YangIdentityRef) type.getDataTypeExtendedInfo();
- YangJavaIdentity identity = (YangJavaIdentity) (identityRef.getReferredIdentity());
+ YangJavaIdentityTranslator identity = (YangJavaIdentityTranslator) (identityRef.getReferredIdentity());
if (identity.getJavaFileInfo().getPackage() == null) {
return getPackageFromParent(identity.getParent(), conflictResolver);
}
return identity.getJavaFileInfo().getPackage();
}
+
/**
* Returns package from parent node.
*
@@ -406,7 +406,7 @@
*/
public static void updateJavaFileInfo(YangNode yangNode,
YangToJavaNamingConflictUtil conflictResolver) {
- Stack<YangNode> nodesToUpdatePackage = new Stack<YangNode>();
+ Stack<YangNode> nodesToUpdatePackage = new Stack<>();
/*
* Add the nodes to be updated for package info in a stack.
@@ -425,12 +425,12 @@
if (yangNode == null) {
yangNode = nodesToUpdatePackage.pop();
String pkg;
- if (yangNode instanceof YangJavaModule) {
- YangJavaModule module = (YangJavaModule) yangNode;
+ if (yangNode instanceof YangJavaModuleTranslator) {
+ YangJavaModuleTranslator module = (YangJavaModuleTranslator) yangNode;
pkg = getRootPackage(module.getVersion(), module.getNameSpace().getUri(), module
.getRevision().getRevDate(), conflictResolver);
- } else if (yangNode instanceof YangJavaSubModule) {
- YangJavaSubModule submodule = (YangJavaSubModule) yangNode;
+ } else if (yangNode instanceof YangJavaSubModuleTranslator) {
+ YangJavaSubModuleTranslator submodule = (YangJavaSubModuleTranslator) yangNode;
pkg = getRootPackage(submodule.getVersion(),
submodule.getNameSpaceFromModule(submodule.getBelongsTo()),
submodule.getRevision().getRevDate(), conflictResolver);
@@ -448,7 +448,7 @@
.getPackage()));
}
- /**
+ /*
* Parent of the node in stack is updated with java info,
* all the nodes can be popped and updated
*/
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/JavaLeafInfoContainer.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/JavaLeafInfoContainer.java
index c57e3c4..809323c 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/JavaLeafInfoContainer.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/JavaLeafInfoContainer.java
@@ -17,7 +17,7 @@
import org.onosproject.yangutils.datamodel.YangType;
import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoContainer;
-import org.onosproject.yangutils.utils.io.impl.YangToJavaNamingConflictUtil;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
/**
* Represent java based identification of the YANG leaves.
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/JavaQualifiedTypeResolver.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/JavaQualifiedTypeResolver.java
index c85b1a2..f5fd32e 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/JavaQualifiedTypeResolver.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/JavaQualifiedTypeResolver.java
@@ -15,8 +15,8 @@
*/
package org.onosproject.yangutils.translator.tojava.javamodel;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoContainer;
-import org.onosproject.yangutils.utils.io.impl.YangToJavaNamingConflictUtil;
/**
* Represent java based identification of the YANG leaves.
@@ -27,7 +27,7 @@
/**
* updates the qualified access details of the type.
*
- * @param confilictResolver plugin configurations
+ * @param conflictResolver plugin configurations
*/
- void updateJavaQualifiedInfo(YangToJavaNamingConflictUtil confilictResolver);
+ void updateJavaQualifiedInfo(YangToJavaNamingConflictUtil conflictResolver);
}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaAugment.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaAugmentTranslator.java
similarity index 90%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaAugment.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaAugmentTranslator.java
index 9986351..4ed340d 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaAugment.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaAugmentTranslator.java
@@ -17,13 +17,13 @@
import java.io.IOException;
-import org.onosproject.yangutils.datamodel.YangAugment;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaAugment;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode;
@@ -31,18 +31,13 @@
/**
* Represents augment information extended to support java code generation.
*/
-public class YangJavaAugment
- extends YangAugment
+public class YangJavaAugmentTranslator
+ extends YangJavaAugment
implements JavaCodeGeneratorInfo, JavaCodeGenerator {
private static final long serialVersionUID = 806201632L;
/**
- * Contains the information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code snippet types.
*/
private transient TempJavaCodeFragmentFiles tempFileHandle;
@@ -50,7 +45,7 @@
/**
* Creates a YANG java augment object.
*/
- public YangJavaAugment() {
+ public YangJavaAugmentTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaCase.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaCaseTranslator.java
similarity index 90%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaCase.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaCaseTranslator.java
index 4d4929d..5323ee5 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaCase.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaCaseTranslator.java
@@ -17,13 +17,13 @@
import java.io.IOException;
-import org.onosproject.yangutils.datamodel.YangCase;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaCase;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode;
@@ -31,18 +31,13 @@
/**
* Represents case information extended to support java code generation.
*/
-public class YangJavaCase
- extends YangCase
+public class YangJavaCaseTranslator
+ extends YangJavaCase
implements JavaCodeGeneratorInfo, JavaCodeGenerator {
private static final long serialVersionUID = 806201631L;
/**
- * Contains the information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code
* snippet types.
*/
@@ -51,7 +46,7 @@
/**
* Creates YANG java case object.
*/
- public YangJavaCase() {
+ public YangJavaCaseTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaChoice.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaChoiceTranslator.java
similarity index 90%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaChoice.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaChoiceTranslator.java
index 122bb40..fca0eb2 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaChoice.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaChoiceTranslator.java
@@ -17,13 +17,13 @@
import java.io.IOException;
-import org.onosproject.yangutils.datamodel.YangChoice;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaChoice;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.INTERFACE_MASK;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeAndUpdateInParent;
@@ -31,18 +31,13 @@
/**
* Represents choice information extended to support java code generation.
*/
-public class YangJavaChoice
- extends YangChoice
+public class YangJavaChoiceTranslator
+ extends YangJavaChoice
implements JavaCodeGeneratorInfo, JavaCodeGenerator {
private static final long serialVersionUID = 806201631L;
/**
- * Contains the information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code
* snippet types.
*/
@@ -51,7 +46,7 @@
/**
* Creates YANG java choice object.
*/
- public YangJavaChoice() {
+ public YangJavaChoiceTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(INTERFACE_MASK);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaContainer.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaContainerTranslator.java
similarity index 90%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaContainer.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaContainerTranslator.java
index 3578adc..2b560a8 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaContainer.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaContainerTranslator.java
@@ -17,13 +17,13 @@
import java.io.IOException;
-import org.onosproject.yangutils.datamodel.YangContainer;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaContainer;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeAndUpdateInParent;
@@ -31,18 +31,13 @@
/**
* Represents container information extended to support java code generation.
*/
-public class YangJavaContainer
- extends YangContainer
+public class YangJavaContainerTranslator
+ extends YangJavaContainer
implements JavaCodeGeneratorInfo, JavaCodeGenerator {
private static final long serialVersionUID = 806201630L;
/**
- * Contains the information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code
* snippet types.
*/
@@ -51,7 +46,7 @@
/**
* Creates YANG java container object.
*/
- public YangJavaContainer() {
+ public YangJavaContainerTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaEnumeration.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaEnumerationTranslator.java
similarity index 90%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaEnumeration.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaEnumerationTranslator.java
index fe5e40f..f0589f7 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaEnumeration.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaEnumerationTranslator.java
@@ -18,13 +18,13 @@
import java.io.IOException;
-import org.onosproject.yangutils.datamodel.YangEnumeration;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaEnumeration;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ENUM_CLASS;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfNode;
@@ -32,18 +32,13 @@
/**
* Represents YANG java enumeration information extended to support java code generation.
*/
-public class YangJavaEnumeration
- extends YangEnumeration
+public class YangJavaEnumerationTranslator
+ extends YangJavaEnumeration
implements JavaCodeGenerator, JavaCodeGeneratorInfo {
private static final long serialVersionUID = 806201629L;
/**
- * Contains the information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code
* snippet types.
*/
@@ -52,7 +47,7 @@
/**
* Creates YANG java enumeration object.
*/
- public YangJavaEnumeration() {
+ public YangJavaEnumerationTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_ENUM_CLASS);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaGrouping.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaGroupingTranslator.java
similarity index 87%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaGrouping.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaGroupingTranslator.java
index 6a496ce..a953b63 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaGrouping.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaGroupingTranslator.java
@@ -15,30 +15,25 @@
*/
package org.onosproject.yangutils.translator.tojava.javamodel;
-import org.onosproject.yangutils.datamodel.YangGrouping;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaGrouping;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.InvalidNodeForTranslatorException;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
/**
* Represents grouping information extended to support java code generation.
*/
-public class YangJavaGrouping
- extends YangGrouping
+public class YangJavaGroupingTranslator
+ extends YangJavaGrouping
implements JavaCodeGeneratorInfo, JavaCodeGenerator {
private static final long serialVersionUID = 806201628L;
/**
- * Contains the information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code
* snippet types.
*/
@@ -47,7 +42,7 @@
/**
* Creates YANG Java grouping object.
*/
- public YangJavaGrouping() {
+ public YangJavaGroupingTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaIdentity.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaIdentityTranslator.java
similarity index 87%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaIdentity.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaIdentityTranslator.java
index 45c9af7..22f95fa 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaIdentity.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaIdentityTranslator.java
@@ -19,15 +19,15 @@
import java.io.IOException;
import java.util.List;
-import org.onosproject.yangutils.datamodel.YangIdentity;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaIdentity;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.JavaImportData;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
+import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_IDENTITY_CLASS;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
@@ -41,16 +41,12 @@
/**
* Represents input information extended to support java code generation.
*/
-public class YangJavaIdentity extends YangIdentity
+public class YangJavaIdentityTranslator extends YangJavaIdentity
implements JavaCodeGeneratorInfo, JavaCodeGenerator {
//File type extension for java classes.
private static final String JAVA_FILE_EXTENSION = ".java";
-
- //Contains the information of the java file being generated.
- private JavaFileInfo javaFileInfo;
-
//Contains the information of the importd.
private transient JavaImportData importData;
@@ -58,12 +54,12 @@
* File handle to maintain temporary java code fragments as per the code
* snippet types.
*/
- private TempJavaCodeFragmentFiles tempFileHandle;
+ private transient TempJavaCodeFragmentFiles tempFileHandle;
/**
* Creates YANG java container object.
*/
- public YangJavaIdentity() {
+ public YangJavaIdentityTranslator() {
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
importData = new JavaImportData();
@@ -123,20 +119,21 @@
public void generateCodeEntry(YangPluginConfig yangPlugin) throws TranslatorException {
try {
updatePackageInfo(this, yangPlugin);
- JavaQualifiedTypeInfo basePkgInfo = new JavaQualifiedTypeInfo();
+ JavaQualifiedTypeInfoTranslator basePkgInfo = new JavaQualifiedTypeInfoTranslator();
String className = getCapitalCase(getJavaFileInfo().getJavaName());
String path = getJavaFileInfo().getPackageFilePath();
createPackage(this);
List<String> imports = null;
- boolean isQualified = false;
+ boolean isQualified;
if (getBaseNode() != null && getBaseNode().getReferredIdentity() != null) {
- if (!(getBaseNode().getReferredIdentity() instanceof YangJavaIdentity)) {
+ if (!(getBaseNode().getReferredIdentity() instanceof YangJavaIdentityTranslator)) {
throw new TranslatorException("Failed to prepare generate code entry for base node");
}
- YangJavaIdentity baseIdentity = (YangJavaIdentity) getBaseNode().getReferredIdentity();
+ YangJavaIdentityTranslator baseIdentity = (YangJavaIdentityTranslator) getBaseNode()
+ .getReferredIdentity();
String baseClassName = getCapitalCase(baseIdentity.getJavaFileInfo().getJavaName());
- String basePkg = baseIdentity.getJavaFileInfo().getPackage();
+ String basePkg = baseIdentity.getJavaFileInfo().getPackage();
basePkgInfo.setClassInfo(baseClassName);
basePkgInfo.setPkgInfo(basePkg);
isQualified = importData.addImportInfo(basePkgInfo, className, getJavaFileInfo().getPackage());
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaInput.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaInputTranslator.java
similarity index 90%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaInput.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaInputTranslator.java
index f6bfbfc..de730bc 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaInput.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaInputTranslator.java
@@ -18,13 +18,13 @@
import java.io.IOException;
-import org.onosproject.yangutils.datamodel.YangInput;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaInput;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode;
@@ -32,18 +32,13 @@
/**
* Represents input information extended to support java code generation.
*/
-public class YangJavaInput
- extends YangInput
+public class YangJavaInputTranslator
+ extends YangJavaInput
implements JavaCodeGeneratorInfo, JavaCodeGenerator {
private static final long serialVersionUID = 806201627L;
/**
- * Contains information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code
* snippet types.
*/
@@ -52,7 +47,7 @@
/**
* Creates an instance of java input.
*/
- public YangJavaInput() {
+ public YangJavaInputTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafList.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafListTranslator.java
similarity index 76%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafList.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafListTranslator.java
index c22a134..149d260 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafList.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafListTranslator.java
@@ -15,31 +15,30 @@
*/
package org.onosproject.yangutils.translator.tojava.javamodel;
-import org.onosproject.yangutils.datamodel.YangLeafList;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
-import org.onosproject.yangutils.utils.io.impl.YangToJavaNamingConflictUtil;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaLeafList;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
+import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.updateLeavesJavaQualifiedInfo;
+import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.updateLeavesJavaQualifiedInfo;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
/**
* Represents java information corresponding to the YANG leaf-list.
*/
-public class YangJavaLeafList
- extends YangLeafList
+public class YangJavaLeafListTranslator
+ extends YangJavaLeafList
implements JavaLeafInfoContainer {
private static final long serialVersionUID = 806201638L;
- private JavaQualifiedTypeInfo javaQualifiedAccess;
private transient YangToJavaNamingConflictUtil conflictResolveConfig;
/**
* Returns a new YANG leaf object with java qualified access details.
*/
- public YangJavaLeafList() {
+ public YangJavaLeafListTranslator() {
super();
- setJavaQualifiedInfo(new JavaQualifiedTypeInfo());
+ setJavaQualifiedInfo(new JavaQualifiedTypeInfoTranslator());
}
@Override
@@ -58,13 +57,13 @@
}
@Override
- public JavaQualifiedTypeInfo getJavaQualifiedInfo() {
- return javaQualifiedAccess;
+ public JavaQualifiedTypeInfoTranslator getJavaQualifiedInfo() {
+ return (JavaQualifiedTypeInfoTranslator) javaQualifiedTypeInfo;
}
@Override
- public void setJavaQualifiedInfo(JavaQualifiedTypeInfo typeInfo) {
- javaQualifiedAccess = typeInfo;
+ public void setJavaQualifiedInfo(JavaQualifiedTypeInfoTranslator typeInfo) {
+ javaQualifiedTypeInfo = typeInfo;
}
/**
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeaf.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafTranslator.java
similarity index 76%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeaf.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafTranslator.java
index a9fa972..5bd98c9 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeaf.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaLeafTranslator.java
@@ -15,41 +15,40 @@
*/
package org.onosproject.yangutils.translator.tojava.javamodel;
-import org.onosproject.yangutils.datamodel.YangLeaf;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
-import org.onosproject.yangutils.utils.io.impl.YangToJavaNamingConflictUtil;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaLeaf;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
+import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.updateLeavesJavaQualifiedInfo;
+import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.updateLeavesJavaQualifiedInfo;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCamelCase;
/**
* Represents java information corresponding to the YANG leaf.
*/
-public class YangJavaLeaf
- extends YangLeaf
+public class YangJavaLeafTranslator
+ extends YangJavaLeaf
implements JavaLeafInfoContainer {
private static final long serialVersionUID = 806201636L;
- private JavaQualifiedTypeInfo javaQualifiedAccess;
private transient YangToJavaNamingConflictUtil conflictResolveConfig;
/**
* Returns a new YANG leaf object with java qualified access details.
*/
- public YangJavaLeaf() {
+ public YangJavaLeafTranslator() {
super();
- setJavaQualifiedInfo(new JavaQualifiedTypeInfo());
+ setJavaQualifiedInfo(new JavaQualifiedTypeInfoTranslator());
}
@Override
- public JavaQualifiedTypeInfo getJavaQualifiedInfo() {
- return javaQualifiedAccess;
+ public JavaQualifiedTypeInfoTranslator getJavaQualifiedInfo() {
+ return (JavaQualifiedTypeInfoTranslator) javaQualifiedTypeInfo;
}
@Override
- public void setJavaQualifiedInfo(JavaQualifiedTypeInfo typeInfo) {
- javaQualifiedAccess = typeInfo;
+ public void setJavaQualifiedInfo(JavaQualifiedTypeInfoTranslator typeInfo) {
+ javaQualifiedTypeInfo = typeInfo;
}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaList.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaListTranslator.java
similarity index 90%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaList.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaListTranslator.java
index d03c381..c8f3759 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaList.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaListTranslator.java
@@ -17,13 +17,13 @@
import java.io.IOException;
-import org.onosproject.yangutils.datamodel.YangList;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaList;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeAndUpdateInParent;
@@ -31,18 +31,13 @@
/**
* Represents YANG list information extended to support java code generation.
*/
-public class YangJavaList
- extends YangList
+public class YangJavaListTranslator
+ extends YangJavaList
implements JavaCodeGeneratorInfo, JavaCodeGenerator {
private static final long serialVersionUID = 806201626L;
/**
- * Contains the information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code
* snippet types.
*/
@@ -51,7 +46,7 @@
/**
* Creates YANG java list object.
*/
- public YangJavaList() {
+ public YangJavaListTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModule.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModuleTranslator.java
similarity index 92%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModule.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModuleTranslator.java
index db5d060..06715b1 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModule.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaModuleTranslator.java
@@ -19,15 +19,15 @@
import java.util.ArrayList;
import java.util.List;
-import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNotification;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaModule;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ALL_EVENT_CLASS_MASK;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
@@ -42,18 +42,13 @@
/**
* Represents module information extended to support java code generation.
*/
-public class YangJavaModule
- extends YangModule
+public class YangJavaModuleTranslator
+ extends YangJavaModule
implements JavaCodeGeneratorInfo, JavaCodeGenerator {
private static final long serialVersionUID = 806201625L;
/**
- * Contains the information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code snippet types.
*/
private transient TempJavaCodeFragmentFiles tempFileHandle;
@@ -66,7 +61,7 @@
/**
* Creates a YANG node of module type.
*/
- public YangJavaModule() {
+ public YangJavaModuleTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
setNotificationNodes(new ArrayList<>());
@@ -163,9 +158,9 @@
if (isManagerCodeGenRequired(this)) {
if (isGenerationOfCodeReq(getJavaFileInfo())) {
if ((getJavaFileInfo().getPluginConfig().getCodeGenerateForsbi() == null)
- || (!getJavaFileInfo().getPluginConfig().getCodeGenerateForsbi().equals(SBI))) {
- getTempJavaCodeFragmentFiles().getServiceTempFiles().setManagerNeedToBeGenerated(true);
- }
+ || (!getJavaFileInfo().getPluginConfig().getCodeGenerateForsbi().equals(SBI))) {
+ getTempJavaCodeFragmentFiles().getServiceTempFiles().setManagerNeedToBeGenerated(true);
+ }
}
}
getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_SERVICE_AND_MANAGER, this);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaNotification.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaNotificationTranslator.java
similarity index 91%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaNotification.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaNotificationTranslator.java
index a56fefa..a693820 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaNotification.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaNotificationTranslator.java
@@ -19,40 +19,35 @@
import java.io.IOException;
import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.datamodel.YangNotification;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaNotification;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
+import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFilesContainer;
import org.onosproject.yangutils.translator.tojava.TempJavaServiceFragmentFiles;
import org.onosproject.yangutils.translator.tojava.utils.JavaExtendsListHolder;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode;
import static org.onosproject.yangutils.utils.UtilConstants.EVENT_LISTENER_STRING;
import static org.onosproject.yangutils.utils.UtilConstants.EVENT_STRING;
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
/**
* Represents notification information extended to support java code generation.
*/
-public class YangJavaNotification
- extends YangNotification
+public class YangJavaNotificationTranslator
+ extends YangJavaNotification
implements JavaCodeGenerator, JavaCodeGeneratorInfo {
private static final long serialVersionUID = 806201624L;
/**
- * Contains information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code
* snippet types.
*/
@@ -61,7 +56,7 @@
/**
* Creates an instance of java Notification.
*/
- public YangJavaNotification() {
+ public YangJavaNotificationTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
@@ -148,7 +143,7 @@
.getTempJavaCodeFragmentFiles()
.getServiceTempFiles();
JavaExtendsListHolder holder = tempJavaServiceFragmentFiles.getJavaExtendsListHolder();
- JavaQualifiedTypeInfo event = new JavaQualifiedTypeInfo();
+ JavaQualifiedTypeInfoTranslator event = new JavaQualifiedTypeInfoTranslator();
String parentInfo = getCapitalCase(((JavaFileInfoContainer) parent)
.getJavaFileInfo().getJavaName());
@@ -156,7 +151,7 @@
event.setPkgInfo(getJavaFileInfo().getPackage());
holder.addToExtendsList(event, parent, tempJavaServiceFragmentFiles);
- JavaQualifiedTypeInfo eventListener = new JavaQualifiedTypeInfo();
+ JavaQualifiedTypeInfoTranslator eventListener = new JavaQualifiedTypeInfoTranslator();
eventListener.setClassInfo(parentInfo + EVENT_LISTENER_STRING);
eventListener.setPkgInfo(getJavaFileInfo().getPackage());
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaOutput.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaOutputTranslator.java
similarity index 90%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaOutput.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaOutputTranslator.java
index 4b18551..b9bc576 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaOutput.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaOutputTranslator.java
@@ -18,13 +18,13 @@
import java.io.IOException;
-import org.onosproject.yangutils.datamodel.YangOutput;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaOutput;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfAugmentableNode;
@@ -32,18 +32,13 @@
/**
* Represents output information extended to support java code generation.
*/
-public class YangJavaOutput
- extends YangOutput
+public class YangJavaOutputTranslator
+ extends YangJavaOutput
implements JavaCodeGeneratorInfo, JavaCodeGenerator {
private static final long serialVersionUID = 806201623L;
/**
- * Contains information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code
* snippet types.
*/
@@ -52,7 +47,7 @@
/**
* Creates an instance of java output.
*/
- public YangJavaOutput() {
+ public YangJavaOutputTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaRpc.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaRpcTranslator.java
similarity index 93%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaRpc.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaRpcTranslator.java
index 315f7e3..7696418 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaRpc.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaRpcTranslator.java
@@ -22,23 +22,22 @@
import org.onosproject.yangutils.datamodel.YangInput;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangOutput;
-import org.onosproject.yangutils.datamodel.YangRpc;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaRpc;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaAttributeInfo;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
+import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFilesContainer;
import org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.getQualifiedTypeInfoOfCurNode;
-import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
+import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedTypeInfoOfCurNode;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.updatePackageInfo;
import static org.onosproject.yangutils.utils.UtilConstants.ACTIVATE;
import static org.onosproject.yangutils.utils.UtilConstants.COMPONENT;
@@ -47,22 +46,18 @@
import static org.onosproject.yangutils.utils.UtilConstants.REFERENCE;
import static org.onosproject.yangutils.utils.UtilConstants.REFERENCE_CARDINALITY;
import static org.onosproject.yangutils.utils.UtilConstants.SERVICE;
+import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
/**
* Represents rpc information extended to support java code generation.
*/
-public class YangJavaRpc
- extends YangRpc
+public class YangJavaRpcTranslator
+ extends YangJavaRpc
implements JavaCodeGenerator, JavaCodeGeneratorInfo {
private static final long serialVersionUID = 806201622L;
/**
- * Contains the information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* Temproary file for code generation.
*/
private transient TempJavaCodeFragmentFiles tempJavaCodeFragmentFiles;
@@ -70,7 +65,7 @@
/**
* Creates an instance of YANG java rpc.
*/
- public YangJavaRpc() {
+ public YangJavaRpcTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
}
@@ -206,7 +201,7 @@
* Get the import info corresponding to the attribute for import in
* generated java files or qualified access
*/
- JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(childNode,
+ JavaQualifiedTypeInfoTranslator qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(childNode,
getCapitalCase(childNodeName));
if (!(parentNode instanceof TempJavaCodeFragmentFilesContainer)) {
throw new TranslatorException("Parent node does not have file info");
@@ -230,7 +225,7 @@
* @param importInfo import info
* @return true or false
*/
- private boolean addImportToService(JavaQualifiedTypeInfo importInfo) {
+ private boolean addImportToService(JavaQualifiedTypeInfoTranslator importInfo) {
JavaFileInfo fileInfo = ((JavaFileInfoContainer) getParent()).getJavaFileInfo();
if (importInfo.getClassInfo().contentEquals(SERVICE)
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModule.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModuleTranslator.java
similarity index 92%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModule.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModuleTranslator.java
index 73d7583..a089a99 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModule.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaSubModuleTranslator.java
@@ -23,13 +23,13 @@
import org.onosproject.yangutils.datamodel.YangModule;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNotification;
-import org.onosproject.yangutils.datamodel.YangSubModule;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaSubModule;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_ALL_EVENT_CLASS_MASK;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
@@ -44,18 +44,13 @@
/**
* Represents sub module information extended to support java code generation.
*/
-public class YangJavaSubModule
- extends YangSubModule
+public class YangJavaSubModuleTranslator
+ extends YangJavaSubModule
implements JavaCodeGeneratorInfo, JavaCodeGenerator {
private static final long serialVersionUID = 806201621L;
/**
- * Contains the information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code snippet types.
*/
private transient TempJavaCodeFragmentFiles tempFileHandle;
@@ -68,7 +63,7 @@
/**
* Creates YANG java sub module object.
*/
- public YangJavaSubModule() {
+ public YangJavaSubModuleTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
int gentype = GENERATE_SERVICE_AND_MANAGER | GENERATE_INTERFACE_WITH_BUILDER;
@@ -178,9 +173,9 @@
if (isManagerCodeGenRequired(this)) {
if (isGenerationOfCodeReq(getJavaFileInfo())) {
if ((getJavaFileInfo().getPluginConfig().getCodeGenerateForsbi() == null)
- || (!getJavaFileInfo().getPluginConfig().getCodeGenerateForsbi().equals(SBI))) {
- getTempJavaCodeFragmentFiles().getServiceTempFiles().setManagerNeedToBeGenerated(true);
- }
+ || (!getJavaFileInfo().getPluginConfig().getCodeGenerateForsbi().equals(SBI))) {
+ getTempJavaCodeFragmentFiles().getServiceTempFiles().setManagerNeedToBeGenerated(true);
+ }
}
}
getTempJavaCodeFragmentFiles().generateJavaFile(GENERATE_SERVICE_AND_MANAGER, this);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeDef.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeDefTranslator.java
similarity index 90%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeDef.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeDefTranslator.java
index e08ec19..7cec2df 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeDef.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeDefTranslator.java
@@ -17,13 +17,13 @@
import java.io.IOException;
-import org.onosproject.yangutils.datamodel.YangTypeDef;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaTypeDef;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_TYPEDEF_CLASS;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfNode;
@@ -31,18 +31,13 @@
/**
* Represents type define information extended to support java code generation.
*/
-public class YangJavaTypeDef
- extends YangTypeDef
+public class YangJavaTypeDefTranslator
+ extends YangJavaTypeDef
implements JavaCodeGeneratorInfo, JavaCodeGenerator {
private static final long serialVersionUID = 806201620L;
/**
- * Contains the information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code
* snippet types.
*/
@@ -51,7 +46,7 @@
/**
* Creates a YANG java typedef object.
*/
- public YangJavaTypeDef() {
+ public YangJavaTypeDefTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_TYPEDEF_CLASS);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaType.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeTranslator.java
similarity index 79%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaType.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeTranslator.java
index 1a96a3a..d8fe517 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaType.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaTypeTranslator.java
@@ -16,16 +16,17 @@
package org.onosproject.yangutils.translator.tojava.javamodel;
import org.onosproject.yangutils.datamodel.YangType;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaQualifiedTypeInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
-import org.onosproject.yangutils.utils.io.impl.YangToJavaNamingConflictUtil;
+import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
/**
* Represents java information corresponding to the YANG type.
*
* @param <T> generic parameter for YANG java type
*/
-public class YangJavaType<T>
+public class YangJavaTypeTranslator<T>
extends YangType<T>
implements JavaQualifiedTypeResolver {
@@ -34,14 +35,14 @@
/**
* Create a YANG leaf object with java qualified access details.
*/
- public YangJavaType() {
+ public YangJavaTypeTranslator() {
super();
- setJavaQualifiedInfo(new JavaQualifiedTypeInfo());
+ setJavaQualifiedInfo(new JavaQualifiedTypeInfoTranslator());
}
@Override
public void updateJavaQualifiedInfo(YangToJavaNamingConflictUtil conflictResolver) {
- JavaQualifiedTypeInfo importInfo = getJavaQualifiedInfo();
+ JavaQualifiedTypeInfoTranslator importInfo = getJavaQualifiedInfo();
/*
* Type is added as an attribute in the class.
@@ -54,7 +55,7 @@
*/
importInfo.setClassInfo(className);
String classPkg = AttributesJavaDataType.getJavaImportPackage(this,
- false, conflictResolver);
+ false, conflictResolver);
if (classPkg == null) {
throw new TranslatorException("import package cannot be null when the class is used");
}
@@ -74,12 +75,12 @@
}
@Override
- public JavaQualifiedTypeInfo getJavaQualifiedInfo() {
- return javaQualifiedAccess;
+ public JavaQualifiedTypeInfoTranslator getJavaQualifiedInfo() {
+ return (JavaQualifiedTypeInfoTranslator) javaQualifiedAccess;
}
@Override
- public void setJavaQualifiedInfo(JavaQualifiedTypeInfo typeInfo) {
+ public void setJavaQualifiedInfo(JavaQualifiedTypeInfoTranslator typeInfo) {
javaQualifiedAccess = typeInfo;
}
}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUnion.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUnionTranslator.java
similarity index 90%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUnion.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUnionTranslator.java
index 0dca9a7..926bcb9 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUnion.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUnionTranslator.java
@@ -17,13 +17,13 @@
import java.io.IOException;
-import org.onosproject.yangutils.datamodel.YangUnion;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaUnion;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.GENERATE_UNION_CLASS;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.generateCodeOfNode;
@@ -31,18 +31,13 @@
/**
* Represents union information extended to support java code generation.
*/
-public class YangJavaUnion
- extends YangUnion
+public class YangJavaUnionTranslator
+ extends YangJavaUnion
implements JavaCodeGeneratorInfo, JavaCodeGenerator {
private static final long serialVersionUID = 806201619L;
/**
- * Contains the information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code
* snippet types.
*/
@@ -51,7 +46,7 @@
/**
* Creates an instance of YANG java union.
*/
- public YangJavaUnion() {
+ public YangJavaUnionTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_UNION_CLASS);
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUses.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUsesTranslator.java
similarity index 88%
rename from plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUses.java
rename to plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUsesTranslator.java
index 409688f..4717a15 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUses.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/javamodel/YangJavaUsesTranslator.java
@@ -15,30 +15,25 @@
*/
package org.onosproject.yangutils.translator.tojava.javamodel;
-import org.onosproject.yangutils.datamodel.YangUses;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangJavaUses;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.InvalidNodeForTranslatorException;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGenerator;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
/**
* Represents uses information extended to support java code generation.
*/
-public class YangJavaUses
- extends YangUses
+public class YangJavaUsesTranslator
+ extends YangJavaUses
implements JavaCodeGeneratorInfo, JavaCodeGenerator {
private static final long serialVersionUID = 806201618L;
/**
- * Contains the information of the java file being generated.
- */
- private JavaFileInfo javaFileInfo;
-
- /**
* File handle to maintain temporary java code fragments as per the code
* snippet types.
*/
@@ -47,7 +42,7 @@
/**
* Creates YANG java uses object.
*/
- public YangJavaUses() {
+ public YangJavaUsesTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ClassDefinitionGenerator.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ClassDefinitionGenerator.java
index 7631bb6..ce97834 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ClassDefinitionGenerator.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/ClassDefinitionGenerator.java
@@ -22,9 +22,9 @@
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNotification;
import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
+import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFilesContainer;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_CLASS_MASK;
@@ -445,7 +445,7 @@
* @return updated class definition
*/
private static String getDefinitionString(String def, JavaExtendsListHolder holder) {
- for (JavaQualifiedTypeInfo info : holder.getExtendsList()) {
+ for (JavaQualifiedTypeInfoTranslator info : holder.getExtendsList()) {
if (!holder.getExtendedClassStore().get(info)) {
def = def + info.getClassInfo() + COMMA + SPACE;
} else {
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java
index 1057bde..8ec8141 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGen.java
@@ -20,9 +20,9 @@
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
+import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
import org.onosproject.yangutils.translator.tojava.TempJavaServiceFragmentFiles;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax.getEnumJavaAttribute;
import static org.onosproject.yangutils.utils.UtilConstants.ACTIVATE_ANNOTATION_IMPORT;
@@ -105,7 +105,7 @@
* @param importInfo import info
* @return the textual java code information corresponding to the import list
*/
- static String getImportText(JavaQualifiedTypeInfo importInfo) {
+ static String getImportText(JavaQualifiedTypeInfoTranslator importInfo) {
return IMPORT + importInfo.getPkgInfo() + PERIOD + importInfo.getClassInfo() + SEMI_COLAN + NEW_LINE;
}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaExtendsListHolder.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaExtendsListHolder.java
index 9bd3bbf..a741312 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaExtendsListHolder.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaExtendsListHolder.java
@@ -22,10 +22,10 @@
import java.util.Map;
import org.onosproject.yangutils.datamodel.YangNode;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
import org.onosproject.yangutils.translator.tojava.JavaImportData;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
+import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
import org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase;
@@ -36,8 +36,8 @@
*/
public class JavaExtendsListHolder {
- private Map<JavaQualifiedTypeInfo, Boolean> extendedClassStore;
- private List<JavaQualifiedTypeInfo> extendsList;
+ private Map<JavaQualifiedTypeInfoTranslator, Boolean> extendedClassStore;
+ private List<JavaQualifiedTypeInfoTranslator> extendsList;
/**
* Creates an instance of JavaExtendsListHolder.
@@ -52,7 +52,7 @@
*
* @return extends list
*/
- public Map<JavaQualifiedTypeInfo, Boolean> getExtendedClassStore() {
+ public Map<JavaQualifiedTypeInfoTranslator, Boolean> getExtendedClassStore() {
return extendedClassStore;
}
@@ -61,7 +61,7 @@
*
* @param extendedClass map of classes need to be extended
*/
- private void setExtendedClassStore(Map<JavaQualifiedTypeInfo, Boolean> extendedClass) {
+ private void setExtendedClassStore(Map<JavaQualifiedTypeInfoTranslator, Boolean> extendedClass) {
extendedClassStore = extendedClass;
}
@@ -72,7 +72,7 @@
* @param node YANG node
* @param tempJavaFragmentFiles temp java fragment files
*/
- public void addToExtendsList(JavaQualifiedTypeInfo info, YangNode node,
+ public void addToExtendsList(JavaQualifiedTypeInfoTranslator info, YangNode node,
TempJavaFragmentFiles tempJavaFragmentFiles) {
JavaFileInfo fileInfo = ((JavaFileInfoContainer) node).getJavaFileInfo();
@@ -91,7 +91,7 @@
*
* @return the extendsList
*/
- public List<JavaQualifiedTypeInfo> getExtendsList() {
+ public List<JavaQualifiedTypeInfoTranslator> getExtendsList() {
return extendsList;
}
@@ -100,7 +100,7 @@
*
* @param classInfoList the extends List to set
*/
- private void setExtendsList(List<JavaQualifiedTypeInfo> classInfoList) {
+ private void setExtendsList(List<JavaQualifiedTypeInfoTranslator> classInfoList) {
extendsList = classInfoList;
}
@@ -109,7 +109,7 @@
*
* @param classInfo class info
*/
- private void addToExtendsList(JavaQualifiedTypeInfo classInfo) {
+ private void addToExtendsList(JavaQualifiedTypeInfoTranslator classInfo) {
getExtendsList().add(classInfo);
}
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGenerator.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGenerator.java
index fa0ef19..331878b 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGenerator.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGenerator.java
@@ -23,6 +23,7 @@
import org.onosproject.yangutils.datamodel.YangAugment;
import org.onosproject.yangutils.datamodel.YangAugmentableNode;
+import org.onosproject.yangutils.datamodel.YangDerivedInfo;
import org.onosproject.yangutils.datamodel.YangLeaf;
import org.onosproject.yangutils.datamodel.YangLeafList;
import org.onosproject.yangutils.datamodel.YangLeavesHolder;
@@ -34,16 +35,16 @@
import org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes;
import org.onosproject.yangutils.translator.tojava.JavaAttributeInfo;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
+import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFilesContainer;
import org.onosproject.yangutils.translator.tojava.TempJavaEnumerationFragmentFiles;
import org.onosproject.yangutils.translator.tojava.TempJavaEventFragmentFiles;
import org.onosproject.yangutils.translator.tojava.TempJavaServiceFragmentFiles;
import org.onosproject.yangutils.translator.tojava.TempJavaTypeFragmentFiles;
import org.onosproject.yangutils.translator.tojava.YangJavaModelUtils;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_CLASS_MASK;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_INTERFACE_MASK;
@@ -79,7 +80,7 @@
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.SETTER_FOR_INTERFACE_MASK;
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.TO_STRING_IMPL_MASK;
import static org.onosproject.yangutils.translator.tojava.JavaAttributeInfo.getAttributeInfoForTheData;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.getQualifiedTypeInfoOfCurNode;
+import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedTypeInfoOfCurNode;
import static org.onosproject.yangutils.translator.tojava.TempJavaFragmentFiles.getCurNodeAsAttributeInTarget;
import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.addAugmentationAttribute;
import static org.onosproject.yangutils.translator.tojava.utils.JavaCodeSnippetGen.getEnumsValueAttribute;
@@ -816,6 +817,7 @@
YangTypeDef typeDef = (YangTypeDef) curNode;
List<YangType<?>> types = typeDef.getTypeList();
YangType type = types.get(0);
+ YangDataTypes yangDataTypes = type.getDataType();
if (type.getDataType().equals(YangDataTypes.BINARY)) {
imports.add(IMPORT + JAVA_UTIL_OBJECTS_IMPORT_PKG + PERIOD + JAVA_UTIL_IMPORT_BASE64_CLASS);
}
@@ -878,7 +880,7 @@
//To string method.
if (type.getDataType().equals(YangDataTypes.BINARY)) {
- JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
+ JavaQualifiedTypeInfoTranslator qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
getCapitalCase("binary"));
JavaAttributeInfo attr = getAttributeInfoForTheData(qualifiedTypeInfo, "binary", null, false,
@@ -892,7 +894,7 @@
+ SEMI_COLAN + NEW_LINE + FOUR_SPACE_INDENTATION + CLOSE_CURLY_BRACKET + NEW_LINE;
methods.add(bitsToStringMethod);
} else if (type.getDataType().equals(YangDataTypes.BITS)) {
- JavaQualifiedTypeInfo qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
+ JavaQualifiedTypeInfoTranslator qualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(curNode,
getCapitalCase("bits"));
JavaAttributeInfo attr = getAttributeInfoForTheData(qualifiedTypeInfo, "bits", null, false, false);
@@ -912,11 +914,26 @@
JavaCodeGeneratorInfo javaGenInfo = (JavaCodeGeneratorInfo) curNode;
- //From string method.
- methods.add(getFromStringMethodSignature(className, pluginConfig)
- + getDataFromTempFileHandle(FROM_STRING_IMPL_MASK, javaGenInfo.getTempJavaCodeFragmentFiles()
- .getTypeTempFiles(), path)
- + getFromStringMethodClose());
+ if ((type.getDataType().equals(YangDataTypes.DERIVED))
+ && (((YangDerivedInfo) type.getDataTypeExtendedInfo()).getEffectiveBuiltInType()
+ .equals(YangDataTypes.IDENTITYREF))) {
+ yangDataTypes = YangDataTypes.IDENTITYREF;
+ }
+
+ if (type.getDataType().equals(YangDataTypes.IDENTITYREF)) {
+ yangDataTypes = YangDataTypes.IDENTITYREF;
+ }
+
+ if (!yangDataTypes.equals(YangDataTypes.IDENTITYREF)) {
+
+
+ //From string method.
+ methods.add(getFromStringMethodSignature(className, pluginConfig)
+ + getDataFromTempFileHandle(FROM_STRING_IMPL_MASK, javaGenInfo
+ .getTempJavaCodeFragmentFiles()
+ .getTypeTempFiles(), path)
+ + getFromStringMethodClose());
+ }
} catch (IOException e) {
throw new IOException("No data found in temporary java code fragment files for " + className
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java
index c5558ff..55c64e4 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaFileGeneratorUtils.java
@@ -25,12 +25,13 @@
import org.onosproject.yangutils.datamodel.YangAugment;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangNodeIdentifier;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
import org.onosproject.yangutils.translator.tojava.JavaImportData;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
+import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
import org.onosproject.yangutils.translator.tojava.TempJavaBeanFragmentFiles;
import org.onosproject.yangutils.translator.tojava.TempJavaCodeFragmentFiles;
import org.onosproject.yangutils.translator.tojava.TempJavaEnumerationFragmentFiles;
@@ -40,7 +41,6 @@
import org.onosproject.yangutils.translator.tojava.TempJavaTypeFragmentFiles;
import org.onosproject.yangutils.utils.io.impl.CopyrightHeader;
import org.onosproject.yangutils.utils.io.impl.JavaDocGen.JavaDocType;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_CLASS_MASK;
import static org.onosproject.yangutils.translator.tojava.GeneratedJavaFileType.BUILDER_INTERFACE_MASK;
@@ -76,7 +76,7 @@
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.SETTER_FOR_CLASS_MASK;
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.SETTER_FOR_INTERFACE_MASK;
import static org.onosproject.yangutils.translator.tojava.GeneratedTempFileType.TO_STRING_IMPL_MASK;
-import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo.getQualifiedTypeInfoOfCurNode;
+import static org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator.getQualifiedTypeInfoOfCurNode;
import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.getAugmentedNodesPackage;
import static org.onosproject.yangutils.translator.tojava.utils.ClassDefinitionGenerator.generateClassDefinition;
import static org.onosproject.yangutils.utils.UtilConstants.CLOSE_CURLY_BRACKET;
@@ -343,7 +343,7 @@
* @param importsList list of java imports
* @param curNode current YANG node
* @param className class name
- * @throws IOException
+ * @throws IOException when fails to do IO operations
*/
private static void appendContents(File file, int genType, List<String> importsList, YangNode curNode,
String className)
@@ -597,7 +597,7 @@
TempJavaCodeFragmentFiles tempJavaCodeFragmentFiles = ((JavaCodeGeneratorInfo) parent)
.getTempJavaCodeFragmentFiles();
YangNode augmentedNode;
- JavaQualifiedTypeInfo javaQualifiedTypeInfo;
+ JavaQualifiedTypeInfoTranslator javaQualifiedTypeInfo;
String curNodeName;
JavaFileInfo parentInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo();
for (YangAtomicPath nodeId : targets) {
@@ -625,9 +625,10 @@
* @param pluginConfig plugin configurations
* @return qualified type info of augmented node
*/
- private static JavaQualifiedTypeInfo getQualifiedTypeInfoOfAugmentedNode(YangNode augmentedNode, String curNodeName,
- YangPluginConfig pluginConfig) {
- JavaQualifiedTypeInfo javaQualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(augmentedNode,
+ private static JavaQualifiedTypeInfoTranslator getQualifiedTypeInfoOfAugmentedNode(YangNode augmentedNode,
+ String curNodeName,
+ YangPluginConfig pluginConfig) {
+ JavaQualifiedTypeInfoTranslator javaQualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(augmentedNode,
getCapitalCase(curNodeName));
if (javaQualifiedTypeInfo.getPkgInfo() == null) {
javaQualifiedTypeInfo.setPkgInfo(getAugmentedNodesPackage(augmentedNode,
@@ -643,9 +644,9 @@
* @param importData import data
* @return true if present in imports
*/
- private static boolean validateQualifiedInfoOfAugmentedNode(JavaQualifiedTypeInfo javaQualifiedTypeInfo,
+ private static boolean validateQualifiedInfoOfAugmentedNode(JavaQualifiedTypeInfoTranslator javaQualifiedTypeInfo,
JavaImportData importData) {
- for (JavaQualifiedTypeInfo curImportInfo : importData.getImportSet()) {
+ for (JavaQualifiedTypeInfoTranslator curImportInfo : importData.getImportSet()) {
if (curImportInfo.getClassInfo()
.contentEquals(javaQualifiedTypeInfo.getClassInfo())) {
return curImportInfo.getPkgInfo()
@@ -664,7 +665,7 @@
*/
static String getAugmentedClassNameForDataMethods(YangNode augmentedNode, YangNode parent) {
String curNodeName;
- JavaQualifiedTypeInfo javaQualifiedTypeInfo;
+ JavaQualifiedTypeInfoTranslator javaQualifiedTypeInfo;
JavaFileInfo parentInfo = ((JavaFileInfoContainer) parent).getJavaFileInfo();
YangPluginConfig pluginConfig = parentInfo.getPluginConfig();
TempJavaServiceFragmentFiles tempJavaServiceFragmentFiles = ((JavaCodeGeneratorInfo) parent)
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntax.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntax.java
index 9743c92..d394568 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntax.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntax.java
@@ -24,10 +24,10 @@
import java.util.List;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
import org.onosproject.yangutils.utils.io.impl.YangIoUtils;
-import org.onosproject.yangutils.utils.io.impl.YangToJavaNamingConflictUtil;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
import static org.onosproject.yangutils.datamodel.utils.DataModelUtils.getParentNodeInGenCode;
import static org.onosproject.yangutils.utils.UtilConstants.COLAN;
diff --git a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
index 06a3f4b..d8ba37a 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGenerator.java
@@ -34,7 +34,7 @@
import org.onosproject.yangutils.translator.tojava.JavaFileInfoContainer;
import org.onosproject.yangutils.translator.tojava.TempJavaBeanFragmentFiles;
import org.onosproject.yangutils.utils.io.impl.JavaDocGen;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BINARY;
import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.BITS;
@@ -1630,6 +1630,8 @@
return NEW + SPACE + BIG_DECIMAL;
case STRING:
return EMPTY_STRING;
+ case IDENTITYREF:
+ return EMPTY_STRING;
case EMPTY:
case BOOLEAN:
return BOOLEAN_WRAPPER + PERIOD + PARSE_BOOLEAN;
diff --git a/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java b/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
index af0b4e3..a674f17 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/JavaDocGen.java
@@ -16,6 +16,8 @@
package org.onosproject.yangutils.utils.io.impl;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
+
import static org.onosproject.yangutils.utils.UtilConstants.AUGMENTED;
import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_FOR_VALIDATOR;
import static org.onosproject.yangutils.utils.UtilConstants.JAVA_DOC_FOR_VALIDATOR_RETURN;
diff --git a/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java b/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
index 566e9ce..0c6b51e 100644
--- a/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
+++ b/plugin/src/main/java/org/onosproject/yangutils/utils/io/impl/YangIoUtils.java
@@ -30,6 +30,8 @@
import java.util.regex.Pattern;
import org.apache.commons.io.FileUtils;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
import org.onosproject.yangutils.translator.exception.TranslatorException;
import static org.onosproject.yangutils.utils.UtilConstants.COLAN;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/ietfyang/IetfYangFileTest.java b/plugin/src/test/java/org/onosproject/yangutils/ietfyang/IetfYangFileTest.java
index 7a1ab65..0fb1108 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/ietfyang/IetfYangFileTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/ietfyang/IetfYangFileTest.java
@@ -25,7 +25,7 @@
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
import org.onosproject.yangutils.plugin.manager.YangUtilManager;
import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/AugmentTranslatorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/AugmentTranslatorTest.java
index f502835..16914a3 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/AugmentTranslatorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/AugmentTranslatorTest.java
@@ -22,7 +22,7 @@
import org.junit.Test;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java
index 789bf94..ef1b774 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ChoiceCaseTranslatorTest.java
@@ -22,7 +22,7 @@
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/EnumTranslatorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/EnumTranslatorTest.java
index 3fbf50f..69f6c7e 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/EnumTranslatorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/EnumTranslatorTest.java
@@ -22,7 +22,7 @@
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java
index 7379074..e5ed4cf 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterFileLinkingTest.java
@@ -40,7 +40,7 @@
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java
index 94585a2..615e63a 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/InterJarLinkerTest.java
@@ -37,7 +37,7 @@
import org.onosproject.yangutils.datamodel.YangLeaf;
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ManagerCodeGeneratorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ManagerCodeGeneratorTest.java
index 6bde56f..e72471c 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ManagerCodeGeneratorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/ManagerCodeGeneratorTest.java
@@ -23,7 +23,7 @@
import org.junit.Test;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java
index ac7e417..8ef8a6a 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/NotificationTranslatorTest.java
@@ -22,7 +22,7 @@
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/RpcTranslatorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/RpcTranslatorTest.java
index 078ea50..c8961d7 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/RpcTranslatorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/RpcTranslatorTest.java
@@ -22,7 +22,7 @@
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/TypeDefTranslatorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/TypeDefTranslatorTest.java
index d433d41..dc728c4 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/TypeDefTranslatorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/TypeDefTranslatorTest.java
@@ -22,7 +22,7 @@
import org.junit.Test;
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java
index b992d39..1d5e548 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/plugin/manager/UnionTranslatorTest.java
@@ -24,7 +24,7 @@
import org.onosproject.yangutils.parser.exceptions.ParserException;
import org.onosproject.yangutils.parser.impl.YangUtilsParserManager;
import org.onosproject.yangutils.utils.io.impl.YangFileScanner;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorUtil.generateJavaCode;
import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.deleteDirectory;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataTypeTest.java b/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataTypeTest.java
index be32dfa..e54e4f2 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataTypeTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/javamodel/AttributesJavaDataTypeTest.java
@@ -24,8 +24,8 @@
import org.onosproject.yangutils.datamodel.YangNode;
import org.onosproject.yangutils.datamodel.YangType;
import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
-import org.onosproject.yangutils.translator.tojava.JavaFileInfo;
-import org.onosproject.yangutils.utils.io.impl.YangToJavaNamingConflictUtil;
+import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
@@ -168,7 +168,7 @@
*/
@SuppressWarnings("unchecked")
private YangType<?> getStubExtendedInfo(YangType<?> type) throws DataModelException {
- YangJavaTypeDef typedef = new YangJavaTypeDef();
+ YangJavaTypeDefTranslator typedef = new YangJavaTypeDefTranslator();
getStubParent().addChild(typedef);
YangDerivedInfo<?> derInfo = new YangDerivedInfo<>();
derInfo.setReferredTypeDef(typedef);
@@ -194,7 +194,7 @@
* @return stub parent module
*/
private YangNode getStubParent() {
- YangJavaModule parent = new YangJavaModule();
+ YangJavaModuleTranslator parent = new YangJavaModuleTranslator();
parent.setJavaFileInfo(addStubJavaFileInfo());
return parent;
}
diff --git a/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGenTest.java b/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGenTest.java
index 7081156..48655cd 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGenTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaCodeSnippetGenTest.java
@@ -20,7 +20,7 @@
import java.lang.reflect.InvocationTargetException;
import org.junit.Test;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
+import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
@@ -78,7 +78,7 @@
*/
@Test
public void testForImportText() {
- JavaQualifiedTypeInfo importInfo = new JavaQualifiedTypeInfo();
+ JavaQualifiedTypeInfoTranslator importInfo = new JavaQualifiedTypeInfoTranslator();
importInfo.setPkgInfo(PKG_INFO);
importInfo.setClassInfo(CLASS_INFO);
diff --git a/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntaxTest.java b/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntaxTest.java
index bd598e4..0fee831 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntaxTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntaxTest.java
@@ -27,7 +27,7 @@
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onosproject.yangutils.translator.exception.TranslatorException;
-import org.onosproject.yangutils.utils.io.impl.YangToJavaNamingConflictUtil;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangToJavaNamingConflictUtil;
import static org.apache.commons.io.FileUtils.deleteDirectory;
import static org.hamcrest.core.Is.is;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java b/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java
index 5a8f822..cd25b6d 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/MethodsGeneratorTest.java
@@ -22,8 +22,8 @@
import org.junit.Test;
import org.onosproject.yangutils.datamodel.YangType;
import org.onosproject.yangutils.translator.tojava.JavaAttributeInfo;
-import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfo;
-import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
+import org.onosproject.yangutils.translator.tojava.JavaQualifiedTypeInfoTranslator;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
@@ -297,8 +297,8 @@
*
* @return java qualified info
*/
- private JavaQualifiedTypeInfo getTestJavaQualifiedTypeInfo() {
- JavaQualifiedTypeInfo info = new JavaQualifiedTypeInfo();
+ private JavaQualifiedTypeInfoTranslator getTestJavaQualifiedTypeInfo() {
+ JavaQualifiedTypeInfoTranslator info = new JavaQualifiedTypeInfoTranslator();
info.setPkgInfo(JAVA_LANG);
info.setClassInfo(STRING_DATA_TYPE);
return info;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/JavaDocGenTest.java b/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/JavaDocGenTest.java
index 5b36403..9fd9d62 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/JavaDocGenTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/JavaDocGenTest.java
@@ -22,6 +22,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
diff --git a/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/YangIoUtilsTest.java b/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/YangIoUtilsTest.java
index 6451e4d..5b8cddb 100644
--- a/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/YangIoUtilsTest.java
+++ b/plugin/src/test/java/org/onosproject/yangutils/utils/io/impl/YangIoUtilsTest.java
@@ -24,6 +24,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.onosproject.yangutils.datamodel.javadatamodel.YangPluginConfig;
import org.onosproject.yangutils.utils.UtilConstants;
import static org.hamcrest.core.Is.is;