@Override protected NodeTuple representJavaBeanProperty(final Object javaBean, final Property property, final Object propertyValue, final Tag customTag) { NodeTuple tuple = super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); return isUnwantedNodeTuple(tuple.getValueNode()) ? null : tuple; }
Tag customPropertyTag = memberValue == null ? null : classTags.get(memberValue.getClass()); NodeTuple tuple = representJavaBeanProperty(javaBean, property, memberValue, customPropertyTag); if (tuple == null) {
protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) { if (property != null && property.getName().equals("pomFile")) { // "pomFile" is not a part of POM http://maven.apache.org/xsd/maven-4.0.0.xsd return null; } if (propertyValue == null) return null; if (propertyValue instanceof Map) { Map map = (Map) propertyValue; if (map.isEmpty()) return null; } if (propertyValue instanceof List) { List map = (List) propertyValue; if (map.isEmpty()) return null; } if (javaBean instanceof Dependency) { //skip optional if it is false if (skipBoolean(property, "optional", propertyValue, false)) return null; //skip type if it is jar if (skipString(property, "type", propertyValue, "jar")) return null; } if (javaBean instanceof Plugin) { //skip extensions if it is false if (skipBoolean(property, "extensions", propertyValue, false)) return null; //skip inherited if it is true if (skipBoolean(property, "inherited", propertyValue, true)) return null; } return super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); }
@Override protected NodeTuple representJavaBeanProperty( Object javaBean, Property property, Object propertyValue, Tag customTag) { // returning null for a null property value means we won't output it in the Yaml if (propertyValue == null) { return null; } return super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); } }
@Override protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) { if (propertyValue == null) { return null; } else { return super .representJavaBeanProperty(javaBean, property, propertyValue, customTag); } } }
@Override protected NodeTuple representJavaBeanProperty( Object javaBean, Property property, Object propertyValue, Tag customTag) { // returning null for a null property value means we won't output it in the Yaml if (propertyValue == null) { return null; } return super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); } }
@Override protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) { if (propertyValue == null) { return null; } return super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); }
@Override protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) { if (propertyValue == null) { return null; } return super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); }
/** * Prevents writing null values out to index.yaml, not a part of JodaTimeRepresenter necessarily * but included here as we are setting up a {@link Representer} */ @Override protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) { // if value of property is null, ignore it. if (propertyValue == null) { return null; } else { return super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); } }
returnValue = null; } else { returnValue = super.representJavaBeanProperty(bean, property, value, tag); returnValue = null; } else { returnValue = super.representJavaBeanProperty(bean, property, value, tag); returnValue = null; } else { returnValue = super.representJavaBeanProperty(bean, property, value, tag); returnValue = null; } else { returnValue = super.representJavaBeanProperty(bean, property, value, tag); returnValue = super.representJavaBeanProperty(bean, property, value, tag);
@Override protected NodeTuple representJavaBeanProperty(final Object javaBean, final Property property, final Object propertyValue, final Tag customTag) { NodeTuple tuple = super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); return isUnwantedNodeTuple(tuple.getValueNode()) ? null : tuple; }
@Override protected NodeTuple representJavaBeanProperty(Object bean, Property property, Object value, Tag customTag) { NodeTuple tuple = super.representJavaBeanProperty(bean, property, value, customTag); if (isNullValue(tuple) || isEmptySequence(tuple) || isEmptyMapping(tuple)) { return null; } return tuple; }
@Override protected NodeTuple representJavaBeanProperty(Object bean, Property property, Object value, Tag customTag) { NodeTuple tuple = super.representJavaBeanProperty(bean, property, value, customTag); if (isNullValue(tuple) || isEmptySequence(tuple) || isEmptyMapping(tuple)) { return null; } return tuple; }
@Override protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) { if (CommonUtil.isNullOrEmpty(propertyValue)) { return null; } Field field = getField(javaBean.getClass(), property.getName()); String nodeName = field.isAnnotationPresent(YamlElement.class) ? field.getAnnotation(YamlElement.class) .value() : property.getName(); if (field.isAnnotationPresent(YamlAdapter.class)) { return getAdaptedTuple(propertyValue, field, nodeName); } NodeTuple defaultNode = super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); return new NodeTuple(representData(nodeName), defaultNode.getValueNode()); }
protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) { if (property != null && property.getName().equals("pomFile")) { // "pomFile" is not a part of POM http://maven.apache.org/xsd/maven-4.0.0.xsd return null; } if (propertyValue == null) return null; if (propertyValue instanceof Map) { Map map = (Map) propertyValue; if (map.isEmpty()) return null; } if (propertyValue instanceof List) { List map = (List) propertyValue; if (map.isEmpty()) return null; } if (javaBean instanceof Dependency) { //skip optional if it is false if (skipBoolean(property, "optional", propertyValue, false)) return null; //skip type if it is jar if (skipString(property, "type", propertyValue, "jar")) return null; } if (javaBean instanceof Plugin) { //skip extensions if it is false if (skipBoolean(property, "extensions", propertyValue, false)) return null; //skip inherited if it is true if (skipBoolean(property, "inherited", propertyValue, true)) return null; } return super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); }
Tag customPropertyTag = memberValue == null ? null : classTags.get(memberValue .getClass()); NodeTuple tuple = representJavaBeanProperty(javaBean, property, memberValue, customPropertyTag); if (tuple == null) {
Tag customPropertyTag = memberValue == null ? null : classTags.get(memberValue.getClass()); NodeTuple tuple = representJavaBeanProperty(javaBean, property, memberValue, customPropertyTag); if (tuple == null) {
Tag customPropertyTag = memberValue == null ? null : classTags.get(memberValue .getClass()); NodeTuple tuple = representJavaBeanProperty(javaBean, property, memberValue, customPropertyTag); if (tuple == null) {
@Override protected NodeTuple representJavaBeanProperty( Object javaBean, Property property, Object propertyValue, Tag customTag) { NodeTuple nodeTuple = super.representJavaBeanProperty(javaBean, property, propertyValue, customTag); Node valueNode = nodeTuple.getValueNode(); if (Tag.NULL.equals(valueNode.getTag())) { return null; // skip 'null' values } if (valueNode instanceof CollectionNode) { if (Tag.SEQ.equals(valueNode.getTag())) { SequenceNode seq = (SequenceNode) valueNode; if (seq.getValue().isEmpty()) { return null; // skip empty lists } } if (Tag.MAP.equals(valueNode.getTag())) { MappingNode seq = (MappingNode) valueNode; if (seq.getValue().isEmpty()) { return null; // skip empty maps } } } Object name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_HYPHEN, property.getName()); return new NodeTuple(representData(name), valueNode); }
@Override protected NodeTuple representJavaBeanProperty(Object bean, Property property, Object value, Tag customTag) { NodeTuple tuple = super.representJavaBeanProperty(bean, property, value, customTag); if (isNullValue(tuple) || isEmptySequence(tuple) || isEmptyMapping(tuple)) { return null; } if ("body".equals(property.getName())) { ScalarNode n = (ScalarNode) tuple.getValueNode(); if (n.getStyle() == PLAIN.getChar()) { return tuple; } else { return new NodeTuple(tuple.getKeyNode(), new ScalarNode(n.getTag(), n.getValue(), n .getStartMark(), n.getEndMark(), LITERAL.getChar())); } } return tuple; }