/** * Get the list of referenced values. * * @param valueDescriptor The value descriptor containing a list value. * @param <T> The type of the value descriptor. * @return The list of referenced values. */ private <T extends ValueDescriptor<List<ValueDescriptor>>> List<ValueDescriptor> getListValue( T valueDescriptor) { List<ValueDescriptor> values = valueDescriptor.getValue(); if (values == null) { values = new LinkedList<>(); valueDescriptor.setValue(values); } return values; }
/** * Create a value descriptor of given type and name and initializes it. * * @param type The class type. * @param name The name * @param <T> The type. * @return The initialized descriptor. */ private <T extends ValueDescriptor> T createValue(Class<T> type, String name) { if (name != null) { this.arrayValueDescriptor = null; } String valueName; if (arrayValueDescriptor != null) { valueName = "[" + getListValue(this.arrayValueDescriptor).size() + "]"; } else { valueName = name; } T valueDescriptor = visitorHelper.getValueDescriptor(type); valueDescriptor.setName(valueName); return valueDescriptor; }