Skip to content

Commit

Permalink
Refactored PythonObject#getArray(String, Class) method
Browse files Browse the repository at this point in the history
  • Loading branch information
vruusmann committed Apr 5, 2024
1 parent d93f625 commit 862295b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions pmml-python/src/main/java/org/jpmml/python/PythonObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public HasArray getArray(String name){
throw new IllegalArgumentException("The value of \'" + ClassDictUtil.formatMember(this, name) + "\' attribute (" + ClassDictUtil.formatClass(object) + ") is not a supported array type");
}

public <E> List<? extends E> getArray(String name, Class<? extends E> clazz){
public <E> List<E> getArray(String name, Class<? extends E> clazz){
HasArray hasArray = getArray(name);

List<?> values = hasArray.getArrayContent();
Expand Down Expand Up @@ -308,9 +308,8 @@ public int[] getArrayShape(String name, int length){
return shape;
}

@SuppressWarnings("unchecked")
public List<Boolean> getBooleanArray(String name){
return (List<Boolean>)getArray(name, Boolean.class);
return getArray(name, Boolean.class);
}

public List<Integer> getIntegerArray(String name){
Expand Down Expand Up @@ -346,14 +345,12 @@ protected String formatMessage(Object object){
return Lists.transform(values, castFunction);
}

@SuppressWarnings("unchecked")
public List<Object> getObjectArray(String name){
return (List<Object>)getArray(name, Object.class);
return getArray(name, Object.class);
}

@SuppressWarnings("unchecked")
public List<String> getStringArray(String name){
return (List<String>)getArray(name, String.class);
return getArray(name, String.class);
}

public List<?> getArray(String name, String key){
Expand Down

0 comments on commit 862295b

Please sign in to comment.