MetaClass elementType = MarshallingGenUtil.getConcreteCollectionElementType(field.getType()); if (elementType == null) { throw new UnsupportedOperationException(
MetaClass elementType = MarshallingGenUtil.getConcreteCollectionElementType(field.getType()); if (elementType == null) { throw new UnsupportedOperationException(
public Statement maybeAddAssumedTypes(BlockBuilder<?> blockBuilder, String varName, Mapping mapping, Statement statement) { final MetaClass elementType = MarshallingGenUtil.getConcreteCollectionElementType(mapping.getType()); final MetaClass mapKeyType = MarshallingGenUtil.getConcreteMapKeyType(mapping.getType()); final MetaClass mapValueType = MarshallingGenUtil.getConcreteMapValueType(mapping.getType()); boolean assumedMapTypesSet = false; if (elementType != null) { blockBuilder.append(Stmt.loadVariable("a1").invoke("setAssumedElementType", elementType.getFullyQualifiedName())); } else if (mapKeyType != null && mapValueType != null) { blockBuilder.append(Stmt.loadVariable("a1").invoke("setAssumedMapKeyType", mapKeyType.getFullyQualifiedName())); blockBuilder.append(Stmt.loadVariable("a1") .invoke("setAssumedMapValueType", mapValueType.getFullyQualifiedName())); assumedMapTypesSet = true; } if (varName != null) { blockBuilder.append(Stmt.declareFinalVariable(varName, mapping.getTargetType(), statement)); } else { blockBuilder.append(statement); } if (assumedMapTypesSet) { blockBuilder.append(Stmt.loadVariable("a1").invoke("resetAssumedTypes")); } return (varName != null) ? Stmt.loadVariable(varName) : statement; }
public Statement maybeAddAssumedTypes(BlockBuilder<?> blockBuilder, String varName, Mapping mapping, Statement statement) { final MetaClass elementType = MarshallingGenUtil.getConcreteCollectionElementType(mapping.getType()); final MetaClass mapKeyType = MarshallingGenUtil.getConcreteMapKeyType(mapping.getType()); final MetaClass mapValueType = MarshallingGenUtil.getConcreteMapValueType(mapping.getType()); boolean assumedMapTypesSet = false; if (elementType != null) { blockBuilder.append(Stmt.loadVariable("a1").invoke("setAssumedElementType", elementType.getFullyQualifiedName())); } else if (mapKeyType != null && mapValueType != null) { blockBuilder.append(Stmt.loadVariable("a1").invoke("setAssumedMapKeyType", mapKeyType.getFullyQualifiedName())); blockBuilder.append(Stmt.loadVariable("a1") .invoke("setAssumedMapValueType", mapValueType.getFullyQualifiedName())); assumedMapTypesSet = true; } if (varName != null) { blockBuilder.append(Stmt.declareFinalVariable(varName, mapping.getTargetType(), statement)); } else { blockBuilder.append(statement); } if (assumedMapTypesSet) { blockBuilder.append(Stmt.loadVariable("a1").invoke("resetAssumedTypes")); } return (varName != null) ? Stmt.loadVariable(varName) : statement; }