private ImmutableSet<ResultAttribute> initResultAttributesToWriteAsTags(List<String> resultTags) { ImmutableSet<ResultAttribute> result; if (resultTags == null) { result = ImmutableSet.copyOf(ResultAttributes.values()); } else { result = ResultAttributes.forNames(resultTags); } LOG.debug("Result Tags to write set to: {}", result); return result; }
/** * Get the {@link ResultAttributes} value for each attribute name. * * @return Set of {@link ResultAttribute} * @see #forName(String) */ public static ImmutableSet<ResultAttribute> forNames(@Nonnull Collection<String> attributeNames) { ImmutableSet.Builder<ResultAttribute> builder = ImmutableSet.<ResultAttribute>builder(); for (String attributeName : attributeNames) { builder.add(forName(attributeName)); } return builder.build(); }
/** * Get the {@link ResultAttributes} value from the attribute name * * @param attributeName <p>The attribute name for the {@link ResultAttribute} allowed values are:</p> * <ul> * <li>typeName</li> * <li>objDomain</li> * <li>className</li> * <li>attributeName</li> * </ul> * @return the {@link ResultAttribute} */ public static ResultAttribute forName(@Nonnull String attributeName) { if (attributeName.startsWith(TypeNameProperty.PREFIX)) { return new TypeNameProperty(attributeName.substring(TypeNameProperty.PREFIX.length())); } String[] split = StringUtils.splitByCharacterTypeCamelCase(attributeName); StringBuilder sb = new StringBuilder(split[0].toUpperCase()).append("_").append(split[1].toUpperCase()); return valueOf(sb.toString()); }
@JsonCreator public DefaultResultSerializer(@JsonProperty("typeNames") List<String> typeNames, @JsonProperty("booleanAsNumber") boolean booleanAsNumber, @JsonProperty("rootPrefix") String rootPrefix, @JsonProperty("tags") Map<String, String> tags, @JsonProperty("resultTags") List<String> resultTags ) { this.jsonFactory = new JsonFactory(); this.typeNames = typeNames == null ? ImmutableList.<String>of() : ImmutableList.copyOf(typeNames); this.booleanAsNumber = booleanAsNumber; this.rootPrefix = rootPrefix; this.tags = tags == null ? ImmutableMap.<String, String>of() : ImmutableMap.copyOf(tags); this.resultAttributesToWriteAsTags = resultTags == null ? ImmutableSet.<ResultAttribute>of() : ResultAttributes.forNames(resultTags); }
@JsonCreator public DefaultResultSerializer(@JsonProperty("typeNames") List<String> typeNames, @JsonProperty("booleanAsNumber") boolean booleanAsNumber, @JsonProperty("rootPrefix") String rootPrefix, @JsonProperty("tags") Map<String, String> tags, @JsonProperty("resultTags") List<String> resultTags ) { this.jsonFactory = new JsonFactory(); this.typeNames = typeNames == null ? ImmutableList.<String>of() : ImmutableList.copyOf(typeNames); this.booleanAsNumber = booleanAsNumber; this.rootPrefix = rootPrefix; this.tags = tags == null ? ImmutableMap.<String, String>of() : ImmutableMap.copyOf(tags); this.resultAttributesToWriteAsTags = resultTags == null ? ImmutableSet.<ResultAttribute>of() : ResultAttributes.forNames(resultTags); }
/** * Copied from InfluxDbWriterFactory * @param resultTags * @return */ private ImmutableSet<ResultAttribute> initResultAttributesToWriteAsTags(List<String> resultTags) { ImmutableSet<ResultAttribute> result; if (resultTags == null) { result = ImmutableSet.copyOf(ResultAttributes.values()); } else { result = ResultAttributes.forNames(resultTags); } LOG.debug("Result Tags to write set to: {}", result); return result; }
/** * Get the {@link ResultAttributes} value for each attribute name. * * @return Set of {@link ResultAttribute} * @see #forName(String) */ public static ImmutableSet<ResultAttribute> forNames(@Nonnull Collection<String> attributeNames) { ImmutableSet.Builder<ResultAttribute> builder = ImmutableSet.<ResultAttribute>builder(); for (String attributeName : attributeNames) { builder.add(forName(attributeName)); } return builder.build(); }
/** * Get the {@link ResultAttributes} value from the attribute name * * @param attributeName <p>The attribute name for the {@link ResultAttribute} allowed values are:</p> * <ul> * <li>typeName</li> * <li>objDomain</li> * <li>className</li> * <li>attributeName</li> * </ul> * @return the {@link ResultAttribute} */ public static ResultAttribute forName(@Nonnull String attributeName) { if (attributeName.startsWith(TypeNameProperty.PREFIX)) { return new TypeNameProperty(attributeName.substring(TypeNameProperty.PREFIX.length())); } String[] split = StringUtils.splitByCharacterTypeCamelCase(attributeName); StringBuilder sb = new StringBuilder(split[0].toUpperCase()).append("_").append(split[1].toUpperCase()); return valueOf(sb.toString()); }
private ImmutableSet<ResultAttribute> initResultAttributesToWriteAsTags(List<String> resultTags) { ImmutableSet<ResultAttribute> result; if (resultTags == null) { result = ImmutableSet.copyOf(ResultAttributes.values()); } else { result = ResultAttributes.forNames(resultTags); } LOG.debug("Result Tags to write set to: {}", result); return result; }
/** * Copied from InfluxDbWriterFactory * @param resultTags * @return */ private ImmutableSet<ResultAttribute> initResultAttributesToWriteAsTags(List<String> resultTags) { ImmutableSet<ResultAttribute> result; if (resultTags == null) { result = ImmutableSet.copyOf(ResultAttributes.values()); } else { result = ResultAttributes.forNames(resultTags); } LOG.debug("Result Tags to write set to: {}", result); return result; }