001/** 002 * Copyright (C) 2006-2021 Talend Inc. - www.talend.com 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.talend.sdk.component.api.service.schema; 017 018import java.util.ArrayList; 019import java.util.Collection; 020import java.util.List; 021import java.util.Map; 022 023import javax.json.bind.annotation.JsonbTransient; 024 025import org.talend.sdk.component.api.meta.Partial; 026 027import lombok.AllArgsConstructor; 028import lombok.Data; 029import lombok.NoArgsConstructor; 030 031@Partial("This API should support nested schema but the Studio is not yet ready.\n\n" 032 + "The cloud platform also doesn't use it yet.\n\nAlso prefer to use " 033 + "`org.talend.sdk.component.api.record.Schema` over this partial default implementation.") 034@Data 035@NoArgsConstructor 036@AllArgsConstructor 037@Deprecated // use SchemaBuilder instead of this implementation 038public class Schema implements org.talend.sdk.component.api.record.Schema { 039 040 private List<org.talend.sdk.component.api.record.Schema.Entry> entries; 041 042 // 1.0 compat 043 public Schema(final Collection<org.talend.sdk.component.api.record.Schema.Entry> entries) { 044 this.entries = new ArrayList<>(entries); 045 } 046 047 // 1.0 compat 048 public void setEntries(final Collection<org.talend.sdk.component.api.record.Schema.Entry> entries) { 049 this.entries = new ArrayList<>(entries); 050 } 051 052 @Override 053 public Type getType() { 054 return Type.RECORD; 055 } 056 057 @Override 058 public org.talend.sdk.component.api.record.Schema getElementSchema() { 059 return null; 060 } 061 062 @Override 063 public Map<String, String> getProps() { 064 return null; 065 } 066 067 @Override 068 public String getProp(final String property) { 069 return null; 070 } 071 072 @Data 073 @AllArgsConstructor 074 @NoArgsConstructor 075 @Deprecated 076 public static class Entry implements org.talend.sdk.component.api.record.Schema.Entry { 077 078 private String name; 079 080 private Schema.Type type; 081 082 // 1.0 compat 083 public Entry(final String name, final org.talend.sdk.component.api.service.schema.Type type) { 084 this.name = name; 085 this.type = org.talend.sdk.component.api.record.Schema.Type.valueOf(type.name()); 086 } 087 088 // 1.0 compat 089 public void setType(final org.talend.sdk.component.api.service.schema.Type type) { 090 this.type = org.talend.sdk.component.api.record.Schema.Type.valueOf(type.name()); 091 } 092 093 @Override 094 public String getRawName() { 095 return null; 096 } 097 098 @JsonbTransient 099 @Override 100 public String getOriginalFieldName() { 101 return null; 102 } 103 104 @Override 105 public boolean isNullable() { 106 return true; 107 } 108 109 @Override 110 public <T> T getDefaultValue() { 111 return null; 112 } 113 114 @Override 115 public org.talend.sdk.component.api.record.Schema getElementSchema() { 116 return null; 117 } 118 119 @Override 120 public String getComment() { 121 return null; 122 } 123 124 @Override 125 public Map<String, String> getProps() { 126 return null; 127 } 128 129 @Override 130 public String getProp(final String property) { 131 return null; 132 } 133 } 134}