Shankara-Huawei
Committed by Gerrit Code Review

[ONOS-4922] Javamodel package creation for YANG utils.

Change-Id: Iff1745a8c04881b44db3f2f687967f984c38e2c7
Showing 92 changed files with 1302 additions and 585 deletions
......@@ -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.
......
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
......@@ -13,25 +13,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.yangutils.translator.tojava;
package org.onosproject.yangutils.datamodel.javadatamodel;
import org.onosproject.yangutils.datamodel.YangList;
/**
* Represents the information of the java import data.
* Represent YANG java list.
*/
public interface JavaImportDataContainer {
public class YangJavaList extends YangList {
private static final long serialVersionUID = 208201608L;
/**
* Returns the data of java imports to be included in generated file.
*
* @return data of java imports to be included in generated file
* Contains the information of the java file being generated.
*/
JavaImportData getJavaImportData();
protected JavaFileInfo javaFileInfo;
/**
* Sets the data of java imports to be included in generated file.
* Returns java file info.
*
* @param javaImportData data of java imports to be included in generated
* file
* @return java file info
*/
void setJavaImportData(JavaImportData javaImportData);
public JavaFileInfo getJavaFileInfo() {
return javaFileInfo;
}
}
......
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
/*
* 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;
}
}
......@@ -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.
......
......@@ -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.
......
/*
* 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;
......@@ -39,8 +39,8 @@ import org.onosproject.yangutils.parser.YangUtilsParser;
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;
......
......@@ -48,7 +48,7 @@ public final class JavaAttributeInfo {
* 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.
......@@ -139,7 +139,7 @@ public final class JavaAttributeInfo {
*
* @param isList if the added attribute is a list of info
*/
public void setListAttr(boolean isList) {
private void setListAttr(boolean isList) {
isListAttr = isList;
}
......@@ -161,7 +161,7 @@ public final class JavaAttributeInfo {
* @param isQualified if the added attribute has to be accessed in a fully
* qualified manner
*/
public void setIsQualifiedAccess(boolean isQualified) {
private void setIsQualifiedAccess(boolean isQualified) {
isQualifiedName = isQualified;
}
......@@ -171,7 +171,7 @@ public final class JavaAttributeInfo {
*
* @return import info
*/
public JavaQualifiedTypeInfo getImportInfo() {
public JavaQualifiedTypeInfoTranslator getImportInfo() {
return importInfo;
}
......@@ -180,43 +180,43 @@ public final class JavaAttributeInfo {
*
* @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;
}
......@@ -230,7 +230,8 @@ public final class JavaAttributeInfo {
* @param isListAttribute is list attribute
* @return java attribute info.
*/
public static JavaAttributeInfo getAttributeInfoForTheData(JavaQualifiedTypeInfo importInfo, String attributeName,
public static JavaAttributeInfo getAttributeInfoForTheData(JavaQualifiedTypeInfoTranslator importInfo,
String attributeName,
YangType<?> attributeType, boolean isQualifiedAccess,
boolean isListAttribute) {
......
......@@ -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.
......
......@@ -20,9 +20,10 @@ import java.io.IOException;
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;
......
......@@ -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.
......
......@@ -22,8 +22,7 @@ import java.util.TreeSet;
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.IMPORT;
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.NEW_LINE;
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 @@ public class JavaImportData {
* 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 @@ public class JavaImportData {
*
* @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 @@ public class JavaImportData {
*
* @param isList status to mention list is bing imported
*/
public void setIfListImported(boolean isList) {
void setIfListImported(boolean isList) {
isListToImport = isList;
}
......@@ -93,7 +93,7 @@ public class JavaImportData {
*
* @return the set containing the imported class/interface info
*/
public SortedSet<JavaQualifiedTypeInfo> getImportSet() {
public SortedSet<JavaQualifiedTypeInfoTranslator> getImportSet() {
return importSet;
}
......@@ -102,14 +102,14 @@ public class JavaImportData {
*
* @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,7 +122,7 @@ public class JavaImportData {
* @param classPkg generated class package
* @return qualified access status of the import node being added
*/
public boolean addImportInfo(JavaQualifiedTypeInfo newImportInfo,
public boolean addImportInfo(JavaQualifiedTypeInfoTranslator newImportInfo,
String className, String classPkg) {
if (newImportInfo.getClassInfo().contentEquals(className)) {
......@@ -144,14 +144,14 @@ public class JavaImportData {
* 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 @@ public class JavaImportData {
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 @@ public class JavaImportData {
*
* @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 @@ public class JavaImportData {
*
* @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 @@ public class JavaImportData {
*
* @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 @@ public class JavaImportData {
*
* @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 @@ public class JavaImportData {
*
* @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 @@ public class JavaImportData {
*
* @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 @@ public class JavaImportData {
*
* @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 @@ public class JavaImportData {
*
* @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 @@ public class JavaImportData {
*
* @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 @@ public class JavaImportData {
*
* @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;
}
......
......@@ -25,12 +25,12 @@ public interface JavaQualifiedTypeInfoContainer {
*
* @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);
}
......
......@@ -20,10 +20,11 @@ import java.io.Serializable;
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 @@ import static org.onosproject.yangutils.translator.tojava.javamodel.AttributesJa
/**
* 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 class JavaQualifiedTypeInfo
*/
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 @@ public class JavaQualifiedTypeInfo
* import info for child class
* @return return the import info for this attribute
*/
public static JavaQualifiedTypeInfo getQualifiedTypeInfoOfCurNode(YangNode curNode,
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 @@ public class JavaQualifiedTypeInfo
* @param conflictResolver plugin configurations
* @return return the import info for this attribute
*/
public static JavaQualifiedTypeInfo getQualifiedInfoOfFromString(JavaAttributeInfo referredTypesAttrInfo,
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 @@ public class JavaQualifiedTypeInfo
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 @@ public class JavaQualifiedTypeInfo
* @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 @@ public class JavaQualifiedTypeInfo
* @param other compared import info.
*/
@Override
public int compareTo(JavaQualifiedTypeInfo other) {
public int compareTo(JavaQualifiedTypeInfoTranslator other) {
return getClassInfo().compareTo(other.getClassInfo());
}
......
......@@ -19,7 +19,8 @@ package org.onosproject.yangutils.translator.tojava;
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;
......
......@@ -20,8 +20,9 @@ import java.io.IOException;
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 @@ public class TempJavaCodeFragmentFiles {
*
* @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 @@ public class TempJavaCodeFragmentFiles {
*
* @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 @@ public class TempJavaCodeFragmentFiles {
*
* @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 @@ public class TempJavaCodeFragmentFiles {
*
* @param enumerationTempFiles temp file handle for enumeration file generation
*/
public void setEnumerationTempFiles(
private void setEnumerationTempFiles(
TempJavaEnumerationFragmentFiles enumerationTempFiles) {
this.enumerationTempFiles = enumerationTempFiles;
}
......@@ -179,7 +180,7 @@ public class TempJavaCodeFragmentFiles {
*
* @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 @@ public class TempJavaCodeFragmentFiles {
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 @@ public class TempJavaCodeFragmentFiles {
}
/*
* Creats enumeration class file.
* Creates enumeration class file.
*/
if (fileType == GENERATE_ENUM_CLASS) {
getEnumerationTempFiles().generateJavaFile(GENERATE_ENUM_CLASS, curNode);
......@@ -228,32 +229,6 @@ public class TempJavaCodeFragmentFiles {
}
/**
* 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.
*
......@@ -261,7 +236,7 @@ public class TempJavaCodeFragmentFiles {
* @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);
......@@ -327,7 +302,7 @@ public class TempJavaCodeFragmentFiles {
* 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) {
......
......@@ -22,13 +22,14 @@ import java.util.HashMap;
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 @@ public class TempJavaEnumerationFragmentFiles extends TempJavaFragmentFiles {
* @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());
......
......@@ -22,9 +22,10 @@ import java.util.ArrayList;
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.
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 @@ public class TempJavaEventFragmentFiles
//Creates event interface file.
setEventSubjectJavaFileHandle(getJavaFileHandle(curNode, curNodeInfo +
TempJavaEventFragmentFiles.EVENT_SUBJECT_NAME_SUFFIX));
EVENT_SUBJECT_NAME_SUFFIX));
generateEventSubjectFile(getEventSubjectJavaFileHandle(), curNode);
}
......@@ -428,7 +429,7 @@ public class TempJavaEventFragmentFiles
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 @@ public class TempJavaEventFragmentFiles
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();
......
......@@ -28,13 +28,14 @@ import org.onosproject.yangutils.datamodel.YangLeavesHolder;
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.
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 @@ public class TempJavaFragmentFiles {
/**
* 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 @@ public class TempJavaFragmentFiles {
/**
* Import info for case.
*/
private JavaQualifiedTypeInfo caseImportInfo;
private JavaQualifiedTypeInfoTranslator caseImportInfo;
/**
* Is attribute added.
......@@ -446,7 +447,7 @@ public class TempJavaFragmentFiles {
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 @@ public class TempJavaFragmentFiles {
* 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 @@ public class TempJavaFragmentFiles {
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 @@ public class TempJavaFragmentFiles {
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 @@ public class TempJavaFragmentFiles {
*
* @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 @@ public class TempJavaFragmentFiles {
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 @@ public class TempJavaFragmentFiles {
* @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");
......@@ -1411,7 +1418,7 @@ public class TempJavaFragmentFiles {
}
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 @@ public class TempJavaFragmentFiles {
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 @@ public class TempJavaFragmentFiles {
* 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 @@ public class TempJavaFragmentFiles {
*/
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 @@ public class TempJavaFragmentFiles {
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 @@ public class TempJavaFragmentFiles {
* @return status of the qualified access to the attribute
*/
boolean getIsQualifiedAccessOrAddToImportList(
JavaQualifiedTypeInfo importInfo) {
JavaQualifiedTypeInfoTranslator importInfo) {
return getJavaImportData().addImportInfo(importInfo, getGeneratedJavaClassName(),
getJavaFileInfo().getPackage());
......
......@@ -21,10 +21,11 @@ import java.io.IOException;
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 @@ public class TempJavaServiceFragmentFiles
.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;
}
}
......
......@@ -24,10 +24,11 @@ import java.util.List;
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.
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 @@ public class TempJavaTypeFragmentFiles
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 @@ public class TempJavaTypeFragmentFiles
* @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 @@ public class TempJavaTypeFragmentFiles
}
/**
* 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 @@ public class TempJavaTypeFragmentFiles
*/
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
......
......@@ -34,7 +34,7 @@ public enum TraversalType {
/**
* Sibling node traversal.
*/
SIBILING,
SIBLING,
/**
* Parent node traversal.
......
......@@ -36,26 +36,26 @@ import org.onosproject.yangutils.datamodel.YangUnion;
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 final class YangDataModelFactory {
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 @@ public final class YangDataModelFactory {
* 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 final class YangDataModelFactory {
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.");
......
......@@ -26,19 +26,18 @@ import org.onosproject.yangutils.datamodel.YangAugment;
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 final class YangJavaModelUtils {
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 @@ public final class YangJavaModelUtils {
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 @@ public final class YangJavaModelUtils {
*/
javaCodeGeneratorInfo.getTempJavaCodeFragmentFiles()
.addTypeInfoToTempFiles((YangTypeHolder) javaCodeGeneratorInfo, yangPluginConfig);
} else if (javaCodeGeneratorInfo instanceof YangJavaEnumeration) {
} else if (javaCodeGeneratorInfo instanceof YangJavaEnumerationTranslator) {
/*
* Enumeration
*/
......@@ -207,22 +206,22 @@ public final class YangJavaModelUtils {
* @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 @@ public final class YangJavaModelUtils {
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 @@ public final class YangJavaModelUtils {
}
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 @@ public final class YangJavaModelUtils {
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 @@ public final class YangJavaModelUtils {
List<String> clsInfo = new ArrayList<>();
while (node.getParent() != null) {
if (!(node instanceof YangModule)
|| !(node instanceof YangSubModule)) {
if (node instanceof YangJavaAugment) {
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();
}
......
......@@ -21,23 +21,22 @@ import java.util.Stack;
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 @@ public final class AttributesJavaDataType {
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 @@ public final class AttributesJavaDataType {
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).
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 @@ public final class AttributesJavaDataType {
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 @@ public final class AttributesJavaDataType {
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 @@ public final class AttributesJavaDataType {
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 @@ public final class AttributesJavaDataType {
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 @@ public final class AttributesJavaDataType {
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 @@ public final class AttributesJavaDataType {
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 @@ public final class AttributesJavaDataType {
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 @@ public final class AttributesJavaDataType {
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 final class AttributesJavaDataType {
*/
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 @@ public final class AttributesJavaDataType {
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 @@ public final class AttributesJavaDataType {
.getPackage()));
}
/**
/*
* Parent of the node in stack is updated with java info,
* all the nodes can be popped and updated
*/
......
......@@ -17,7 +17,7 @@ package org.onosproject.yangutils.translator.tojava.javamodel;
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.
......
......@@ -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 @@ public interface JavaQualifiedTypeResolver
/**
* updates the qualified access details of the type.
*
* @param confilictResolver plugin configurations
* @param conflictResolver plugin configurations
*/
void updateJavaQualifiedInfo(YangToJavaNamingConflictUtil confilictResolver);
void updateJavaQualifiedInfo(YangToJavaNamingConflictUtil conflictResolver);
}
......
......@@ -17,13 +17,13 @@ package org.onosproject.yangutils.translator.tojava.javamodel;
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 @@ import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.gen
/**
* 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 @@ public class YangJavaAugment
/**
* Creates a YANG java augment object.
*/
public YangJavaAugment() {
public YangJavaAugmentTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
......
......@@ -17,13 +17,13 @@ package org.onosproject.yangutils.translator.tojava.javamodel;
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 @@ import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.gen
/**
* 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 @@ public class YangJavaCase
/**
* Creates YANG java case object.
*/
public YangJavaCase() {
public YangJavaCaseTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
......
......@@ -17,13 +17,13 @@ package org.onosproject.yangutils.translator.tojava.javamodel;
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 @@ import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.gen
/**
* 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 @@ public class YangJavaChoice
/**
* Creates YANG java choice object.
*/
public YangJavaChoice() {
public YangJavaChoiceTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(INTERFACE_MASK);
......
......@@ -17,13 +17,13 @@ package org.onosproject.yangutils.translator.tojava.javamodel;
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 @@ import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.gen
/**
* 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 @@ public class YangJavaContainer
/**
* Creates YANG java container object.
*/
public YangJavaContainer() {
public YangJavaContainerTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
......
......@@ -18,13 +18,13 @@ package org.onosproject.yangutils.translator.tojava.javamodel;
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 @@ import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.gen
/**
* 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 @@ public class YangJavaEnumeration
/**
* Creates YANG java enumeration object.
*/
public YangJavaEnumeration() {
public YangJavaEnumerationTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_ENUM_CLASS);
......
......@@ -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 @@ public class YangJavaGrouping
/**
* Creates YANG Java grouping object.
*/
public YangJavaGrouping() {
public YangJavaGroupingTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
}
......
......@@ -19,15 +19,15 @@ import java.io.File;
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 @@ import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase
/**
* 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 @@ public class YangJavaIdentity extends YangIdentity
* 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,18 +119,19 @@ public class YangJavaIdentity extends YangIdentity
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();
basePkgInfo.setClassInfo(baseClassName);
......
......@@ -18,13 +18,13 @@ package org.onosproject.yangutils.translator.tojava.javamodel;
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 @@ import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.gen
/**
* 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 @@ public class YangJavaInput
/**
* Creates an instance of java input.
*/
public YangJavaInput() {
public YangJavaInputTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
......
......@@ -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 @@ public class YangJavaLeafList
}
@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;
}
/**
......
......@@ -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;
}
......
......@@ -17,13 +17,13 @@ package org.onosproject.yangutils.translator.tojava.javamodel;
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 @@ import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.gen
/**
* 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 @@ public class YangJavaList
/**
* Creates YANG java list object.
*/
public YangJavaList() {
public YangJavaListTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
......
......@@ -19,15 +19,15 @@ import java.io.IOException;
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 @@ import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.searchAndDelet
/**
* 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 @@ public class YangJavaModule
/**
* Creates a YANG node of module type.
*/
public YangJavaModule() {
public YangJavaModuleTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
setNotificationNodes(new ArrayList<>());
......
......@@ -19,40 +19,35 @@ package org.onosproject.yangutils.translator.tojava.javamodel;
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 @@ public class YangJavaNotification
/**
* Creates an instance of java Notification.
*/
public YangJavaNotification() {
public YangJavaNotificationTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
......@@ -148,7 +143,7 @@ public class YangJavaNotification
.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 @@ public class YangJavaNotification
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());
......
......@@ -18,13 +18,13 @@ package org.onosproject.yangutils.translator.tojava.javamodel;
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 @@ import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.gen
/**
* 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 @@ public class YangJavaOutput
/**
* Creates an instance of java output.
*/
public YangJavaOutput() {
public YangJavaOutputTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_INTERFACE_WITH_BUILDER);
......
......@@ -22,23 +22,22 @@ import org.onosproject.yangutils.datamodel.RpcNotificationContainer;
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.MANAGER;
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 @@ public class YangJavaRpc
/**
* Creates an instance of YANG java rpc.
*/
public YangJavaRpc() {
public YangJavaRpcTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
}
......@@ -206,7 +201,7 @@ public class YangJavaRpc
* 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 @@ public class YangJavaRpc
* @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)
......
......@@ -23,13 +23,13 @@ import org.onosproject.yangutils.datamodel.YangBelongsTo;
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 @@ import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.searchAndDelet
/**
* 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 @@ public class YangJavaSubModule
/**
* Creates YANG java sub module object.
*/
public YangJavaSubModule() {
public YangJavaSubModuleTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
int gentype = GENERATE_SERVICE_AND_MANAGER | GENERATE_INTERFACE_WITH_BUILDER;
......
......@@ -17,13 +17,13 @@ package org.onosproject.yangutils.translator.tojava.javamodel;
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 @@ import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.gen
/**
* 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 @@ public class YangJavaTypeDef
/**
* Creates a YANG java typedef object.
*/
public YangJavaTypeDef() {
public YangJavaTypeDefTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_TYPEDEF_CLASS);
......
......@@ -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 @@ public class YangJavaType<T>
/**
* 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.
......@@ -74,12 +75,12 @@ public class YangJavaType<T>
}
@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;
}
}
......
......@@ -17,13 +17,13 @@ package org.onosproject.yangutils.translator.tojava.javamodel;
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 @@ import static org.onosproject.yangutils.translator.tojava.YangJavaModelUtils.gen
/**
* 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 @@ public class YangJavaUnion
/**
* Creates an instance of YANG java union.
*/
public YangJavaUnion() {
public YangJavaUnionTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
getJavaFileInfo().setGeneratedFileTypes(GENERATE_UNION_CLASS);
......
......@@ -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 @@ public class YangJavaUses
/**
* Creates YANG java uses object.
*/
public YangJavaUses() {
public YangJavaUsesTranslator() {
super();
setJavaFileInfo(new JavaFileInfo());
}
......
......@@ -22,9 +22,9 @@ import org.onosproject.yangutils.datamodel.YangIdentity;
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 @@ public final class ClassDefinitionGenerator {
* @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 {
......
......@@ -20,9 +20,9 @@ import java.util.List;
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 @@ public final class JavaCodeSnippetGen {
* @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;
}
......
......@@ -22,10 +22,10 @@ import java.util.List;
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 @@ import static org.onosproject.yangutils.utils.io.impl.YangIoUtils.getCapitalCase
*/
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 @@ public class JavaExtendsListHolder {
*
* @return extends list
*/
public Map<JavaQualifiedTypeInfo, Boolean> getExtendedClassStore() {
public Map<JavaQualifiedTypeInfoTranslator, Boolean> getExtendedClassStore() {
return extendedClassStore;
}
......@@ -61,7 +61,7 @@ public class JavaExtendsListHolder {
*
* @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 @@ public class JavaExtendsListHolder {
* @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 @@ public class JavaExtendsListHolder {
*
* @return the extendsList
*/
public List<JavaQualifiedTypeInfo> getExtendsList() {
public List<JavaQualifiedTypeInfoTranslator> getExtendsList() {
return extendsList;
}
......@@ -100,7 +100,7 @@ public class JavaExtendsListHolder {
*
* @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 @@ public class JavaExtendsListHolder {
*
* @param classInfo class info
*/
private void addToExtendsList(JavaQualifiedTypeInfo classInfo) {
private void addToExtendsList(JavaQualifiedTypeInfoTranslator classInfo) {
getExtendsList().add(classInfo);
}
......
......@@ -23,6 +23,7 @@ import java.util.List;
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.YangTypeDef;
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.
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 @@ public final class JavaFileGenerator {
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 @@ public final class JavaFileGenerator {
//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 @@ public final class JavaFileGenerator {
+ 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 @@ public final class JavaFileGenerator {
JavaCodeGeneratorInfo javaGenInfo = (JavaCodeGeneratorInfo) curNode;
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()
+ 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
......
......@@ -25,12 +25,13 @@ import org.onosproject.yangutils.datamodel.YangAtomicPath;
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.TempJavaServiceFragmentFiles;
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.
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 @@ public final class JavaFileGeneratorUtils {
* @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 @@ public final class JavaFileGeneratorUtils {
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 @@ public final class JavaFileGeneratorUtils {
* @param pluginConfig plugin configurations
* @return qualified type info of augmented node
*/
private static JavaQualifiedTypeInfo getQualifiedTypeInfoOfAugmentedNode(YangNode augmentedNode, String curNodeName,
private static JavaQualifiedTypeInfoTranslator getQualifiedTypeInfoOfAugmentedNode(YangNode augmentedNode,
String curNodeName,
YangPluginConfig pluginConfig) {
JavaQualifiedTypeInfo javaQualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(augmentedNode,
JavaQualifiedTypeInfoTranslator javaQualifiedTypeInfo = getQualifiedTypeInfoOfCurNode(augmentedNode,
getCapitalCase(curNodeName));
if (javaQualifiedTypeInfo.getPkgInfo() == null) {
javaQualifiedTypeInfo.setPkgInfo(getAugmentedNodesPackage(augmentedNode,
......@@ -643,9 +644,9 @@ public final class JavaFileGeneratorUtils {
* @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 @@ public final class JavaFileGeneratorUtils {
*/
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)
......
......@@ -24,10 +24,10 @@ import java.util.Date;
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;
......
......@@ -34,7 +34,7 @@ import org.onosproject.yangutils.translator.tojava.JavaCodeGeneratorInfo;
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 @@ public final class MethodsGenerator {
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;
......
......@@ -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;
......
......@@ -30,6 +30,8 @@ import java.util.Stack;
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;
......
......@@ -25,7 +25,7 @@ import org.onosproject.yangutils.parser.exceptions.ParserException;
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;
......
......@@ -22,7 +22,7 @@ import org.apache.maven.plugin.MojoExecutionException;
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;
......
......@@ -22,7 +22,7 @@ import org.junit.Test;
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;
......
......@@ -22,7 +22,7 @@ import org.junit.Test;
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;
......
......@@ -40,7 +40,7 @@ import org.onosproject.yangutils.linker.impl.YangLinkerManager;
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;
......
......@@ -37,7 +37,7 @@ import org.onosproject.yangutils.datamodel.YangGrouping;
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;
......
......@@ -23,7 +23,7 @@ import org.apache.maven.plugin.MojoExecutionException;
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;
......
......@@ -22,7 +22,7 @@ import org.junit.Test;
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;
......
......@@ -22,7 +22,7 @@ import org.junit.Test;
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;
......
......@@ -22,7 +22,7 @@ import org.apache.maven.plugin.MojoExecutionException;
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;
......
......@@ -24,7 +24,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.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;
......
......@@ -24,8 +24,8 @@ import org.onosproject.yangutils.datamodel.YangDerivedInfo;
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 @@ public class AttributesJavaDataTypeTest {
*/
@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 @@ public class AttributesJavaDataTypeTest {
* @return stub parent module
*/
private YangNode getStubParent() {
YangJavaModule parent = new YangJavaModule();
YangJavaModuleTranslator parent = new YangJavaModuleTranslator();
parent.setJavaFileInfo(addStubJavaFileInfo());
return parent;
}
......
......@@ -20,7 +20,7 @@ import java.lang.reflect.Constructor;
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 @@ public class JavaCodeSnippetGenTest {
*/
@Test
public void testForImportText() {
JavaQualifiedTypeInfo importInfo = new JavaQualifiedTypeInfo();
JavaQualifiedTypeInfoTranslator importInfo = new JavaQualifiedTypeInfoTranslator();
importInfo.setPkgInfo(PKG_INFO);
importInfo.setClassInfo(CLASS_INFO);
......
......@@ -27,7 +27,7 @@ import org.junit.Rule;
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;
......
......@@ -22,8 +22,8 @@ import java.lang.reflect.InvocationTargetException;
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 @@ public final class MethodsGeneratorTest {
*
* @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;
......
......@@ -22,6 +22,7 @@ import java.lang.reflect.InvocationTargetException;
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;
......
......@@ -24,6 +24,7 @@ import org.apache.commons.io.FileUtils;
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;
......