@Test public void testGetLabelsAsArray() { when(functions.getValue(eq(BEAN1), eq("labelsField"))).thenReturn(new String[]{"label1", "label2"}); String[] labels = tested.getLabels(BEAN1); assertArrayEquals(new String[]{"label1", "label2"}, labels); }
@Override @SuppressWarnings("all") public String[] getLabels(T pojo) { final String fName = bindings.get(pojo.getClass()).getLabelsField(); final Object labels = getFieldValue(pojo, fName); if (labels instanceof Collection) { Collection<String> labelsCollection = (Collection<String>) labels; return labelsCollection.toArray(new String[labelsCollection.size()]); } return null != labels ? (String[]) labels : new String[0]; }
BindableDefinitionAdapterImpl implements BindableDefinitionAdapter<T> { @Override @SuppressWarnings("all") public String[] getLabels(T pojo) { final String fName = bindings.get(pojo.getClass()).getLabelsField(); final Object labels = getFieldValue(pojo, fName); if (labels instanceof Collection) { Collection<String> labelsCollection = (Collection<String>) labels; return labelsCollection.toArray(new String[labelsCollection.size()]); } return null != labels ? (String[]) labels : new String[0]; } }
BindableDefinitionAdapterImpl implements BindableDefinitionAdapter<T> { @Override @SuppressWarnings("all") public String[] getLabels(T pojo) { final String fName = bindings.get(pojo.getClass()).getLabelsField(); final Object labels = getFieldValue(pojo, fName); if (labels instanceof Collection) { Collection<String> labelsCollection = (Collection<String>) labels; return labelsCollection.toArray(new String[labelsCollection.size()]); } return null != labels ? (String[]) labels : new String[0]; } private  BindableDefinitionAdapterImpl(StunnerTranslationService translationService,
                                          BindableAdapterFunctions functions,
                                          Map<Class<?>, DefinitionAdapterBindings> bindings); }
BindableDefinitionAdapterImpl implements BindableDefinitionAdapter<T> { @Override @SuppressWarnings("all") public String[] getLabels(T pojo) { final String fName = bindings.get(pojo.getClass()).getLabelsField(); final Object labels = getFieldValue(pojo, fName); if (labels instanceof Collection) { Collection<String> labelsCollection = (Collection<String>) labels; return labelsCollection.toArray(new String[labelsCollection.size()]); } return null != labels ? (String[]) labels : new String[0]; } private  BindableDefinitionAdapterImpl(StunnerTranslationService translationService,
                                          BindableAdapterFunctions functions,
                                          Map<Class<?>, DefinitionAdapterBindings> bindings); static BindableDefinitionAdapterImpl<Object> create(StunnerTranslationService translationService,
                                                               BindableAdapterFunctions functions); static BindableDefinitionAdapterImpl<Object> create(StunnerTranslationService translationService,
                                                               BindableAdapterFunctions functions,
                                                               Map<Class<?>, DefinitionAdapterBindings> bindings); @Override void addBindings(Class<?> type, DefinitionAdapterBindings bindings); @Override DefinitionId getId(T pojo); @Override String getCategory(T pojo); @Override String getTitle(T pojo); @Override String getDescription(T pojo); @Override @SuppressWarnings("all") String[] getLabels(T pojo); @Override String[] getPropertyFields(T pojo); @Override Optional<?> getProperty(T pojo, String field); @Override String getMetaPropertyField(T pojo, PropertyMetaTypes type); @Override String getBaseType(Class<?> type); @Override String[] getTypes(String baseType); @Override Class<? extends ElementFactory> getGraphFactoryType(T pojo); @Override @SuppressWarnings("all") Class<? extends ElementFactory> getGraphFactory(Class<?> type); @Override boolean accepts(Class<?> type); @Override int getPriority(); }
BindableDefinitionAdapterImpl implements BindableDefinitionAdapter<T> { @Override @SuppressWarnings("all") public String[] getLabels(T pojo) { final String fName = bindings.get(pojo.getClass()).getLabelsField(); final Object labels = getFieldValue(pojo, fName); if (labels instanceof Collection) { Collection<String> labelsCollection = (Collection<String>) labels; return labelsCollection.toArray(new String[labelsCollection.size()]); } return null != labels ? (String[]) labels : new String[0]; } private  BindableDefinitionAdapterImpl(StunnerTranslationService translationService,
                                          BindableAdapterFunctions functions,
                                          Map<Class<?>, DefinitionAdapterBindings> bindings); static BindableDefinitionAdapterImpl<Object> create(StunnerTranslationService translationService,
                                                               BindableAdapterFunctions functions); static BindableDefinitionAdapterImpl<Object> create(StunnerTranslationService translationService,
                                                               BindableAdapterFunctions functions,
                                                               Map<Class<?>, DefinitionAdapterBindings> bindings); @Override void addBindings(Class<?> type, DefinitionAdapterBindings bindings); @Override DefinitionId getId(T pojo); @Override String getCategory(T pojo); @Override String getTitle(T pojo); @Override String getDescription(T pojo); @Override @SuppressWarnings("all") String[] getLabels(T pojo); @Override String[] getPropertyFields(T pojo); @Override Optional<?> getProperty(T pojo, String field); @Override String getMetaPropertyField(T pojo, PropertyMetaTypes type); @Override String getBaseType(Class<?> type); @Override String[] getTypes(String baseType); @Override Class<? extends ElementFactory> getGraphFactoryType(T pojo); @Override @SuppressWarnings("all") Class<? extends ElementFactory> getGraphFactory(Class<?> type); @Override boolean accepts(Class<?> type); @Override int getPriority();  }