com.holonplatform.core.internal.Logger.warn()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(11.1k)|赞(0)|评价(0)|浏览(171)

本文整理了Java中com.holonplatform.core.internal.Logger.warn()方法的一些代码示例,展示了Logger.warn()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.warn()方法的具体详情如下:
包路径:com.holonplatform.core.internal.Logger
类名称:Logger
方法名:warn

Logger.warn介绍

[英]Log a Level#WARNING type message.
[中]记录级别#警告类型的消息。

代码示例

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin-flow

  1. @Override
  2. public Optional<PropertyBox> getItem(T value) {
  3. if (toItemConverter != null) {
  4. return toItemConverter.apply(value);
  5. }
  6. LOGGER.warn(
  7. "The value to PropertyBox item conversion logic was not configured, no item will never be returned");
  8. return Optional.empty();
  9. }

代码示例来源:origin: com.holon-platform.jaxrs/holon-jaxrs-swagger-core

  1. /**
  2. * Get the Class which corresponds to given type, if available.
  3. * @param type The type
  4. * @return Optional type class
  5. */
  6. public static Optional<Class<?>> getClassFromType(Type type) {
  7. if (type instanceof Class<?>) {
  8. return Optional.of((Class<?>) type);
  9. }
  10. try {
  11. return Optional.ofNullable(Class.forName(type.getTypeName()));
  12. } catch (Exception e) {
  13. LOGGER.warn("Failed to obtain a Class from Type name [" + type.getTypeName() + "]: " + e.getMessage());
  14. }
  15. return Optional.empty();
  16. }

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin

  1. @SuppressWarnings("unchecked")
  2. @Override
  3. protected <E extends HasValue<?> & Component> Optional<E> getDefaultPropertyEditor(Property property) {
  4. try {
  5. return property.renderIfAvailable(Field.class);
  6. } catch (Exception e) {
  7. if (isEditable()) {
  8. LOGGER.warn("No default property editor available for property [" + property + "]", e);
  9. }
  10. return Optional.empty();
  11. }
  12. }

代码示例来源:origin: com.holon-platform.jaxrs/holon-jaxrs-swagger-core

  1. /**
  2. * Try to obtain the generic type argument, if given class is a parametrized type.
  3. * @param cls The class
  4. * @return Optional generic type argument
  5. */
  6. public static Optional<Class<?>> getParametrizedType(Class<?> cls) {
  7. try {
  8. for (Type gt : cls.getGenericInterfaces()) {
  9. if (gt instanceof ParameterizedType) {
  10. final Type[] types = ((ParameterizedType) gt).getActualTypeArguments();
  11. if (types != null && types.length > 0) {
  12. return getClassFromType(types[0]);
  13. }
  14. }
  15. }
  16. if (cls.getGenericSuperclass() instanceof ParameterizedType) {
  17. final Type[] types = ((ParameterizedType) cls.getGenericSuperclass()).getActualTypeArguments();
  18. if (types != null && types.length > 0) {
  19. return getClassFromType(types[0]);
  20. }
  21. }
  22. } catch (Exception e) {
  23. e.printStackTrace();
  24. LOGGER.warn("Failed to detect parametrized type for class [" + cls + "]", e);
  25. }
  26. return Optional.empty();
  27. }

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin

  1. @SuppressWarnings("unchecked")
  2. @Override
  3. protected <E extends HasValue<?> & Component> Optional<E> getDefaultPropertyEditor(String property) {
  4. E field = null;
  5. try {
  6. field = (E) getBeanProperty(property).flatMap(p -> p.renderIfAvailable(Field.class)).orElse(null);
  7. } catch (Exception e) {
  8. if (isEditable()) {
  9. LOGGER.warn("No default property editor available for property [" + property + "]", e);
  10. }
  11. }
  12. if (field != null) {
  13. return Optional.of(field);
  14. }
  15. return super.getDefaultPropertyEditor(property);
  16. }

代码示例来源:origin: com.holon-platform.core/holon-core

  1. LOGGER.warn("Invalid commodity factory [" + f.getClass().getName() + "]: the commodity type "
  2. + "returned by getCommodityType() is null - skipping factory registration");

代码示例来源:origin: com.holon-platform.core/documentation-core

  1. public void missingLocalization() {
  2. // tag::missing[]
  3. LocalizationContext ctx = LocalizationContext.builder()
  4. .withMissingMessageLocalizationListener((locale, messageCode, defaultMessage) -> { // <1>
  5. LOGGER.warn("Missing message localization [" + messageCode + "] for locale [" + locale + "]");
  6. }).build();
  7. // end::missing[]
  8. }

代码示例来源:origin: com.holon-platform.jaxrs/holon-jaxrs-swagger-v2

  1. @Override
  2. public void decorateOperation(Operation operation, Method method, Iterator<SwaggerExtension> chain) {
  3. // check responses
  4. final Map<String, Response> responses = operation.getResponses();
  5. if (responses != null && !responses.isEmpty()) {
  6. // check type
  7. if (isPropertyBoxResponseType(method)) {
  8. // get the property set
  9. final PropertySet<?> propertySet = getResponsePropertySet(method)
  10. .map(ref -> PropertySetRefIntrospector.get().getPropertySet(ref)).orElse(null);
  11. if (propertySet != null) {
  12. final Optional<ApiPropertySetModel> apiModel = getResponsePropertySetModel(method);
  13. responses.values().forEach(response -> {
  14. if (response != null) {
  15. parseResponse(propertySet, apiModel, response);
  16. }
  17. });
  18. } else {
  19. LOGGER.warn("Failed to obtain a PropertySet to build the PropertyBox Schema for method ["
  20. + method.getName() + "] response in class [" + method.getDeclaringClass().getName()
  21. + "]. Please check the @PropertySetRef annotation.");
  22. }
  23. }
  24. }
  25. // default behaviour
  26. super.decorateOperation(operation, method, chain);
  27. }

代码示例来源:origin: com.holon-platform.mongo/holon-datastore-mongo-core

  1. /**
  2. * Get the Mongo driver version informations.
  3. * @param classLoader ClassLoader to use (not null)
  4. * @return Mongo driver version informations
  5. */
  6. public static MongoVersion getMongoVersion(ClassLoader classLoader) {
  7. ObjectUtils.argumentNotNull(classLoader, "ClassLoader must be not null");
  8. return MONGO_VERSIONS.computeIfAbsent(classLoader, cl -> {
  9. try {
  10. final Class<?> cls = ClassUtils.forName("com.mongodb.internal.build.MongoDriverVersion", cl);
  11. final Field fld = cls.getDeclaredField("VERSION");
  12. Object value = fld.get(null);
  13. if (value != null && value instanceof String) {
  14. return new DefaultMongoVersion(true, (String) value);
  15. }
  16. } catch (Exception e) {
  17. LOGGER.warn("Failed to detect Mongo driver version");
  18. LOGGER.debug(() -> "Failed to detect Mongo driver version using MongoDriverVersion class", e);
  19. }
  20. return new DefaultMongoVersion(false, null);
  21. });
  22. }

代码示例来源:origin: com.holon-platform.jaxrs/holon-jaxrs-swagger-v2

  1. private static Model getPropertyBoxModel(PropertySet<?> propertySet,
  2. Optional<ApiPropertySetModel> apiPropertySetModel) {
  3. final Function<Type, io.swagger.models.properties.Property> resolver = t -> io.swagger.converter.ModelConverters
  4. .getInstance().readAsProperty(t);
  5. final Model resolvedModel = SwaggerV2PropertyBoxModelConverter.buildPropertyBoxSchema(propertySet, resolver,
  6. true);
  7. // check API model
  8. return apiPropertySetModel.map(apiModel -> {
  9. final String name = apiModel.value().trim();
  10. if (!definePropertySetModel(resolvedModel, name, AnnotationUtils.getStringValue(apiModel.description()))) {
  11. LOGGER.warn("Failed to define PropertySet Model named [" + name
  12. + "]: no Swagger instance available from resolution context.");
  13. }
  14. return (Model) new RefModel(name);
  15. }).orElse(resolvedModel);
  16. }

代码示例来源:origin: com.holon-platform.jdbc/holon-jdbc-spring

  1. private void runSchemaScripts(DataSource dataSource) {
  2. List<Resource> scripts = getScripts(
  3. configuration.getConfigPropertyValue(SpringDataSourceConfigProperties.SCHEMA_SCRIPT, null), "schema");
  4. if (!scripts.isEmpty()) {
  5. runScripts(scripts, dataSource);
  6. try {
  7. this.applicationContext.publishEvent(new DataContextDataSourceInitializedEvent(dataSource,
  8. getDataContextId().orElse(DEFAULT_DATA_CONTEXT_ID)));
  9. // The listener might not be registered yet, so don't rely on it.
  10. if (!this.initialized) {
  11. runDataScripts(dataSource);
  12. this.initialized = true;
  13. }
  14. } catch (IllegalStateException ex) {
  15. LOGGER.warn("Could not send event to complete DataSource initialization (" + ex.getMessage() + ")");
  16. }
  17. }
  18. }

代码示例来源:origin: com.holon-platform.mongo/holon-datastore-mongo-sync

  1. LOGGER.warn("A thread bound transaction was already present [" + tx
  2. + "] - The current transaction will be finalized");
  3. try {
  4. endTransaction(tx);
  5. } catch (Exception e) {
  6. LOGGER.warn("Failed to force current transaction finalization", e);
  7. session.close();
  8. } catch (Exception re) {
  9. LOGGER.warn("Transaction failed to start but the transaction session cannot be closed", re);

代码示例来源:origin: com.holon-platform.mongo/holon-datastore-mongo-core

  1. @Override
  2. public String toJson(CodecRegistry codecRegistry, Document document) {
  3. if (document != null) {
  4. ObjectUtils.argumentNotNull(codecRegistry, "CodecRegistry must be not null");
  5. try {
  6. return document.toJson(JsonWriterSettings.builder().indent(true).build(),
  7. new DocumentCodec(codecRegistry));
  8. } catch (Exception e) {
  9. LOGGER.warn("Failed to serialize document to JSON", e);
  10. }
  11. }
  12. return null;
  13. }

代码示例来源:origin: com.holon-platform.mongo/holon-datastore-mongo-core

  1. @Override
  2. public String toJson(CodecRegistry codecRegistry, Bson bson) {
  3. if (bson != null) {
  4. ObjectUtils.argumentNotNull(codecRegistry, "CodecRegistry must be not null");
  5. try {
  6. BsonDocument bdoc = bson.toBsonDocument(Document.class, codecRegistry);
  7. if (bdoc != null) {
  8. return bdoc.toJson(JsonWriterSettings.builder().indent(true).build());
  9. }
  10. } catch (Exception e) {
  11. LOGGER.warn("Failed to serialize document to JSON", e);
  12. }
  13. }
  14. return null;
  15. }

代码示例来源:origin: com.holon-platform.vaadin7/holon-vaadin-navigator

  1. public void preAfterViewChange(ViewChangeEvent event) {
  2. // fire OnShow on new view
  3. if (event.getNewView() != null) {
  4. ViewConfiguration configuration = getViewConfiguration(event.getNewView().getClass());
  5. if (configuration != null) {
  6. ViewNavigationUtils.fireViewOnShow(event.getNewView(), configuration,
  7. DefaultViewNavigatorChangeEvent.create(event, navigator,
  8. getViewWindow(buildNavigationState(event.getViewName(), event.getParameters()))),
  9. false);
  10. } else {
  11. LOGGER.warn("Failed to obtain ViewConfiguration for view class " + event.getOldView().getClass()
  12. + ": OnShow methods firing skipped");
  13. }
  14. }
  15. }

代码示例来源:origin: com.holon-platform.jaxrs/holon-jaxrs-swagger-v2

  1. getCookies(headers), Collections.unmodifiableMap(headers.getRequestHeaders()));
  2. } catch (Exception e) {
  3. LOGGER.warn("Failed to load filter using class [" + config.getFilterClass() + "]", e);

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin-flow

  1. @Override
  2. public void validationStatusChange(final ValidationStatusEvent<S> statusChangeEvent) {
  3. if (statusChangeEvent.isInvalid()) {
  4. if (!statusChangeEvent.getSource().hasValidation().isPresent()) {
  5. if (fallback != null) {
  6. fallback.validationStatusChange(statusChangeEvent);
  7. } else {
  8. LOGGER.warn("Cannot notify validation error [" + statusChangeEvent.getErrorMessage()
  9. + "] on component [" + statusChangeEvent.getSource()
  10. + "]: the component does not implement com.vaadin.flow.component.HasValidation. "
  11. + "Provide a suitable ValidationStatusHandler to handle the validation error notification.");
  12. }
  13. } else {
  14. statusChangeEvent.getSource().hasValidation().ifPresent(v -> {
  15. v.setInvalid(true);
  16. v.setErrorMessage(statusChangeEvent.getErrorMessage());
  17. });
  18. }
  19. } else {
  20. statusChangeEvent.getSource().hasValidation().ifPresent(v -> {
  21. v.setInvalid(false);
  22. v.setErrorMessage(null);
  23. });
  24. }
  25. }

代码示例来源:origin: com.holon-platform.vaadin7/holon-vaadin-navigator

  1. DefaultViewNavigatorChangeEvent.create(event, navigator, null));
  2. } else {
  3. LOGGER.warn("Failed to obtain ViewConfiguration for view class " + event.getOldView().getClass()
  4. + ": OnLeave methods firing skipped");
  5. ViewNavigationUtils.setViewParameters(event.getNewView(), configuration, event.getParameters(), null);
  6. } else {
  7. LOGGER.warn("Failed to obtain ViewConfiguration for view class " + event.getNewView().getClass()
  8. + ": View parameters setting skipped");

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin-flow

  1. LOGGER.warn(
  2. "The UI reference is not available, the browser window width and height won't be detected and updated");

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin-flow

  1. LOGGER.warn("Property [" + configuration.getProperty() + "] is read-only, validators will be ignored");

相关文章