Created
July 29, 2015 13:21
-
-
Save ariens/55f8830ec8144f6c6b25 to your computer and use it in GitHub Desktop.
An extension of com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2015 dariens. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, | |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
package com.blackberry.bdp.common.versioned; | |
import com.fasterxml.jackson.databind.introspect.AnnotatedMember; | |
import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
/** | |
* This class was an attempt at limiting attributes for serialization | |
* and de-serialization based on the VersionedAttribute annotation | |
* however when applied to an mapper the resulting serialized string | |
* is empty. | |
*/ | |
public class VersionedAnnotationIntrospector extends NopAnnotationIntrospector { | |
private static final Logger LOG = LoggerFactory.getLogger(VersionedAnnotationIntrospector.class); | |
@Override | |
public boolean hasIgnoreMarker(final AnnotatedMember m) { | |
if (m.hasAnnotation(VersionedAttribute.class)) { | |
LOG.info("member {} has anno", m); | |
return false; | |
} else { | |
LOG.info("member {} DOES NOT have anno", m); | |
return true; | |
} | |
} | |
/* | |
@Override | |
public Boolean hasRequiredMarker(AnnotatedMember m) { | |
if (m.hasAnnotation(VersionedAttribute.class)) { | |
LOG.info("member {} has anno", m); | |
return true; | |
} | |
return null; | |
} | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Legacy/Deprecated--concept was cool but I opted for mixin's