mercredi 14 décembre 2016

Java reflection to get the members of an interface

I have an interface like below

package com.cisco.mood.processing.constants;

public interface IBConstants {

    String DROP_CSP_IB_C3 = "DROP TABLE IF EXISTS csp.CSP_IB_C3";
    String DROP_IB_C3_TEMP = "DROP TABLE IF EXISTS csp.ib_c3_temp";
    String DROP_IB_C3 = "DROP TABLE IF EXISTS csp.ib_c3";

    String CREATE_CSP_IB_C3 = "CREATE TABLE csp.CSP_IB_C3 AS select REGEXP_REPLACE(HDR.BILL_TO_CUSTOMER_NAME ,',',' ') AS BILL_TO_CUSTOMER_NAME,HDR.CONTRACT_NUMBER,HDR.SERVICE_LINE_ID,HDR.SERVICE_LINE_NAME,HDR.SERVICE_LINE_STATUS,HDR.SERVICE_LINE_STS_CODE AS STS_CODE,INST.INSTANCE_ID,INST.SERIAL_NUMBER,REGEXP_REPLACE(INST.ITEM_NAME,',',' ') AS ITEM_NAME,INST.QUANTITY,INST.INVENTORY_ITEM_ID,INST.WARRANTY_TYPE,INST.WARRANTY_END_DATE,INST.SHIP_DATE,INST.PARTY_SITE_ID,PRD.LAST_DOS ,PRD.IB_PRODUCT_TYPE,PRD.PRODUCT_FAMILY,PRD.ERP_ITEM_TYPE,PRD.SKU_LIST_PRICE,ACCOUNT.ACCOUNT from ${hive_db}.CURATED_INPUT ACCOUNT left join installbase.XXCCS_DS_SAHDR_CORE hdr on account.contract=hdr.CONTRACT_NUMBER left join installbase.XXCCS_DS_CVDPRDLINE_DETAIL cvd on hdr.SERVICE_LINE_ID=cvd.SERVICE_LINE_ID left join installbase.XXCCS_DS_INSTANCE_DETAIL inst on cvd.INSTANCE_ID=inst.INSTANCE_ID left join installbase.XXCCS_SCDC_PRODUCT_PROFILE prd on inst.INVENTORY_ITEM_ID=prd.item_id";
    String CREATE_IB_C3_TEMP = "CREATE TABLE csp.ib_c3_temp(bill_to_customer_name string,contract_number string,service_line_id bigint,service_line_name string,service_line_status string,sts_code string,instance_id bigint,serial_number string,item_name string,quantity bigint,inventory_item_id bigint,warranty_type string,warranty_end_date string,ship_date string,party_site_id bigint,last_dos string,ib_product_type string,product_family string,erp_item_type string,sku_list_price bigint,account string)";
    String INSERT_INTO_IB_C3_TEMP = "insert into table csp.ib_c3_temp select BILL_TO_CUSTOMER_NAME,CONTRACT_NUMBER,SERVICE_LINE_ID,SERVICE_LINE_NAME,SERVICE_LINE_STATUS,STS_CODE,INSTANCE_ID,SERIAL_NUMBER,ITEM_NAME,QUANTITY,INVENTORY_ITEM_ID,WARRANTY_TYPE,WARRANTY_END_DATE,SHIP_DATE,PARTY_SITE_ID,LAST_DOS,IB_PRODUCT_TYPE,PRODUCT_FAMILY,ERP_ITEM_TYPE,SKU_LIST_PRICE,ACCOUNT from csp.csp_ib_c3";
    String CREATE_IB_C3 = "create table csp.ib_c3 as select BILL_TO_CUSTOMER_NAME,CONTRACT_NUMBER,CASE WHEN length(SERVICE_LINE_ID)>0 THEN SERVICE_LINE_ID ELSE '' END as SERVICE_LINE_ID,SERVICE_LINE_NAME,SERVICE_LINE_STATUS,STS_CODE,CASE WHEN length(INSTANCE_ID)>0 THEN INSTANCE_ID ELSE '' END as INSTANCE_ID,SERIAL_NUMBER,ITEM_NAME,CASE WHEN length(QUANTITY)>0 THEN QUANTITY ELSE '' END as QUANTITY,CASE WHEN length(INVENTORY_ITEM_ID)>0 THEN INVENTORY_ITEM_ID ELSE '' END as INVENTORY_ITEM_ID,WARRANTY_TYPE,CASE WHEN length(WARRANTY_END_DATE)>0 THEN WARRANTY_END_DATE ELSE '' END as WARRANTY_END_DATE,CASE WHEN length(SHIP_DATE)>0 THEN SHIP_DATE ELSE '' END as SHIP_DATE,CASE WHEN length(PARTY_SITE_ID)>0 THEN PARTY_SITE_ID ELSE '' END as PARTY_SITE_ID,CASE WHEN length(LAST_DOS)>0 THEN LAST_DOS ELSE '' END as LAST_DOS,IB_PRODUCT_TYPE,PRODUCT_FAMILY,ERP_ITEM_TYPE,CASE WHEN length(SKU_LIST_PRICE)>0 THEN SKU_LIST_PRICE ELSE '' END as SKU_LIST_PRICE,ACCOUNT from csp.ib_c3_temp";

    String DROP_CSP_CONTRACTS = "DROP TABLE IF EXISTS csp.CSP_CONTRACTS";
    String DROP_CSP_CONTRACTS_TEMP = "DROP TABLE IF EXISTS csp.csp_contracts_temp";
    String DROP_CONTRACTS = "DROP TABLE IF EXISTS csp.contracts";

    String CREATE_CSP_CONTRACTS = "CREATE TABLE csp.CSP_CONTRACTS AS SELECT HDR.CONTRACT_NUMBER,HDR.CONTRACT_START_DATE AS Start_Date,HDR.CONTRACT_END_DATE AS Expiry_Date,HDR.SERVICE_LINE_NAME AS CONTRACT_TYPE,HDR.CONTRACT_STATUS,ACCOUNT.ACCOUNT FROM csp.CURATED_INPUT ACCOUNT INNER JOIN installbase.XXCCS_DS_SAHDR_CORE HDR ON ACCOUNT.CONTRACT=HDR.CONTRACT_NUMBER";
    String CREATE_CSP_CONTRACTS_TEMP = "CREATE TABLE csp.csp_contracts_temp(contract_number string,start_date string,expiry_date string,contract_type string,contract_status string,account string)";
    String INSERT_INTO_CSP_CONTRACTS_TEMP = "insert into table csp.csp_contracts_temp select Contract_Number,Start_Date,Expiry_Date,Contract_Type,Contract_Status,ACCOUNT from csp.CSP_CONTRACTS";
    String CREATE_CONTRACTS = "create table csp.contracts as select Contract_Number,CASE WHEN length(Start_Date)>0 THEN Start_Date ELSE '' END as Start_Date,CASE WHEN length(Expiry_Date)>0 THEN Expiry_Date ELSE '' END as Expiry_Date,Contract_Type,Contract_Status,ACCOUNT from csp.csp_contracts_temp";

}

Is it possible to get the strings of the interface as an array using the reflection api.





Aucun commentaire:

Enregistrer un commentaire