All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.nmorel.gwtjackson.rebind.bean.BeanInfo Maven / Gradle / Ivy

Go to download

gwt-jackson is a GWT JSON serializer/deserializer mechanism based on Jackson annotations

There is a newer version: 0.15.4
Show newest version
/*
 * Copyright 2013 Nicolas Morel
 *
 * 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.github.nmorel.gwtjackson.rebind.bean;

import java.util.List;
import java.util.Map;
import java.util.Set;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.github.nmorel.gwtjackson.rebind.property.PropertyInfo;
import com.google.gwt.core.ext.typeinfo.JAbstractMethod;
import com.google.gwt.core.ext.typeinfo.JClassType;
import com.google.gwt.core.ext.typeinfo.JParameter;
import com.google.gwt.thirdparty.guava.common.base.Optional;
import com.google.gwt.thirdparty.guava.common.collect.ImmutableList;
import com.google.gwt.thirdparty.guava.common.collect.ImmutableMap;
import com.google.gwt.thirdparty.guava.common.collect.ImmutableSet;

/**
 * @author Nicolas Morel
 */
public final class BeanInfo {

    private final JClassType type;

    private final ImmutableList parameterizedTypes;

    /*####  Instantiation properties  ####*/
    private final Optional creatorMethod;

    private final ImmutableMap creatorParameters;

    private final boolean creatorDefaultConstructor;

    private final boolean creatorDelegation;

    private final Optional typeInfo;

    private final Optional valuePropertyInfo;

    private final Optional anyGetterPropertyInfo;

    private final Optional anySetterPropertyInfo;

    /*####  Visibility properties  ####*/
    private final ImmutableSet ignoredFields;

    private final JsonAutoDetect.Visibility fieldVisibility;

    private final JsonAutoDetect.Visibility getterVisibility;

    private final JsonAutoDetect.Visibility isGetterVisibility;

    private final JsonAutoDetect.Visibility setterVisibility;

    private final JsonAutoDetect.Visibility creatorVisibility;

    private final boolean ignoreUnknown;

    /*####  Ordering properties  ####*/
    private final ImmutableList propertyOrderList;

    private final boolean propertyOrderAlphabetic;

    /*####  Identity info  ####*/
    private final Optional identityInfo;

    /*#### Inclusion info ####*/
    private final Optional include;

    BeanInfo( JClassType type, List parameterizedTypes, Optional creatorMethod, Map creatorParameters, boolean creatorDefaultConstructor, boolean creatorDelegation, Optional typeInfo, Optional valuePropertyInfo, Optional anyGetterPropertyInfo, Optional anySetterPropertyInfo, Set ignoredFields, Visibility fieldVisibility, Visibility getterVisibility, Visibility isGetterVisibility, Visibility setterVisibility, Visibility creatorVisibility, boolean ignoreUnknown, List propertyOrderList, boolean propertyOrderAlphabetic, Optional identityInfo, Optional include ) {

        this.type = type;
        this.parameterizedTypes = ImmutableList.copyOf( parameterizedTypes );
        this.creatorMethod = creatorMethod;
        this.creatorParameters = ImmutableMap.copyOf( creatorParameters );
        this.creatorDefaultConstructor = creatorDefaultConstructor;
        this.creatorDelegation = creatorDelegation;
        this.typeInfo = typeInfo;
        this.valuePropertyInfo = valuePropertyInfo;
        this.anyGetterPropertyInfo = anyGetterPropertyInfo;
        this.anySetterPropertyInfo = anySetterPropertyInfo;
        this.ignoredFields = ImmutableSet.copyOf( ignoredFields );

        this.fieldVisibility = fieldVisibility;
        this.getterVisibility = getterVisibility;
        this.isGetterVisibility = isGetterVisibility;
        this.setterVisibility = setterVisibility;
        this.creatorVisibility = creatorVisibility;

        this.ignoreUnknown = ignoreUnknown;
        this.propertyOrderList = ImmutableList.copyOf( propertyOrderList );
        this.propertyOrderAlphabetic = propertyOrderAlphabetic;
        this.identityInfo = identityInfo;
        this.include = include;
    }

    public JClassType getType() {
        return type;
    }

    public ImmutableList getParameterizedTypes() {
        return parameterizedTypes;
    }

    public Optional getCreatorMethod() {
        return creatorMethod;
    }

    public ImmutableMap getCreatorParameters() {
        return creatorParameters;
    }

    public boolean isCreatorDefaultConstructor() {
        return creatorDefaultConstructor;
    }

    public boolean isCreatorDelegation() {
        return creatorDelegation;
    }

    public Optional getTypeInfo() {
        return typeInfo;
    }

    public Optional getValuePropertyInfo() {
        return valuePropertyInfo;
    }

    public Optional getAnyGetterPropertyInfo() {
        return anyGetterPropertyInfo;
    }

    public Optional getAnySetterPropertyInfo() {
        return anySetterPropertyInfo;
    }

    public ImmutableSet getIgnoredFields() {
        return ignoredFields;
    }

    public Visibility getFieldVisibility() {
        return fieldVisibility;
    }

    public Visibility getGetterVisibility() {
        return getterVisibility;
    }

    public Visibility getIsGetterVisibility() {
        return isGetterVisibility;
    }

    public Visibility getSetterVisibility() {
        return setterVisibility;
    }

    public Visibility getCreatorVisibility() {
        return creatorVisibility;
    }

    public boolean isIgnoreUnknown() {
        return ignoreUnknown;
    }

    public ImmutableList getPropertyOrderList() {
        return propertyOrderList;
    }

    public boolean isPropertyOrderAlphabetic() {
        return propertyOrderAlphabetic;
    }

    public Optional getIdentityInfo() {
        return identityInfo;
    }

    public Optional getInclude() {
        return include;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy