MetadataAttribute attributeToMetadata(Attribute attribute) { final int productDataType = getProductDataType(attribute.getDataType(), false, false); if (productDataType != -1) { ProductData productData; if (attribute.isString()) { productData = ProductData.createInstance(attribute.getStringValue()); } else if (attribute.isArray()) { productData = ProductData.createInstance(productDataType, attribute.getLength()); productData.setElems(attribute.getValues().getStorage()); } else { productData = ProductData.createInstance(productDataType, 1); productData.setElems(attribute.getValues().getStorage()); } return new MetadataAttribute(attribute.getShortName(), productData, true); } return null; }