private static final Logger LOG = LoggerFactory.getLogger(MdsalHelper.class);
private static Properties yangMappingProperties = new Properties();
-
+ protected static boolean useLegacyEnumerationMapping = false;
+
+ public static void useLegacyEnumerationMapping(Boolean bool) {
+ useLegacyEnumerationMapping = bool;
+ }
+
@Deprecated
public static void setProperties(Properties input) {
setYangMappingProperties(input);
}
if (retValue != null) {
String propName = propNamePfx + "." + fieldName;
- Method method = retValue.getClass().getMethod("getName");
- String yangValue = (String) method.invoke(retValue);
- props.setProperty(propName, yangValue);
+ if(useLegacyEnumerationMapping) {
+ propVal = retValue.toString();
+ props.setProperty(propName, mapEnumeratedValue(fieldName, propVal));
+ }else {
+ Method method = retValue.getClass().getMethod("getName");
+ String yangValue = (String) method.invoke(retValue);
+ props.setProperty(propName, yangValue);
+ }
+
}
} catch (Exception e) {
LOG.error(
Class returnClass = m.getReturnType();
String fieldName = toLowerHyphen(m.getName().substring(3));
- fieldName = fieldName.substring(0, 1).toLowerCase() + fieldName.substring(1);
-
+ if(fieldName!=null) {
+ fieldName = fieldName.substring(0, 1).toLowerCase() + fieldName.substring(1);
+ }else {
+ fieldName="";
+ }
String propName = propNamePfx + "." + fieldName;
// Is the return type a yang generated class?
}
public static boolean isYangGenerated(Class c) {
- if (c == null) {
- return (false);
- } else {
+ if (c != null) {
return (c.getName().startsWith("org.opendaylight.yang.gen."));
}
+ return false;
}
public static boolean isIpPrefix(Class c) {