@Test public void testIsDefault() { testIsDefault("object", true); testIsDefault("object2", false); }
public static boolean isDefault(final NacosProperties nacosProperties) { final List<Object> records = new LinkedList<Object>(); ReflectionUtils.doWithMethods(nacosProperties.annotationType(), new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { if (Modifier.isPublic(method.getModifiers()) && method.getParameterTypes().length == 0) { Object defaultValue = method.getDefaultValue(); if (defaultValue != null) { try { Object returnValue = method.invoke(nacosProperties); if (!defaultValue.equals(returnValue)) { records.add(returnValue); } } catch (Exception e) { } } } } }); return records.isEmpty(); }
NacosUtils { public static boolean isDefault(final NacosProperties nacosProperties) { final List<Object> records = new LinkedList<Object>(); ReflectionUtils.doWithMethods(nacosProperties.annotationType(), new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { if (Modifier.isPublic(method.getModifiers()) && method.getParameterTypes().length == 0) { Object defaultValue = method.getDefaultValue(); if (defaultValue != null) { try { Object returnValue = method.invoke(nacosProperties); if (!defaultValue.equals(returnValue)) { records.add(returnValue); } } catch (Exception e) { } } } } }); return records.isEmpty(); } }
NacosUtils { public static boolean isDefault(final NacosProperties nacosProperties) { final List<Object> records = new LinkedList<Object>(); ReflectionUtils.doWithMethods(nacosProperties.annotationType(), new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { if (Modifier.isPublic(method.getModifiers()) && method.getParameterTypes().length == 0) { Object defaultValue = method.getDefaultValue(); if (defaultValue != null) { try { Object returnValue = method.invoke(nacosProperties); if (!defaultValue.equals(returnValue)) { records.add(returnValue); } } catch (Exception e) { } } } } }); return records.isEmpty(); }  }
NacosUtils { public static boolean isDefault(final NacosProperties nacosProperties) { final List<Object> records = new LinkedList<Object>(); ReflectionUtils.doWithMethods(nacosProperties.annotationType(), new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { if (Modifier.isPublic(method.getModifiers()) && method.getParameterTypes().length == 0) { Object defaultValue = method.getDefaultValue(); if (defaultValue != null) { try { Object returnValue = method.invoke(nacosProperties); if (!defaultValue.equals(returnValue)) { records.add(returnValue); } } catch (Exception e) { } } } } }); return records.isEmpty(); }  static String buildDefaultPropertySourceName(String dataId, String groupId,
			Map<?, ?> properties); static String identify(NacosProperties nacosProperties); static String identify(Map<?, ?> properties); static boolean isDefault(final NacosProperties nacosProperties); static String readTypeFromDataId(String dataId); static String readFromEnvironment(String label, Environment environment); static PropertyValues resolvePropertyValues(Object bean, String content,
			String type); static PropertyValues resolvePropertyValues(Object bean, final String prefix,
			String dataId, String groupId, String content, String type); static Properties resolveProperties(NacosProperties nacosProperties,
			PropertyResolver propertyResolver); static Properties resolveProperties(NacosProperties nacosProperties,
			PropertyResolver propertyResolver, Properties defaultProperties); static Properties resolveProperties(Map<String, Object> attributes,
			PropertyResolver propertyResolver, Properties defaultProperties); static Properties resolveProperties(Map<?, ?> properties,
			PropertyResolver propertyResolver); static String getContent(ConfigService configService, String dataId,
			String groupId); static Class<T> resolveGenericType(Class<?> declaredClass); static Properties toProperties(String text); static Properties toProperties(String text, String type); static Properties toProperties(String dataId, String group, String text); static Properties toProperties(String dataId, String group, String text,
			String type); }
NacosUtils { public static boolean isDefault(final NacosProperties nacosProperties) { final List<Object> records = new LinkedList<Object>(); ReflectionUtils.doWithMethods(nacosProperties.annotationType(), new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException { if (Modifier.isPublic(method.getModifiers()) && method.getParameterTypes().length == 0) { Object defaultValue = method.getDefaultValue(); if (defaultValue != null) { try { Object returnValue = method.invoke(nacosProperties); if (!defaultValue.equals(returnValue)) { records.add(returnValue); } } catch (Exception e) { } } } } }); return records.isEmpty(); }  static String buildDefaultPropertySourceName(String dataId, String groupId,
			Map<?, ?> properties); static String identify(NacosProperties nacosProperties); static String identify(Map<?, ?> properties); static boolean isDefault(final NacosProperties nacosProperties); static String readTypeFromDataId(String dataId); static String readFromEnvironment(String label, Environment environment); static PropertyValues resolvePropertyValues(Object bean, String content,
			String type); static PropertyValues resolvePropertyValues(Object bean, final String prefix,
			String dataId, String groupId, String content, String type); static Properties resolveProperties(NacosProperties nacosProperties,
			PropertyResolver propertyResolver); static Properties resolveProperties(NacosProperties nacosProperties,
			PropertyResolver propertyResolver, Properties defaultProperties); static Properties resolveProperties(Map<String, Object> attributes,
			PropertyResolver propertyResolver, Properties defaultProperties); static Properties resolveProperties(Map<?, ?> properties,
			PropertyResolver propertyResolver); static String getContent(ConfigService configService, String dataId,
			String groupId); static Class<T> resolveGenericType(Class<?> declaredClass); static Properties toProperties(String text); static Properties toProperties(String text, String type); static Properties toProperties(String dataId, String group, String text); static Properties toProperties(String dataId, String group, String text,
			String type); static final String DEFAULT_STRING_ATTRIBUTE_VALUE; static final String DEFAULT_CONFIG_TYPE_VALUE; static final boolean DEFAULT_BOOLEAN_ATTRIBUTE_VALUE; static final String SEPARATOR; static final long DEFAULT_TIMEOUT; }