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

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

本文整理了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

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

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

/**
 * Get the Class which corresponds to given type, if available.
 * @param type The type
 * @return Optional type class
 */
public static Optional<Class<?>> getClassFromType(Type type) {
  if (type instanceof Class<?>) {
    return Optional.of((Class<?>) type);
  }
  try {
    return Optional.ofNullable(Class.forName(type.getTypeName()));
  } catch (Exception e) {
    LOGGER.warn("Failed to obtain a Class from Type name [" + type.getTypeName() + "]: " + e.getMessage());
  }
  return Optional.empty();
}

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

@SuppressWarnings("unchecked")
@Override
protected <E extends HasValue<?> & Component> Optional<E> getDefaultPropertyEditor(Property property) {
  try {
    return property.renderIfAvailable(Field.class);
  } catch (Exception e) {
    if (isEditable()) {
      LOGGER.warn("No default property editor available for property [" + property + "]", e);
    }
    return Optional.empty();
  }
}

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

/**
 * Try to obtain the generic type argument, if given class is a parametrized type.
 * @param cls The class
 * @return Optional generic type argument
 */
public static Optional<Class<?>> getParametrizedType(Class<?> cls) {
  try {
    for (Type gt : cls.getGenericInterfaces()) {
      if (gt instanceof ParameterizedType) {
        final Type[] types = ((ParameterizedType) gt).getActualTypeArguments();
        if (types != null && types.length > 0) {
          return getClassFromType(types[0]);
        }
      }
    }
    if (cls.getGenericSuperclass() instanceof ParameterizedType) {
      final Type[] types = ((ParameterizedType) cls.getGenericSuperclass()).getActualTypeArguments();
      if (types != null && types.length > 0) {
        return getClassFromType(types[0]);
      }
    }
  } catch (Exception e) {
    e.printStackTrace();
    LOGGER.warn("Failed to detect parametrized type for class [" + cls + "]", e);
  }
  return Optional.empty();
}

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

@SuppressWarnings("unchecked")
@Override
protected <E extends HasValue<?> & Component> Optional<E> getDefaultPropertyEditor(String property) {
  E field = null;
  try {
    field = (E) getBeanProperty(property).flatMap(p -> p.renderIfAvailable(Field.class)).orElse(null);
  } catch (Exception e) {
    if (isEditable()) {
      LOGGER.warn("No default property editor available for property [" + property + "]", e);
    }
  }
  if (field != null) {
    return Optional.of(field);
  }
  return super.getDefaultPropertyEditor(property);
}

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

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

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

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

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

@Override
public void decorateOperation(Operation operation, Method method, Iterator<SwaggerExtension> chain) {
  // check responses
  final Map<String, Response> responses = operation.getResponses();
  if (responses != null && !responses.isEmpty()) {
    // check type
    if (isPropertyBoxResponseType(method)) {
      // get the property set
      final PropertySet<?> propertySet = getResponsePropertySet(method)
          .map(ref -> PropertySetRefIntrospector.get().getPropertySet(ref)).orElse(null);
      if (propertySet != null) {
        final Optional<ApiPropertySetModel> apiModel = getResponsePropertySetModel(method);
        responses.values().forEach(response -> {
          if (response != null) {
            parseResponse(propertySet, apiModel, response);
          }
        });
      } else {
        LOGGER.warn("Failed to obtain a PropertySet to build the PropertyBox Schema for method ["
            + method.getName() + "] response in class [" + method.getDeclaringClass().getName()
            + "]. Please check the @PropertySetRef annotation.");
      }
    }
  }
  // default behaviour
  super.decorateOperation(operation, method, chain);
}

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

/**
 * Get the Mongo driver version informations.
 * @param classLoader ClassLoader to use (not null)
 * @return Mongo driver version informations
 */
public static MongoVersion getMongoVersion(ClassLoader classLoader) {
  ObjectUtils.argumentNotNull(classLoader, "ClassLoader must be not null");
  return MONGO_VERSIONS.computeIfAbsent(classLoader, cl -> {
    try {
      final Class<?> cls = ClassUtils.forName("com.mongodb.internal.build.MongoDriverVersion", cl);
      final Field fld = cls.getDeclaredField("VERSION");
      Object value = fld.get(null);
      if (value != null && value instanceof String) {
        return new DefaultMongoVersion(true, (String) value);
      }
    } catch (Exception e) {
      LOGGER.warn("Failed to detect Mongo driver version");
      LOGGER.debug(() -> "Failed to detect Mongo driver version using MongoDriverVersion class", e);
    }
    return new DefaultMongoVersion(false, null);
  });
}

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

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

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

private void runSchemaScripts(DataSource dataSource) {
  List<Resource> scripts = getScripts(
      configuration.getConfigPropertyValue(SpringDataSourceConfigProperties.SCHEMA_SCRIPT, null), "schema");
  if (!scripts.isEmpty()) {
    runScripts(scripts, dataSource);
    try {
      this.applicationContext.publishEvent(new DataContextDataSourceInitializedEvent(dataSource,
          getDataContextId().orElse(DEFAULT_DATA_CONTEXT_ID)));
      // The listener might not be registered yet, so don't rely on it.
      if (!this.initialized) {
        runDataScripts(dataSource);
        this.initialized = true;
      }
    } catch (IllegalStateException ex) {
      LOGGER.warn("Could not send event to complete DataSource initialization (" + ex.getMessage() + ")");
    }
  }
}

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

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

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

@Override
public String toJson(CodecRegistry codecRegistry, Document document) {
  if (document != null) {
    ObjectUtils.argumentNotNull(codecRegistry, "CodecRegistry must be not null");
    try {
      return document.toJson(JsonWriterSettings.builder().indent(true).build(),
          new DocumentCodec(codecRegistry));
    } catch (Exception e) {
      LOGGER.warn("Failed to serialize document to JSON", e);
    }
  }
  return null;
}

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

@Override
public String toJson(CodecRegistry codecRegistry, Bson bson) {
  if (bson != null) {
    ObjectUtils.argumentNotNull(codecRegistry, "CodecRegistry must be not null");
    try {
      BsonDocument bdoc = bson.toBsonDocument(Document.class, codecRegistry);
      if (bdoc != null) {
        return bdoc.toJson(JsonWriterSettings.builder().indent(true).build());
      }
    } catch (Exception e) {
      LOGGER.warn("Failed to serialize document to JSON", e);
    }
  }
  return null;
}

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

public void preAfterViewChange(ViewChangeEvent event) {
  // fire OnShow on new view
  if (event.getNewView() != null) {
    ViewConfiguration configuration = getViewConfiguration(event.getNewView().getClass());
    if (configuration != null) {
      ViewNavigationUtils.fireViewOnShow(event.getNewView(), configuration,
          DefaultViewNavigatorChangeEvent.create(event, navigator,
              getViewWindow(buildNavigationState(event.getViewName(), event.getParameters()))),
          false);
    } else {
      LOGGER.warn("Failed to obtain ViewConfiguration for view class " + event.getOldView().getClass()
          + ": OnShow methods firing skipped");
    }
  }
}

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

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

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

@Override
public void validationStatusChange(final ValidationStatusEvent<S> statusChangeEvent) {
  if (statusChangeEvent.isInvalid()) {
    if (!statusChangeEvent.getSource().hasValidation().isPresent()) {
      if (fallback != null) {
        fallback.validationStatusChange(statusChangeEvent);
      } else {
        LOGGER.warn("Cannot notify validation error [" + statusChangeEvent.getErrorMessage()
            + "] on component [" + statusChangeEvent.getSource()
            + "]: the component does not implement com.vaadin.flow.component.HasValidation. "
            + "Provide a suitable ValidationStatusHandler to handle the validation error notification.");
      }
    } else {
      statusChangeEvent.getSource().hasValidation().ifPresent(v -> {
        v.setInvalid(true);
        v.setErrorMessage(statusChangeEvent.getErrorMessage());
      });
    }
  } else {
    statusChangeEvent.getSource().hasValidation().ifPresent(v -> {
      v.setInvalid(false);
      v.setErrorMessage(null);
    });
  }
}

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

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

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

LOGGER.warn(
    "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

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

相关文章

微信公众号

最新文章

更多