不能用java对象消耗json

时间:2015-02-16 22:25:21

标签: java json gson

我在制作一个会消耗这个json的实体对象时遇到了麻烦...

{"AS400":{"lcpDBConfigs":{"PR":{"userNameAutoProvisionFlag":false,"userNameOverrideFlag":true,"urlSelection":{"isRestrictedToChoices":false,"choices":["jdbc:as400://<hostname>;databaseName=<dbName>"],"validationPattern":".*"}}}}}

我尝试了以下但我知道我要离开AS400 ..

有人请帮忙吗?我是java和ovjects消费json的新手......

public static class LcpDBConfig {
        private Boolean userNameAutoProvisionFlag;
        private Boolean userNameOverrideFlag;
        private Selection urlSelection;

        public LcpDBConfig(Boolean userNameAutoProvisionFlag, Boolean userNameOverrideFlag, Selection urlSelection){
            this.userNameAutoProvisionFlag = userNameAutoProvisionFlag;
            this.userNameOverrideFlag = userNameOverrideFlag;
            this.urlSelection = urlSelection;
        }

        public Boolean getUserNameAutoProvisionFlag() {
            return userNameAutoProvisionFlag;
        }

        public void setUserNameAutoProvisionFlag(Boolean userNameAutoProvisionFlag) {
            this.userNameAutoProvisionFlag = userNameAutoProvisionFlag;
        }

        public Boolean getUserNameOverrideFlag() {
            return userNameOverrideFlag;
        }

        public void setUserNameOverrideFlag(Boolean userNameOverrideFlag) {
            this.userNameOverrideFlag = userNameOverrideFlag;
        }

        public Selection getUrlSelection() {
            return urlSelection;
        }

        public void setUrlSelection(Selection urlSelection) {
            this.urlSelection = urlSelection;
        }

        public static class Selection {
            private Boolean isRestrictedToChoices;
            private List<String> choices;
            private String validationPattern;

            public Selection(Boolean isRestrictedToChoices, List<String> choices, String validationPattern){
                this.isRestrictedToChoices = isRestrictedToChoices;
                this.choices = choices;
                this.validationPattern = validationPattern;
            }

            public Boolean getIsRestrictedToChoices() {
                return isRestrictedToChoices;
            }

            public void setIsRestrictedToChoices(Boolean isRestrictedToChoices) {
                this.isRestrictedToChoices = isRestrictedToChoices;
            }

            public List<String> getChoices() {
                return choices;
            }

            public void setChoices(List<String> choices) {
                this.choices = choices;
            }

            public String getValidationPattern() {
                return validationPattern;
            }

            public void setValidationPattern(String validationPattern) {
                this.validationPattern = validationPattern;
            }


        }
    }

0 个答案:

没有答案