repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
RestComm/camelgateway
core/domain/src/main/java/org/restcomm/camelgateway/NetworkRoutingRuleManagement.java
// Path: core/domain/src/main/java/org/restcomm/camelgateway/rules/NetworkRoutingRule.java // public class NetworkRoutingRule implements XMLSerializable { // private static final String NETWORK_ID = "networkid"; // private static final String RULE_URL = "ruleurl"; // // // networkId // private int networkId; // // // to be used with other protocols // private String ruleUrl; // // public NetworkRoutingRule() { // // } // // public NetworkRoutingRule(int networkId) { // this.networkId = networkId; // } // // public int getNetworkId() { // return networkId; // } // // public void setNetworkId(int networkId) { // this.networkId = networkId; // } // // public String getRuleUrl() { // return ruleUrl; // } // // public void setRuleUrl(String ruleUrl) { // this.ruleUrl = ruleUrl; // } // // @Override // public String toString() { // StringBuffer sb = new StringBuffer(); // this.show(sb); // return sb.toString(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + networkId; // result = prime * result + ((ruleUrl == null) ? 0 : ruleUrl.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // NetworkRoutingRule other = (NetworkRoutingRule) obj; // if (networkId != other.networkId) // return false; // if (ruleUrl == null) { // if (other.ruleUrl != null) // return false; // } else if (!ruleUrl.equals(other.ruleUrl)) // return false; // return true; // } // // /** // * XML Serialization/Deserialization // */ // protected static final XMLFormat<NetworkRoutingRule> ESME_XML = new XMLFormat<NetworkRoutingRule>( // NetworkRoutingRule.class) { // // @Override // public void read(javolution.xml.XMLFormat.InputElement xml, // NetworkRoutingRule esme) throws XMLStreamException { // esme.networkId = xml.getAttribute(NETWORK_ID, -1); // esme.ruleUrl = xml.getAttribute(RULE_URL, null); // } // // @Override // public void write(NetworkRoutingRule esme, // javolution.xml.XMLFormat.OutputElement xml) // throws XMLStreamException { // xml.setAttribute(NETWORK_ID, esme.networkId); // xml.setAttribute(RULE_URL, esme.ruleUrl); // } // }; // // public void show(StringBuffer sb) { // sb.append(CamelOAMMessages.SHOW_NETWORK_ID).append(this.networkId) // .append(CamelOAMMessages.SHOW_URL).append(this.ruleUrl); // sb.append(CamelOAMMessages.NEW_LINE); // } // // }
import javolution.xml.XMLObjectReader; import javolution.xml.XMLObjectWriter; import javolution.xml.stream.XMLStreamException; import org.apache.log4j.Logger; import org.restcomm.camelgateway.rules.NetworkRoutingRule; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.util.List; import javolution.text.TextBuilder; import javolution.util.FastList; import javolution.xml.XMLBinding;
/** * TeleStax, Open Source Cloud Communications Copyright 2012. * and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.restcomm.camelgateway; /** * @author amit bhayani * */ public class NetworkRoutingRuleManagement implements NetworkRoutingRuleManagementMBean { private static final Logger logger = Logger.getLogger(NetworkRoutingRuleManagement.class); private static final String SC_ROUTING_RULE_LIST = "networkroutingrulelist"; private static final String TAB_INDENT = "\t"; private static final String CLASS_ATTRIBUTE = "type"; private static final XMLBinding binding = new XMLBinding(); private static final String PERSIST_FILE_NAME = "networkroutingrule.xml"; private String name; private String persistDir = null;
// Path: core/domain/src/main/java/org/restcomm/camelgateway/rules/NetworkRoutingRule.java // public class NetworkRoutingRule implements XMLSerializable { // private static final String NETWORK_ID = "networkid"; // private static final String RULE_URL = "ruleurl"; // // // networkId // private int networkId; // // // to be used with other protocols // private String ruleUrl; // // public NetworkRoutingRule() { // // } // // public NetworkRoutingRule(int networkId) { // this.networkId = networkId; // } // // public int getNetworkId() { // return networkId; // } // // public void setNetworkId(int networkId) { // this.networkId = networkId; // } // // public String getRuleUrl() { // return ruleUrl; // } // // public void setRuleUrl(String ruleUrl) { // this.ruleUrl = ruleUrl; // } // // @Override // public String toString() { // StringBuffer sb = new StringBuffer(); // this.show(sb); // return sb.toString(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + networkId; // result = prime * result + ((ruleUrl == null) ? 0 : ruleUrl.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // NetworkRoutingRule other = (NetworkRoutingRule) obj; // if (networkId != other.networkId) // return false; // if (ruleUrl == null) { // if (other.ruleUrl != null) // return false; // } else if (!ruleUrl.equals(other.ruleUrl)) // return false; // return true; // } // // /** // * XML Serialization/Deserialization // */ // protected static final XMLFormat<NetworkRoutingRule> ESME_XML = new XMLFormat<NetworkRoutingRule>( // NetworkRoutingRule.class) { // // @Override // public void read(javolution.xml.XMLFormat.InputElement xml, // NetworkRoutingRule esme) throws XMLStreamException { // esme.networkId = xml.getAttribute(NETWORK_ID, -1); // esme.ruleUrl = xml.getAttribute(RULE_URL, null); // } // // @Override // public void write(NetworkRoutingRule esme, // javolution.xml.XMLFormat.OutputElement xml) // throws XMLStreamException { // xml.setAttribute(NETWORK_ID, esme.networkId); // xml.setAttribute(RULE_URL, esme.ruleUrl); // } // }; // // public void show(StringBuffer sb) { // sb.append(CamelOAMMessages.SHOW_NETWORK_ID).append(this.networkId) // .append(CamelOAMMessages.SHOW_URL).append(this.ruleUrl); // sb.append(CamelOAMMessages.NEW_LINE); // } // // } // Path: core/domain/src/main/java/org/restcomm/camelgateway/NetworkRoutingRuleManagement.java import javolution.xml.XMLObjectReader; import javolution.xml.XMLObjectWriter; import javolution.xml.stream.XMLStreamException; import org.apache.log4j.Logger; import org.restcomm.camelgateway.rules.NetworkRoutingRule; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.util.List; import javolution.text.TextBuilder; import javolution.util.FastList; import javolution.xml.XMLBinding; /** * TeleStax, Open Source Cloud Communications Copyright 2012. * and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.restcomm.camelgateway; /** * @author amit bhayani * */ public class NetworkRoutingRuleManagement implements NetworkRoutingRuleManagementMBean { private static final Logger logger = Logger.getLogger(NetworkRoutingRuleManagement.class); private static final String SC_ROUTING_RULE_LIST = "networkroutingrulelist"; private static final String TAB_INDENT = "\t"; private static final String CLASS_ATTRIBUTE = "type"; private static final XMLBinding binding = new XMLBinding(); private static final String PERSIST_FILE_NAME = "networkroutingrule.xml"; private String name; private String persistDir = null;
protected FastList<NetworkRoutingRule> scRoutingRuleList = new FastList<NetworkRoutingRule>();
RestComm/camelgateway
core/domain/src/main/java/org/restcomm/camelgateway/rules/NetworkRoutingRule.java
// Path: core/domain/src/main/java/org/restcomm/camelgateway/CamelOAMMessages.java // public interface CamelOAMMessages { // // /** // * Generic constants // */ // public static final String TAB = " "; // // public static final String SPACE = " "; // // public static final String NEW_LINE = "\n"; // // public static final String COMMA = ","; // // // public static final String CREATE_NETWORK_RULE_FAIL_ALREADY_EXIST = "Creation of network routing rule failed. Rule already exist"; // // public static final String NULL_RULE_TYPE = "Rule type cannot be null"; // // public static final String DELETE_RULE_FAILED_NO_RULE_FOUND = "No network routing rule found for %d"; // // public static final String INVALID_ROUTING_RULE_URL = "Invalid routing rule URL"; // // public static final String CREATE_NETWORK_RULE_SUCCESSFULL = "Successfully created routing rule for network id=%d"; // // public static final String DELETE_NETWORK_RULE_SUCCESSFUL = "Successfully deleted routing rule for network id=%d"; // // public static final String NO_NETWORK_RULE_DEFINED_YET = "No network routing rule defined yet"; // // public static final String INVALID_COMMAND = "Invalid Command"; // // public static final String PARAMETER_SUCCESSFULLY_SET = "Parameter has been successfully set"; // // // public static final String SHOW_NETWORK_ID = "Network id="; // // public static final String SHOW_URL = " URL="; // // public static final String SHOW_EXACT_MATCH = " Exact Match="; // // }
import javolution.xml.XMLSerializable; import javolution.xml.stream.XMLStreamException; import org.restcomm.camelgateway.CamelOAMMessages; import javolution.xml.XMLFormat;
if (other.ruleUrl != null) return false; } else if (!ruleUrl.equals(other.ruleUrl)) return false; return true; } /** * XML Serialization/Deserialization */ protected static final XMLFormat<NetworkRoutingRule> ESME_XML = new XMLFormat<NetworkRoutingRule>( NetworkRoutingRule.class) { @Override public void read(javolution.xml.XMLFormat.InputElement xml, NetworkRoutingRule esme) throws XMLStreamException { esme.networkId = xml.getAttribute(NETWORK_ID, -1); esme.ruleUrl = xml.getAttribute(RULE_URL, null); } @Override public void write(NetworkRoutingRule esme, javolution.xml.XMLFormat.OutputElement xml) throws XMLStreamException { xml.setAttribute(NETWORK_ID, esme.networkId); xml.setAttribute(RULE_URL, esme.ruleUrl); } }; public void show(StringBuffer sb) {
// Path: core/domain/src/main/java/org/restcomm/camelgateway/CamelOAMMessages.java // public interface CamelOAMMessages { // // /** // * Generic constants // */ // public static final String TAB = " "; // // public static final String SPACE = " "; // // public static final String NEW_LINE = "\n"; // // public static final String COMMA = ","; // // // public static final String CREATE_NETWORK_RULE_FAIL_ALREADY_EXIST = "Creation of network routing rule failed. Rule already exist"; // // public static final String NULL_RULE_TYPE = "Rule type cannot be null"; // // public static final String DELETE_RULE_FAILED_NO_RULE_FOUND = "No network routing rule found for %d"; // // public static final String INVALID_ROUTING_RULE_URL = "Invalid routing rule URL"; // // public static final String CREATE_NETWORK_RULE_SUCCESSFULL = "Successfully created routing rule for network id=%d"; // // public static final String DELETE_NETWORK_RULE_SUCCESSFUL = "Successfully deleted routing rule for network id=%d"; // // public static final String NO_NETWORK_RULE_DEFINED_YET = "No network routing rule defined yet"; // // public static final String INVALID_COMMAND = "Invalid Command"; // // public static final String PARAMETER_SUCCESSFULLY_SET = "Parameter has been successfully set"; // // // public static final String SHOW_NETWORK_ID = "Network id="; // // public static final String SHOW_URL = " URL="; // // public static final String SHOW_EXACT_MATCH = " Exact Match="; // // } // Path: core/domain/src/main/java/org/restcomm/camelgateway/rules/NetworkRoutingRule.java import javolution.xml.XMLSerializable; import javolution.xml.stream.XMLStreamException; import org.restcomm.camelgateway.CamelOAMMessages; import javolution.xml.XMLFormat; if (other.ruleUrl != null) return false; } else if (!ruleUrl.equals(other.ruleUrl)) return false; return true; } /** * XML Serialization/Deserialization */ protected static final XMLFormat<NetworkRoutingRule> ESME_XML = new XMLFormat<NetworkRoutingRule>( NetworkRoutingRule.class) { @Override public void read(javolution.xml.XMLFormat.InputElement xml, NetworkRoutingRule esme) throws XMLStreamException { esme.networkId = xml.getAttribute(NETWORK_ID, -1); esme.ruleUrl = xml.getAttribute(RULE_URL, null); } @Override public void write(NetworkRoutingRule esme, javolution.xml.XMLFormat.OutputElement xml) throws XMLStreamException { xml.setAttribute(NETWORK_ID, esme.networkId); xml.setAttribute(RULE_URL, esme.ruleUrl); } }; public void show(StringBuffer sb) {
sb.append(CamelOAMMessages.SHOW_NETWORK_ID).append(this.networkId)
RestComm/camelgateway
core/domain/src/main/java/org/restcomm/camelgateway/CamelShellExecutor.java
// Path: core/domain/src/main/java/org/restcomm/camelgateway/rules/NetworkRoutingRule.java // public class NetworkRoutingRule implements XMLSerializable { // private static final String NETWORK_ID = "networkid"; // private static final String RULE_URL = "ruleurl"; // // // networkId // private int networkId; // // // to be used with other protocols // private String ruleUrl; // // public NetworkRoutingRule() { // // } // // public NetworkRoutingRule(int networkId) { // this.networkId = networkId; // } // // public int getNetworkId() { // return networkId; // } // // public void setNetworkId(int networkId) { // this.networkId = networkId; // } // // public String getRuleUrl() { // return ruleUrl; // } // // public void setRuleUrl(String ruleUrl) { // this.ruleUrl = ruleUrl; // } // // @Override // public String toString() { // StringBuffer sb = new StringBuffer(); // this.show(sb); // return sb.toString(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + networkId; // result = prime * result + ((ruleUrl == null) ? 0 : ruleUrl.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // NetworkRoutingRule other = (NetworkRoutingRule) obj; // if (networkId != other.networkId) // return false; // if (ruleUrl == null) { // if (other.ruleUrl != null) // return false; // } else if (!ruleUrl.equals(other.ruleUrl)) // return false; // return true; // } // // /** // * XML Serialization/Deserialization // */ // protected static final XMLFormat<NetworkRoutingRule> ESME_XML = new XMLFormat<NetworkRoutingRule>( // NetworkRoutingRule.class) { // // @Override // public void read(javolution.xml.XMLFormat.InputElement xml, // NetworkRoutingRule esme) throws XMLStreamException { // esme.networkId = xml.getAttribute(NETWORK_ID, -1); // esme.ruleUrl = xml.getAttribute(RULE_URL, null); // } // // @Override // public void write(NetworkRoutingRule esme, // javolution.xml.XMLFormat.OutputElement xml) // throws XMLStreamException { // xml.setAttribute(NETWORK_ID, esme.networkId); // xml.setAttribute(RULE_URL, esme.ruleUrl); // } // }; // // public void show(StringBuffer sb) { // sb.append(CamelOAMMessages.SHOW_NETWORK_ID).append(this.networkId) // .append(CamelOAMMessages.SHOW_URL).append(this.ruleUrl); // sb.append(CamelOAMMessages.NEW_LINE); // } // // }
import java.util.Arrays; import java.util.List; import org.apache.log4j.Logger; import org.restcomm.camelgateway.rules.NetworkRoutingRule; import org.mobicents.ss7.management.console.ShellExecutor;
networkRoutingRuleManagement.createNetworkRoutingRule(networkId, url); return String.format(CamelOAMMessages.CREATE_NETWORK_RULE_SUCCESSFULL, networkId); } /** * Command is camel networkrule delete <network-id> * * @param commands * @return * @throws Exception */ private String deleteNetworkRule(String[] commands) throws Exception { if (commands.length != 4) { return CamelOAMMessages.INVALID_COMMAND; } int shortCode = Integer.parseInt(commands[3]); networkRoutingRuleManagement.deleteNetworkRoutingRule(shortCode); return String.format(CamelOAMMessages.DELETE_NETWORK_RULE_SUCCESSFUL, shortCode); } /** * Command is ussd scrule show * * @return */ private String showScRule() {
// Path: core/domain/src/main/java/org/restcomm/camelgateway/rules/NetworkRoutingRule.java // public class NetworkRoutingRule implements XMLSerializable { // private static final String NETWORK_ID = "networkid"; // private static final String RULE_URL = "ruleurl"; // // // networkId // private int networkId; // // // to be used with other protocols // private String ruleUrl; // // public NetworkRoutingRule() { // // } // // public NetworkRoutingRule(int networkId) { // this.networkId = networkId; // } // // public int getNetworkId() { // return networkId; // } // // public void setNetworkId(int networkId) { // this.networkId = networkId; // } // // public String getRuleUrl() { // return ruleUrl; // } // // public void setRuleUrl(String ruleUrl) { // this.ruleUrl = ruleUrl; // } // // @Override // public String toString() { // StringBuffer sb = new StringBuffer(); // this.show(sb); // return sb.toString(); // } // // @Override // public int hashCode() { // final int prime = 31; // int result = 1; // result = prime * result + networkId; // result = prime * result + ((ruleUrl == null) ? 0 : ruleUrl.hashCode()); // return result; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) // return true; // if (obj == null) // return false; // if (getClass() != obj.getClass()) // return false; // NetworkRoutingRule other = (NetworkRoutingRule) obj; // if (networkId != other.networkId) // return false; // if (ruleUrl == null) { // if (other.ruleUrl != null) // return false; // } else if (!ruleUrl.equals(other.ruleUrl)) // return false; // return true; // } // // /** // * XML Serialization/Deserialization // */ // protected static final XMLFormat<NetworkRoutingRule> ESME_XML = new XMLFormat<NetworkRoutingRule>( // NetworkRoutingRule.class) { // // @Override // public void read(javolution.xml.XMLFormat.InputElement xml, // NetworkRoutingRule esme) throws XMLStreamException { // esme.networkId = xml.getAttribute(NETWORK_ID, -1); // esme.ruleUrl = xml.getAttribute(RULE_URL, null); // } // // @Override // public void write(NetworkRoutingRule esme, // javolution.xml.XMLFormat.OutputElement xml) // throws XMLStreamException { // xml.setAttribute(NETWORK_ID, esme.networkId); // xml.setAttribute(RULE_URL, esme.ruleUrl); // } // }; // // public void show(StringBuffer sb) { // sb.append(CamelOAMMessages.SHOW_NETWORK_ID).append(this.networkId) // .append(CamelOAMMessages.SHOW_URL).append(this.ruleUrl); // sb.append(CamelOAMMessages.NEW_LINE); // } // // } // Path: core/domain/src/main/java/org/restcomm/camelgateway/CamelShellExecutor.java import java.util.Arrays; import java.util.List; import org.apache.log4j.Logger; import org.restcomm.camelgateway.rules.NetworkRoutingRule; import org.mobicents.ss7.management.console.ShellExecutor; networkRoutingRuleManagement.createNetworkRoutingRule(networkId, url); return String.format(CamelOAMMessages.CREATE_NETWORK_RULE_SUCCESSFULL, networkId); } /** * Command is camel networkrule delete <network-id> * * @param commands * @return * @throws Exception */ private String deleteNetworkRule(String[] commands) throws Exception { if (commands.length != 4) { return CamelOAMMessages.INVALID_COMMAND; } int shortCode = Integer.parseInt(commands[3]); networkRoutingRuleManagement.deleteNetworkRoutingRule(shortCode); return String.format(CamelOAMMessages.DELETE_NETWORK_RULE_SUCCESSFUL, shortCode); } /** * Command is ussd scrule show * * @return */ private String showScRule() {
List<NetworkRoutingRule> esmes = this.networkRoutingRuleManagement.getNetworkRoutingRuleList();
hanxi/lua_run
app/src/main/java/org/openfiledialog/FileDialog.java
// Path: app/src/main/java/com/hanxi/luarun/SdcardHelper.java // public class SdcardHelper { // private static String SDCARD_DIR; // private static String NOSDCARD_DIR; // // static public void setDir(String packageName) { // SDCARD_DIR = Environment.getExternalStorageDirectory().toString()+"/.luaRun"; // NOSDCARD_DIR = Environment.getDataDirectory().toString()+packageName+"/.luaRun"; // if (SdcardHelper.isHasSdcard()) { // File destDir = new File(SDCARD_DIR); // if (!destDir.exists()) { // destDir.mkdirs(); // } // } // else { // File destDir = new File(NOSDCARD_DIR); // if (!destDir.exists()) { // destDir.mkdirs(); // } // } // } // // static public boolean isHasSdcard() { // String status = Environment.getExternalStorageState(); // if (status.equals(Environment.MEDIA_MOUNTED)) { // return true; // } else { // return false; // } // } // // static public String getWriteDir() { // if (SdcardHelper.isHasSdcard()) { // return SDCARD_DIR; // } else { // return NOSDCARD_DIR; // } // } // // static public String getFileDirPath(String path) { // int last = path.lastIndexOf('/'); // String fileName = path.substring(0,last); // return fileName; // } // // static public String getFileNameFromPath(String path) { // int last = path.lastIndexOf('/'); // String fileName = path.substring(last+1,path.length()); // return fileName; // } // // static public boolean writeStringToFile(String fileName, String str) { // try { // File file = new File(fileName); // FileOutputStream out; // out = new FileOutputStream(file); // out.write(str.getBytes()); // out.close(); // } catch (FileNotFoundException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // return false; // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // return false; // } // return true; // } // // static public StringBuffer getFileToString(String path) { // StringBuffer strb = new StringBuffer(); // FileInputStream in = null; // File file = new File(path); // try { // in = new FileInputStream(file); // int len; // byte[] buf = new byte[4096]; // while( (len = in.read(buf))>0 ){ // strb.append(new String(buf, 0, len)); // } // } catch (IOException e1) { // // TODO Auto-generated catch block // e1.printStackTrace(); // } finally { // try { // in.close(); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // } // return strb; // } // }
import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import com.hanxi.luarun.R; import com.hanxi.luarun.SdcardHelper; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.Toast; import android.widget.AdapterView.OnItemClickListener;
suffix, images, path); fileListView.setTag("SaveDialogListView"); fileListView.refreshFileList(); openLayout.addView(fileListView); builder.setView(saveDialogLayout); final Dialog dialog = builder.create(); // dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setTitle(title); // 保存按钮事件 Button saveBtn = (Button) saveDialogLayout.findViewById(R.id.saveBtn); saveBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Context mc = view.getContext(); try { // TODO : save EditText editText = (EditText) saveDialogLayout .findViewById(R.id.saveFileNameEdit); String fileName = editText.getText().toString(); int end = fileName.length(); if (end <= 4) { fileName += ".lua"; } else if (!fileName.substring(end - 4, end).equals(".lua")) { fileName += ".lua"; } FileSelectView fileListView = (FileSelectView) saveDialogLayout .findViewWithTag("SaveDialogListView"); String path = fileListView.getCurPath(); fileName = path + "/" + fileName; // System.out.println("filename="+fileName);
// Path: app/src/main/java/com/hanxi/luarun/SdcardHelper.java // public class SdcardHelper { // private static String SDCARD_DIR; // private static String NOSDCARD_DIR; // // static public void setDir(String packageName) { // SDCARD_DIR = Environment.getExternalStorageDirectory().toString()+"/.luaRun"; // NOSDCARD_DIR = Environment.getDataDirectory().toString()+packageName+"/.luaRun"; // if (SdcardHelper.isHasSdcard()) { // File destDir = new File(SDCARD_DIR); // if (!destDir.exists()) { // destDir.mkdirs(); // } // } // else { // File destDir = new File(NOSDCARD_DIR); // if (!destDir.exists()) { // destDir.mkdirs(); // } // } // } // // static public boolean isHasSdcard() { // String status = Environment.getExternalStorageState(); // if (status.equals(Environment.MEDIA_MOUNTED)) { // return true; // } else { // return false; // } // } // // static public String getWriteDir() { // if (SdcardHelper.isHasSdcard()) { // return SDCARD_DIR; // } else { // return NOSDCARD_DIR; // } // } // // static public String getFileDirPath(String path) { // int last = path.lastIndexOf('/'); // String fileName = path.substring(0,last); // return fileName; // } // // static public String getFileNameFromPath(String path) { // int last = path.lastIndexOf('/'); // String fileName = path.substring(last+1,path.length()); // return fileName; // } // // static public boolean writeStringToFile(String fileName, String str) { // try { // File file = new File(fileName); // FileOutputStream out; // out = new FileOutputStream(file); // out.write(str.getBytes()); // out.close(); // } catch (FileNotFoundException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // return false; // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // return false; // } // return true; // } // // static public StringBuffer getFileToString(String path) { // StringBuffer strb = new StringBuffer(); // FileInputStream in = null; // File file = new File(path); // try { // in = new FileInputStream(file); // int len; // byte[] buf = new byte[4096]; // while( (len = in.read(buf))>0 ){ // strb.append(new String(buf, 0, len)); // } // } catch (IOException e1) { // // TODO Auto-generated catch block // e1.printStackTrace(); // } finally { // try { // in.close(); // } catch (IOException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // } // return strb; // } // } // Path: app/src/main/java/org/openfiledialog/FileDialog.java import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import com.hanxi.luarun.R; import com.hanxi.luarun.SdcardHelper; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.Toast; import android.widget.AdapterView.OnItemClickListener; suffix, images, path); fileListView.setTag("SaveDialogListView"); fileListView.refreshFileList(); openLayout.addView(fileListView); builder.setView(saveDialogLayout); final Dialog dialog = builder.create(); // dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setTitle(title); // 保存按钮事件 Button saveBtn = (Button) saveDialogLayout.findViewById(R.id.saveBtn); saveBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Context mc = view.getContext(); try { // TODO : save EditText editText = (EditText) saveDialogLayout .findViewById(R.id.saveFileNameEdit); String fileName = editText.getText().toString(); int end = fileName.length(); if (end <= 4) { fileName += ".lua"; } else if (!fileName.substring(end - 4, end).equals(".lua")) { fileName += ".lua"; } FileSelectView fileListView = (FileSelectView) saveDialogLayout .findViewWithTag("SaveDialogListView"); String path = fileListView.getCurPath(); fileName = path + "/" + fileName; // System.out.println("filename="+fileName);
if (SdcardHelper.writeStringToFile(fileName, content)) {
hgwood/fanfaron
src/test/java/com/github/hgwood/fanfaron/StructuralEqualityTest.java
// Path: src/main/java/com/github/hgwood/fanfaron/utils/vendorextensions/VendorExtensions.java // public class VendorExtensions extends DynamicObject<Object> { // // @Override public Object put(String key, Object value) { // if (isVendorExtension(key)) return super.put(key, value); // else throw new IllegalArgumentException(format("Unrecognized field '%s' (%s)", key, getClass())); // } // // public static boolean isVendorExtension(String key) { // return key.startsWith("x-"); // } // // }
import com.github.hgwood.fanfaron.utils.vendorextensions.VendorExtensions; import org.junit.Test; import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import static java.lang.String.format; import static java.util.Collections.emptyList; import static org.junit.Assert.assertNotEquals;
typeOfValues = ((ParameterizedType)typeOfValues).getActualTypeArguments()[0]; } return (Class<?>)typeOfValues; } private <T> Collection<Class<?>> nestedTypes(Class<T> type) throws Exception { if (Map.class.isAssignableFrom(type)) { return Collections.<Class<?>>singletonList(typeOfValues(type)); } Collection<Class<?>> nestedTypes = new ArrayList<>(); for (Field field : type.getFields()) { assertIsInEqual(type, field); if (List.class.isAssignableFrom(field.getType())) { nestedTypes.add((Class<?>)((ParameterizedType)field.getGenericType()).getActualTypeArguments()[0]); } else { nestedTypes.add(field.getType()); } } return nestedTypes; } private <T> void assertIsInEqual(Class<T> _class, Field field) throws Exception { T reference = _class.newInstance(); T mutated = _class.newInstance(); if (field.getType() == List.class) field.set(mutated, emptyList()); else if (field.getType() == boolean.class) field.set(mutated, true); else if (field.getType() == Boolean.class) field.set(mutated, true); else if (field.getType() == BigInteger.class) field.set(mutated, BigInteger.ONE); else if (field.getType() == BigDecimal.class) field.set(mutated, BigDecimal.ONE); else if (field.getName().equals("vendorExtensions")) {
// Path: src/main/java/com/github/hgwood/fanfaron/utils/vendorextensions/VendorExtensions.java // public class VendorExtensions extends DynamicObject<Object> { // // @Override public Object put(String key, Object value) { // if (isVendorExtension(key)) return super.put(key, value); // else throw new IllegalArgumentException(format("Unrecognized field '%s' (%s)", key, getClass())); // } // // public static boolean isVendorExtension(String key) { // return key.startsWith("x-"); // } // // } // Path: src/test/java/com/github/hgwood/fanfaron/StructuralEqualityTest.java import com.github.hgwood.fanfaron.utils.vendorextensions.VendorExtensions; import org.junit.Test; import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import static java.lang.String.format; import static java.util.Collections.emptyList; import static org.junit.Assert.assertNotEquals; typeOfValues = ((ParameterizedType)typeOfValues).getActualTypeArguments()[0]; } return (Class<?>)typeOfValues; } private <T> Collection<Class<?>> nestedTypes(Class<T> type) throws Exception { if (Map.class.isAssignableFrom(type)) { return Collections.<Class<?>>singletonList(typeOfValues(type)); } Collection<Class<?>> nestedTypes = new ArrayList<>(); for (Field field : type.getFields()) { assertIsInEqual(type, field); if (List.class.isAssignableFrom(field.getType())) { nestedTypes.add((Class<?>)((ParameterizedType)field.getGenericType()).getActualTypeArguments()[0]); } else { nestedTypes.add(field.getType()); } } return nestedTypes; } private <T> void assertIsInEqual(Class<T> _class, Field field) throws Exception { T reference = _class.newInstance(); T mutated = _class.newInstance(); if (field.getType() == List.class) field.set(mutated, emptyList()); else if (field.getType() == boolean.class) field.set(mutated, true); else if (field.getType() == Boolean.class) field.set(mutated, true); else if (field.getType() == BigInteger.class) field.set(mutated, BigInteger.ONE); else if (field.getType() == BigDecimal.class) field.set(mutated, BigDecimal.ONE); else if (field.getName().equals("vendorExtensions")) {
VendorExtensions mutatedVendorExtensions = new VendorExtensions();
hgwood/fanfaron
src/test/java/com/github/hgwood/fanfaron/VendorExtensionsTest.java
// Path: src/main/java/com/github/hgwood/fanfaron/utils/vendorextensions/DynamicObjectWithVendorExtensions.java // public class DynamicObjectWithVendorExtensions<T> extends DynamicObject<T> { // @JsonIgnore public VendorExtensions vendorExtensions = new VendorExtensions(); // // @JsonCreator public DynamicObjectWithVendorExtensions(Map<String, ?> properties) { // for (Map.Entry<String, ?> property : properties.entrySet()) { // if (VendorExtensions.isVendorExtension(property.getKey())) vendorExtensions.put(property.getKey(), property.getValue()); // else super.put(property.getKey(), (T)property.getValue()); // } // } // // public DynamicObjectWithVendorExtensions() { // this(new HashMap<String, Object>()); // } // } // // Path: src/main/java/com/github/hgwood/fanfaron/utils/vendorextensions/WithVendorExtensions.java // public class WithVendorExtensions { // @JsonIgnore public VendorExtensions vendorExtensions = new VendorExtensions(); // // @JsonAnySetter private void addVendorExtension(String key, Object value) { // vendorExtensions.put(key, value); // } // // @JsonAnyGetter private Map<String, Object> getVendorExtensions() { // return vendorExtensions; // } // }
import com.github.hgwood.fanfaron.utils.vendorextensions.DynamicObjectWithVendorExtensions; import com.github.hgwood.fanfaron.utils.vendorextensions.WithVendorExtensions; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import java.util.List; import static java.util.Arrays.asList; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue;
package com.github.hgwood.fanfaron; @RunWith(Parameterized.class) public class VendorExtensionsTest { @Parameterized.Parameter public Class<?> classSupportingVendorExtensions; @Parameters(name = "{0}") public static List<Object[]> classes_which_support_vendor_extensions() { return asList(new Object[][] { {Contact.class}, {ExternalDocumentation.class}, {Info.class}, {Items.class}, {License.class}, {Operation.class}, {Parameter.class}, {PathItem.class}, {Paths.class}, {Response.class}, {Responses.class}, {Scopes.class}, {SecurityScheme.class}, {Swagger.class}, {Tag.class}, {Xml.class} }); } @Test public void supports_vendor_extensions() { Object instance = TestUtils.deserialize(getClass(), "vendorExtensions.json", classSupportingVendorExtensions);
// Path: src/main/java/com/github/hgwood/fanfaron/utils/vendorextensions/DynamicObjectWithVendorExtensions.java // public class DynamicObjectWithVendorExtensions<T> extends DynamicObject<T> { // @JsonIgnore public VendorExtensions vendorExtensions = new VendorExtensions(); // // @JsonCreator public DynamicObjectWithVendorExtensions(Map<String, ?> properties) { // for (Map.Entry<String, ?> property : properties.entrySet()) { // if (VendorExtensions.isVendorExtension(property.getKey())) vendorExtensions.put(property.getKey(), property.getValue()); // else super.put(property.getKey(), (T)property.getValue()); // } // } // // public DynamicObjectWithVendorExtensions() { // this(new HashMap<String, Object>()); // } // } // // Path: src/main/java/com/github/hgwood/fanfaron/utils/vendorextensions/WithVendorExtensions.java // public class WithVendorExtensions { // @JsonIgnore public VendorExtensions vendorExtensions = new VendorExtensions(); // // @JsonAnySetter private void addVendorExtension(String key, Object value) { // vendorExtensions.put(key, value); // } // // @JsonAnyGetter private Map<String, Object> getVendorExtensions() { // return vendorExtensions; // } // } // Path: src/test/java/com/github/hgwood/fanfaron/VendorExtensionsTest.java import com.github.hgwood.fanfaron.utils.vendorextensions.DynamicObjectWithVendorExtensions; import com.github.hgwood.fanfaron.utils.vendorextensions.WithVendorExtensions; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import java.util.List; import static java.util.Arrays.asList; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; package com.github.hgwood.fanfaron; @RunWith(Parameterized.class) public class VendorExtensionsTest { @Parameterized.Parameter public Class<?> classSupportingVendorExtensions; @Parameters(name = "{0}") public static List<Object[]> classes_which_support_vendor_extensions() { return asList(new Object[][] { {Contact.class}, {ExternalDocumentation.class}, {Info.class}, {Items.class}, {License.class}, {Operation.class}, {Parameter.class}, {PathItem.class}, {Paths.class}, {Response.class}, {Responses.class}, {Scopes.class}, {SecurityScheme.class}, {Swagger.class}, {Tag.class}, {Xml.class} }); } @Test public void supports_vendor_extensions() { Object instance = TestUtils.deserialize(getClass(), "vendorExtensions.json", classSupportingVendorExtensions);
if (instance instanceof WithVendorExtensions) {
hgwood/fanfaron
src/test/java/com/github/hgwood/fanfaron/VendorExtensionsTest.java
// Path: src/main/java/com/github/hgwood/fanfaron/utils/vendorextensions/DynamicObjectWithVendorExtensions.java // public class DynamicObjectWithVendorExtensions<T> extends DynamicObject<T> { // @JsonIgnore public VendorExtensions vendorExtensions = new VendorExtensions(); // // @JsonCreator public DynamicObjectWithVendorExtensions(Map<String, ?> properties) { // for (Map.Entry<String, ?> property : properties.entrySet()) { // if (VendorExtensions.isVendorExtension(property.getKey())) vendorExtensions.put(property.getKey(), property.getValue()); // else super.put(property.getKey(), (T)property.getValue()); // } // } // // public DynamicObjectWithVendorExtensions() { // this(new HashMap<String, Object>()); // } // } // // Path: src/main/java/com/github/hgwood/fanfaron/utils/vendorextensions/WithVendorExtensions.java // public class WithVendorExtensions { // @JsonIgnore public VendorExtensions vendorExtensions = new VendorExtensions(); // // @JsonAnySetter private void addVendorExtension(String key, Object value) { // vendorExtensions.put(key, value); // } // // @JsonAnyGetter private Map<String, Object> getVendorExtensions() { // return vendorExtensions; // } // }
import com.github.hgwood.fanfaron.utils.vendorextensions.DynamicObjectWithVendorExtensions; import com.github.hgwood.fanfaron.utils.vendorextensions.WithVendorExtensions; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import java.util.List; import static java.util.Arrays.asList; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue;
package com.github.hgwood.fanfaron; @RunWith(Parameterized.class) public class VendorExtensionsTest { @Parameterized.Parameter public Class<?> classSupportingVendorExtensions; @Parameters(name = "{0}") public static List<Object[]> classes_which_support_vendor_extensions() { return asList(new Object[][] { {Contact.class}, {ExternalDocumentation.class}, {Info.class}, {Items.class}, {License.class}, {Operation.class}, {Parameter.class}, {PathItem.class}, {Paths.class}, {Response.class}, {Responses.class}, {Scopes.class}, {SecurityScheme.class}, {Swagger.class}, {Tag.class}, {Xml.class} }); } @Test public void supports_vendor_extensions() { Object instance = TestUtils.deserialize(getClass(), "vendorExtensions.json", classSupportingVendorExtensions); if (instance instanceof WithVendorExtensions) { assertEquals("extension", ((WithVendorExtensions)instance).vendorExtensions.get("x-extension"));
// Path: src/main/java/com/github/hgwood/fanfaron/utils/vendorextensions/DynamicObjectWithVendorExtensions.java // public class DynamicObjectWithVendorExtensions<T> extends DynamicObject<T> { // @JsonIgnore public VendorExtensions vendorExtensions = new VendorExtensions(); // // @JsonCreator public DynamicObjectWithVendorExtensions(Map<String, ?> properties) { // for (Map.Entry<String, ?> property : properties.entrySet()) { // if (VendorExtensions.isVendorExtension(property.getKey())) vendorExtensions.put(property.getKey(), property.getValue()); // else super.put(property.getKey(), (T)property.getValue()); // } // } // // public DynamicObjectWithVendorExtensions() { // this(new HashMap<String, Object>()); // } // } // // Path: src/main/java/com/github/hgwood/fanfaron/utils/vendorextensions/WithVendorExtensions.java // public class WithVendorExtensions { // @JsonIgnore public VendorExtensions vendorExtensions = new VendorExtensions(); // // @JsonAnySetter private void addVendorExtension(String key, Object value) { // vendorExtensions.put(key, value); // } // // @JsonAnyGetter private Map<String, Object> getVendorExtensions() { // return vendorExtensions; // } // } // Path: src/test/java/com/github/hgwood/fanfaron/VendorExtensionsTest.java import com.github.hgwood.fanfaron.utils.vendorextensions.DynamicObjectWithVendorExtensions; import com.github.hgwood.fanfaron.utils.vendorextensions.WithVendorExtensions; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import java.util.List; import static java.util.Arrays.asList; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; package com.github.hgwood.fanfaron; @RunWith(Parameterized.class) public class VendorExtensionsTest { @Parameterized.Parameter public Class<?> classSupportingVendorExtensions; @Parameters(name = "{0}") public static List<Object[]> classes_which_support_vendor_extensions() { return asList(new Object[][] { {Contact.class}, {ExternalDocumentation.class}, {Info.class}, {Items.class}, {License.class}, {Operation.class}, {Parameter.class}, {PathItem.class}, {Paths.class}, {Response.class}, {Responses.class}, {Scopes.class}, {SecurityScheme.class}, {Swagger.class}, {Tag.class}, {Xml.class} }); } @Test public void supports_vendor_extensions() { Object instance = TestUtils.deserialize(getClass(), "vendorExtensions.json", classSupportingVendorExtensions); if (instance instanceof WithVendorExtensions) { assertEquals("extension", ((WithVendorExtensions)instance).vendorExtensions.get("x-extension"));
} else if (instance instanceof DynamicObjectWithVendorExtensions) {
hgwood/fanfaron
src/test/java/com/github/hgwood/fanfaron/ArrayItemsTest.java
// Path: src/test/java/com/github/hgwood/fanfaron/TestUtils.java // public static <T> T deserialize(Class<?> parentOfResource, String resourcePath, Class<T> targetClass) { // URL resourceUrl = parentOfResource.getResource(resourcePath); // requireNonNull(resourceUrl, format("resource '%s' of class '%s' not found", resourcePath, parentOfResource.getCanonicalName())); // try { // return objectMapper.readValue(resourceUrl, targetClass); // } catch (IOException e) { // throw new RuntimeException(e); // } // }
import org.junit.Test; import static com.github.hgwood.fanfaron.TestUtils.deserialize; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull;
package com.github.hgwood.fanfaron; public class ArrayItemsTest { @Test public void items_accepts_an_array_value() {
// Path: src/test/java/com/github/hgwood/fanfaron/TestUtils.java // public static <T> T deserialize(Class<?> parentOfResource, String resourcePath, Class<T> targetClass) { // URL resourceUrl = parentOfResource.getResource(resourcePath); // requireNonNull(resourceUrl, format("resource '%s' of class '%s' not found", resourcePath, parentOfResource.getCanonicalName())); // try { // return objectMapper.readValue(resourceUrl, targetClass); // } catch (IOException e) { // throw new RuntimeException(e); // } // } // Path: src/test/java/com/github/hgwood/fanfaron/ArrayItemsTest.java import org.junit.Test; import static com.github.hgwood.fanfaron.TestUtils.deserialize; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; package com.github.hgwood.fanfaron; public class ArrayItemsTest { @Test public void items_accepts_an_array_value() {
Schema schema = deserialize(getClass(), "arrayItems.json", Schema.class);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java // public interface ObjectResource { // // public Object getCanonicalObject(); // // public void setCanonicalObject(Object obj); // // public URI getURI(); // // public void setURI(URI uri); // // public ObjectResourceDefinition getResourceDefinition(); // // public void setResourceDefinition(ObjectResourceDefinition definition); // // }
import java.net.URI; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.ObjectResource;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ObjectResourceImpl implements ObjectResource { private Object canonicalObject;
// Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java // public interface ObjectResource { // // public Object getCanonicalObject(); // // public void setCanonicalObject(Object obj); // // public URI getURI(); // // public void setURI(URI uri); // // public ObjectResourceDefinition getResourceDefinition(); // // public void setResourceDefinition(ObjectResourceDefinition definition); // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceImpl.java import java.net.URI; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.ObjectResource; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ObjectResourceImpl implements ObjectResource { private Object canonicalObject;
private ObjectResourceDefinition definition;
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ReferenceEmbedImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ReferenceEmbed.java // public interface ReferenceEmbed extends RDMReferenceProperty { // // /** // * Returns the resource data model for the embedded data type. // * // * @return // */ // public ResourceDataModel getEmbeddedModel(); // // public void setEmbeddedDataModel(ResourceDataModel rdm); // // public ReferenceEmbed withEmbeddedDataModel(ResourceDataModel rdm); // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // }
import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.resource.ReferenceEmbed; import com.modelsolv.kaboom.model.resource.ResourceDataModel;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ReferenceEmbedImpl extends RDMReferencePropertyImpl implements ReferenceEmbed {
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ReferenceEmbed.java // public interface ReferenceEmbed extends RDMReferenceProperty { // // /** // * Returns the resource data model for the embedded data type. // * // * @return // */ // public ResourceDataModel getEmbeddedModel(); // // public void setEmbeddedDataModel(ResourceDataModel rdm); // // public ReferenceEmbed withEmbeddedDataModel(ResourceDataModel rdm); // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ReferenceEmbedImpl.java import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.resource.ReferenceEmbed; import com.modelsolv.kaboom.model.resource.ResourceDataModel; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ReferenceEmbedImpl extends RDMReferencePropertyImpl implements ReferenceEmbed {
private ResourceDataModel targetRDM;
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ReferenceEmbedImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ReferenceEmbed.java // public interface ReferenceEmbed extends RDMReferenceProperty { // // /** // * Returns the resource data model for the embedded data type. // * // * @return // */ // public ResourceDataModel getEmbeddedModel(); // // public void setEmbeddedDataModel(ResourceDataModel rdm); // // public ReferenceEmbed withEmbeddedDataModel(ResourceDataModel rdm); // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // }
import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.resource.ReferenceEmbed; import com.modelsolv.kaboom.model.resource.ResourceDataModel;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ReferenceEmbedImpl extends RDMReferencePropertyImpl implements ReferenceEmbed { private ResourceDataModel targetRDM;
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ReferenceEmbed.java // public interface ReferenceEmbed extends RDMReferenceProperty { // // /** // * Returns the resource data model for the embedded data type. // * // * @return // */ // public ResourceDataModel getEmbeddedModel(); // // public void setEmbeddedDataModel(ResourceDataModel rdm); // // public ReferenceEmbed withEmbeddedDataModel(ResourceDataModel rdm); // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ReferenceEmbedImpl.java import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.resource.ReferenceEmbed; import com.modelsolv.kaboom.model.resource.ResourceDataModel; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ReferenceEmbedImpl extends RDMReferencePropertyImpl implements ReferenceEmbed { private ResourceDataModel targetRDM;
public ReferenceEmbedImpl(CDMReferenceProperty cdmProperty) {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // }
import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.object.CanonicalObjectReader;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; /** * A ResourceDefinition that is bound to a ResourceDataModel. An * ObjectResourceDefinition defines a class of Resource instances that are bound * to an Object confirming to the ResourceDataModel, presumably by conforming to * the underlying canonical data type definition. * * @author Ted * */ public interface ObjectResourceDefinition extends ResourceDefinition { // write-once properties, should be passed in ctor public String getURITemplate(); /** * @return the ResourceDataModel bound to this class of resources. */ public ResourceDataModel getResourceDataModel(); // read-writable properties public String getName(); public void setName(String name); public ObjectResourceDefinition withName(String name);
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.object.CanonicalObjectReader; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; /** * A ResourceDefinition that is bound to a ResourceDataModel. An * ObjectResourceDefinition defines a class of Resource instances that are bound * to an Object confirming to the ResourceDataModel, presumably by conforming to * the underlying canonical data type definition. * * @author Ted * */ public interface ObjectResourceDefinition extends ResourceDefinition { // write-once properties, should be passed in ctor public String getURITemplate(); /** * @return the ResourceDataModel bound to this class of resources. */ public ResourceDataModel getResourceDataModel(); // read-writable properties public String getName(); public void setName(String name); public ObjectResourceDefinition withName(String name);
public void bindTemplateParameter(String parameter, CDMProperty property);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // }
import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.object.CanonicalObjectReader;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; /** * A ResourceDefinition that is bound to a ResourceDataModel. An * ObjectResourceDefinition defines a class of Resource instances that are bound * to an Object confirming to the ResourceDataModel, presumably by conforming to * the underlying canonical data type definition. * * @author Ted * */ public interface ObjectResourceDefinition extends ResourceDefinition { // write-once properties, should be passed in ctor public String getURITemplate(); /** * @return the ResourceDataModel bound to this class of resources. */ public ResourceDataModel getResourceDataModel(); // read-writable properties public String getName(); public void setName(String name); public ObjectResourceDefinition withName(String name); public void bindTemplateParameter(String parameter, CDMProperty property); public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); /** * Factory method to create or retrieve an individual Resource bound to the * canonicalObject. The canonicalObject must confirm to the * ResourceDataModel. This method is responsible for populating the resource * URI and any other required properties of the Resource. * * @param canonicalObject * @return */
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.object.CanonicalObjectReader; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; /** * A ResourceDefinition that is bound to a ResourceDataModel. An * ObjectResourceDefinition defines a class of Resource instances that are bound * to an Object confirming to the ResourceDataModel, presumably by conforming to * the underlying canonical data type definition. * * @author Ted * */ public interface ObjectResourceDefinition extends ResourceDefinition { // write-once properties, should be passed in ctor public String getURITemplate(); /** * @return the ResourceDataModel bound to this class of resources. */ public ResourceDataModel getResourceDataModel(); // read-writable properties public String getName(); public void setName(String name); public ObjectResourceDefinition withName(String name); public void bindTemplateParameter(String parameter, CDMProperty property); public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); /** * Factory method to create or retrieve an individual Resource bound to the * canonicalObject. The canonicalObject must confirm to the * ResourceDataModel. This method is responsible for populating the resource * URI and any other required properties of the Resource. * * @param canonicalObject * @return */
public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/RDMPrimitiveProperty.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/ReadableCDMPrimitiveProperty.java // public interface ReadableCDMPrimitiveProperty extends ReadableCDMProperty { // // public PrimitiveDataType getType(); // // // }
import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.ReadableCDMPrimitiveProperty;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface RDMPrimitiveProperty extends RDMProperty, ReadableCDMPrimitiveProperty { @Override
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/ReadableCDMPrimitiveProperty.java // public interface ReadableCDMPrimitiveProperty extends ReadableCDMProperty { // // public PrimitiveDataType getType(); // // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMPrimitiveProperty.java import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.ReadableCDMPrimitiveProperty; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface RDMPrimitiveProperty extends RDMProperty, ReadableCDMPrimitiveProperty { @Override
public CDMPrimitiveProperty getCDMProperty();
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CDMPropertyImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // }
import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.Cardinality;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public abstract class CDMPropertyImpl implements CDMProperty { private String name;
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // Path: src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CDMPropertyImpl.java import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.Cardinality; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public abstract class CDMPropertyImpl implements CDMProperty { private String name;
private Cardinality cardinality = Cardinality.ONE;
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CDMReferencePropertyImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // }
import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class CDMReferencePropertyImpl extends CDMPropertyImpl implements CDMReferenceProperty {
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // Path: src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CDMReferencePropertyImpl.java import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class CDMReferencePropertyImpl extends CDMPropertyImpl implements CDMReferenceProperty {
private CanonicalDataType type;
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CDMReferencePropertyImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // }
import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class CDMReferencePropertyImpl extends CDMPropertyImpl implements CDMReferenceProperty { private CanonicalDataType type; private CDMReferenceProperty inverse; public CDMReferencePropertyImpl(String name, CanonicalDataType type) { super(name); setTargetDataType(type); } public CDMReferencePropertyImpl(String name, CanonicalDataType type,
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // Path: src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CDMReferencePropertyImpl.java import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class CDMReferencePropertyImpl extends CDMPropertyImpl implements CDMReferenceProperty { private CanonicalDataType type; private CDMReferenceProperty inverse; public CDMReferencePropertyImpl(String name, CanonicalDataType type) { super(name); setTargetDataType(type); } public CDMReferencePropertyImpl(String name, CanonicalDataType type,
Cardinality cardinality) {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinitionRegistry.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionRegistryImpl.java // public class ObjectResourceDefinitionRegistryImpl implements // ObjectResourceDefinitionRegistry { // // private Map<String, ObjectResourceDefinition> nameMap = new HashMap<String, ObjectResourceDefinition>(); // private Map<CanonicalDataType, ObjectResourceDefinition> cdtMap = new HashMap<CanonicalDataType, ObjectResourceDefinition>(); // private Map<ResourceDataModel, ObjectResourceDefinition> rdmMap = new HashMap<ResourceDataModel, ObjectResourceDefinition>(); // // @Override // public void registerDefinition(ObjectResourceDefinition definition) { // // class Remover { // /** // * Remove any entry already keyed to this definition. The algo is // * aggressive: Any definition having any existing map key will be // * removed from all three maps. // * // * @param definition // */ // public void removeDuplicates(ObjectResourceDefinition definition) { // removeName(definition.getName()); // removeRDM(definition.getResourceDataModel()); // removeCDT(definition.getResourceDataModel() // .getCanonicalDataType()); // } // // void removeName(String name) { // ObjectResourceDefinition def = getResourceDefinition(name); // if (def != null) { // remove(def); // } // } // // void removeRDM(ResourceDataModel rdm) { // ObjectResourceDefinition def = getResourceDefinition(rdm); // if (def != null) { // remove(def); // } // } // // void removeCDT(CanonicalDataType cdt) { // ObjectResourceDefinition def = getResourceDefinition(cdt); // if (def != null) { // remove(def); // } // } // // void remove(ObjectResourceDefinition definition) { // removeFromMap(definition, nameMap); // removeFromMap(definition, rdmMap); // removeFromMap(definition, cdtMap); // } // // void removeFromMap(ObjectResourceDefinition definition, // Map<?, ?> map) { // boolean foundAndRemoved; // do { // foundAndRemoved = false; // for (Entry<?, ?> entry : map.entrySet()) { // if (entry.getValue() == definition) { // map.remove(entry.getKey()); // foundAndRemoved = true; // break; // } // } // } while (foundAndRemoved); // removed one, look for another // } // } // // new Remover().removeDuplicates(definition); // nameMap.put(definition.getName(), definition); // rdmMap.put(definition.getResourceDataModel(), definition); // cdtMap.put(definition.getResourceDataModel().getCanonicalDataType(), // definition); // } // // @Override // public ObjectResourceDefinition getResourceDefinition(String name) { // return nameMap.containsKey(name) ? nameMap.get(name) : null; // } // // @Override // public ObjectResourceDefinition getResourceDefinition(ResourceDataModel rdm) { // return rdmMap.containsKey(rdm) ? rdmMap.get(rdm) : null; // } // // @Override // public ObjectResourceDefinition getResourceDefinition(CanonicalDataType cdt) { // return cdtMap.containsKey(cdt) ? cdtMap.get(cdt) : null; // } // // }
import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.nativeImpl.ObjectResourceDefinitionRegistryImpl;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; /** * A registry of ObjectResourceDefinitions, allowing lookup by the name or by * the associated ResourceDataModel. * * @author Ted * */ public interface ObjectResourceDefinitionRegistry { // TODO: Check use of Singleton pattern, consider DI/Resource Locator. public static ObjectResourceDefinitionRegistry INSTANCE = new ObjectResourceDefinitionRegistryImpl(); /** * Register a ResourceDataModel. Registering an ObjectResourceDefinition * with a duplicate name, ResourceDataModel or CanonicalDataType will remove * the previous entry from the registry, and add this one in its place. * * @param rdm * @param definition */ public void registerDefinition(ObjectResourceDefinition definition); /** * Retrieve an ObjectResourceDefinition by its name. * * @param name * @return */ public ObjectResourceDefinition getResourceDefinition(String name); /** * Retrieve an ObjectResourceDefinition by its associated ResourceDataModel. * * @param name * @return */ public ObjectResourceDefinition getResourceDefinition(ResourceDataModel rdm); /** * Retrieve an ObjectResourceDefinition by its associated CanonicalDataType. * * @param name * @return */
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionRegistryImpl.java // public class ObjectResourceDefinitionRegistryImpl implements // ObjectResourceDefinitionRegistry { // // private Map<String, ObjectResourceDefinition> nameMap = new HashMap<String, ObjectResourceDefinition>(); // private Map<CanonicalDataType, ObjectResourceDefinition> cdtMap = new HashMap<CanonicalDataType, ObjectResourceDefinition>(); // private Map<ResourceDataModel, ObjectResourceDefinition> rdmMap = new HashMap<ResourceDataModel, ObjectResourceDefinition>(); // // @Override // public void registerDefinition(ObjectResourceDefinition definition) { // // class Remover { // /** // * Remove any entry already keyed to this definition. The algo is // * aggressive: Any definition having any existing map key will be // * removed from all three maps. // * // * @param definition // */ // public void removeDuplicates(ObjectResourceDefinition definition) { // removeName(definition.getName()); // removeRDM(definition.getResourceDataModel()); // removeCDT(definition.getResourceDataModel() // .getCanonicalDataType()); // } // // void removeName(String name) { // ObjectResourceDefinition def = getResourceDefinition(name); // if (def != null) { // remove(def); // } // } // // void removeRDM(ResourceDataModel rdm) { // ObjectResourceDefinition def = getResourceDefinition(rdm); // if (def != null) { // remove(def); // } // } // // void removeCDT(CanonicalDataType cdt) { // ObjectResourceDefinition def = getResourceDefinition(cdt); // if (def != null) { // remove(def); // } // } // // void remove(ObjectResourceDefinition definition) { // removeFromMap(definition, nameMap); // removeFromMap(definition, rdmMap); // removeFromMap(definition, cdtMap); // } // // void removeFromMap(ObjectResourceDefinition definition, // Map<?, ?> map) { // boolean foundAndRemoved; // do { // foundAndRemoved = false; // for (Entry<?, ?> entry : map.entrySet()) { // if (entry.getValue() == definition) { // map.remove(entry.getKey()); // foundAndRemoved = true; // break; // } // } // } while (foundAndRemoved); // removed one, look for another // } // } // // new Remover().removeDuplicates(definition); // nameMap.put(definition.getName(), definition); // rdmMap.put(definition.getResourceDataModel(), definition); // cdtMap.put(definition.getResourceDataModel().getCanonicalDataType(), // definition); // } // // @Override // public ObjectResourceDefinition getResourceDefinition(String name) { // return nameMap.containsKey(name) ? nameMap.get(name) : null; // } // // @Override // public ObjectResourceDefinition getResourceDefinition(ResourceDataModel rdm) { // return rdmMap.containsKey(rdm) ? rdmMap.get(rdm) : null; // } // // @Override // public ObjectResourceDefinition getResourceDefinition(CanonicalDataType cdt) { // return cdtMap.containsKey(cdt) ? cdtMap.get(cdt) : null; // } // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinitionRegistry.java import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.nativeImpl.ObjectResourceDefinitionRegistryImpl; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; /** * A registry of ObjectResourceDefinitions, allowing lookup by the name or by * the associated ResourceDataModel. * * @author Ted * */ public interface ObjectResourceDefinitionRegistry { // TODO: Check use of Singleton pattern, consider DI/Resource Locator. public static ObjectResourceDefinitionRegistry INSTANCE = new ObjectResourceDefinitionRegistryImpl(); /** * Register a ResourceDataModel. Registering an ObjectResourceDefinition * with a duplicate name, ResourceDataModel or CanonicalDataType will remove * the previous entry from the registry, and add this one in its place. * * @param rdm * @param definition */ public void registerDefinition(ObjectResourceDefinition definition); /** * Retrieve an ObjectResourceDefinition by its name. * * @param name * @return */ public ObjectResourceDefinition getResourceDefinition(String name); /** * Retrieve an ObjectResourceDefinition by its associated ResourceDataModel. * * @param name * @return */ public ObjectResourceDefinition getResourceDefinition(ResourceDataModel rdm); /** * Retrieve an ObjectResourceDefinition by its associated CanonicalDataType. * * @param name * @return */
public ObjectResourceDefinition getResourceDefinition(CanonicalDataType canonicalDataType);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/serializer/Serializer.java
// Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java // public interface ObjectResource { // // public Object getCanonicalObject(); // // public void setCanonicalObject(Object obj); // // public URI getURI(); // // public void setURI(URI uri); // // public ObjectResourceDefinition getResourceDefinition(); // // public void setResourceDefinition(ObjectResourceDefinition definition); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // }
import com.modelsolv.kaboom.model.resource.ObjectResource; import com.modelsolv.kaboom.model.resource.ResourceDataModel; import com.modelsolv.kaboom.object.CanonicalObjectReader;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.serializer; public interface Serializer { /** * Serialize a canonical object. This is basic serialization without a URI * associated with the root resource. However, referenced objects that have * associated ResourceDefinitions through the * ObjectResourceDefinitionRegistry will be rendered with their URIs. * * @param obj * @param reader * @param rdm * @return */ public String serialize(Object obj, CanonicalObjectReader reader,
// Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java // public interface ObjectResource { // // public Object getCanonicalObject(); // // public void setCanonicalObject(Object obj); // // public URI getURI(); // // public void setURI(URI uri); // // public ObjectResourceDefinition getResourceDefinition(); // // public void setResourceDefinition(ObjectResourceDefinition definition); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // } // Path: src/main/java/com/modelsolv/kaboom/serializer/Serializer.java import com.modelsolv.kaboom.model.resource.ObjectResource; import com.modelsolv.kaboom.model.resource.ResourceDataModel; import com.modelsolv.kaboom.object.CanonicalObjectReader; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.serializer; public interface Serializer { /** * Serialize a canonical object. This is basic serialization without a URI * associated with the root resource. However, referenced objects that have * associated ResourceDefinitions through the * ObjectResourceDefinitionRegistry will be rendered with their URIs. * * @param obj * @param reader * @param rdm * @return */ public String serialize(Object obj, CanonicalObjectReader reader,
ResourceDataModel rdm);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/serializer/Serializer.java
// Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java // public interface ObjectResource { // // public Object getCanonicalObject(); // // public void setCanonicalObject(Object obj); // // public URI getURI(); // // public void setURI(URI uri); // // public ObjectResourceDefinition getResourceDefinition(); // // public void setResourceDefinition(ObjectResourceDefinition definition); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // }
import com.modelsolv.kaboom.model.resource.ObjectResource; import com.modelsolv.kaboom.model.resource.ResourceDataModel; import com.modelsolv.kaboom.object.CanonicalObjectReader;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.serializer; public interface Serializer { /** * Serialize a canonical object. This is basic serialization without a URI * associated with the root resource. However, referenced objects that have * associated ResourceDefinitions through the * ObjectResourceDefinitionRegistry will be rendered with their URIs. * * @param obj * @param reader * @param rdm * @return */ public String serialize(Object obj, CanonicalObjectReader reader, ResourceDataModel rdm); /** * Serialize an ObjectResource. The resource URI, canonical object, and * resource data model used for serialization are all extracted from the * resource. * * @param res * @param reader * @return */
// Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java // public interface ObjectResource { // // public Object getCanonicalObject(); // // public void setCanonicalObject(Object obj); // // public URI getURI(); // // public void setURI(URI uri); // // public ObjectResourceDefinition getResourceDefinition(); // // public void setResourceDefinition(ObjectResourceDefinition definition); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // } // Path: src/main/java/com/modelsolv/kaboom/serializer/Serializer.java import com.modelsolv.kaboom.model.resource.ObjectResource; import com.modelsolv.kaboom.model.resource.ResourceDataModel; import com.modelsolv.kaboom.object.CanonicalObjectReader; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.serializer; public interface Serializer { /** * Serialize a canonical object. This is basic serialization without a URI * associated with the root resource. However, referenced objects that have * associated ResourceDefinitions through the * ObjectResourceDefinitionRegistry will be rendered with their URIs. * * @param obj * @param reader * @param rdm * @return */ public String serialize(Object obj, CanonicalObjectReader reader, ResourceDataModel rdm); /** * Serialize an ObjectResource. The resource URI, canonical object, and * resource data model used for serialization are all extracted from the * resource. * * @param res * @param reader * @return */
public String serialize(ObjectResource res, CanonicalObjectReader reader);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CDMPrimitivePropertyImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // }
import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class CDMPrimitivePropertyImpl extends CDMPropertyImpl implements CDMPrimitiveProperty {
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // } // Path: src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CDMPrimitivePropertyImpl.java import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class CDMPrimitivePropertyImpl extends CDMPropertyImpl implements CDMPrimitiveProperty {
private PrimitiveDataType type = PrimitiveDataType.STRING;
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CDMPrimitivePropertyImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // }
import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class CDMPrimitivePropertyImpl extends CDMPropertyImpl implements CDMPrimitiveProperty { private PrimitiveDataType type = PrimitiveDataType.STRING; public CDMPrimitivePropertyImpl(String name, PrimitiveDataType type) { super(name); this.type = type; } public CDMPrimitivePropertyImpl(String name, PrimitiveDataType type,
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // } // Path: src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CDMPrimitivePropertyImpl.java import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class CDMPrimitivePropertyImpl extends CDMPropertyImpl implements CDMPrimitiveProperty { private PrimitiveDataType type = PrimitiveDataType.STRING; public CDMPrimitivePropertyImpl(String name, PrimitiveDataType type) { super(name); this.type = type; } public CDMPrimitivePropertyImpl(String name, PrimitiveDataType type,
Cardinality cardinality) {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // }
import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface ResourceDataModel { public CanonicalDataType getCanonicalDataType(); public void setCanonicalDataType(CanonicalDataType type); public ResourceDataModel withCanonicalDataType(CanonicalDataType type); public Iterable<RDMProperty> getIncludedProperties(); // Add a list of CDM properties from the CanonicalDataType
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface ResourceDataModel { public CanonicalDataType getCanonicalDataType(); public void setCanonicalDataType(CanonicalDataType type); public ResourceDataModel withCanonicalDataType(CanonicalDataType type); public Iterable<RDMProperty> getIncludedProperties(); // Add a list of CDM properties from the CanonicalDataType
public ResourceDataModel includingProperties(CDMProperty... properties);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // }
import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface ResourceDataModel { public CanonicalDataType getCanonicalDataType(); public void setCanonicalDataType(CanonicalDataType type); public ResourceDataModel withCanonicalDataType(CanonicalDataType type); public Iterable<RDMProperty> getIncludedProperties(); // Add a list of CDM properties from the CanonicalDataType public ResourceDataModel includingProperties(CDMProperty... properties); public ResourceDataModel includingProperties(String... properties); // Add Primitive Property from CDM Property public RDMPrimitiveProperty addPrimitiveProperty(
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface ResourceDataModel { public CanonicalDataType getCanonicalDataType(); public void setCanonicalDataType(CanonicalDataType type); public ResourceDataModel withCanonicalDataType(CanonicalDataType type); public Iterable<RDMProperty> getIncludedProperties(); // Add a list of CDM properties from the CanonicalDataType public ResourceDataModel includingProperties(CDMProperty... properties); public ResourceDataModel includingProperties(String... properties); // Add Primitive Property from CDM Property public RDMPrimitiveProperty addPrimitiveProperty(
CDMPrimitiveProperty property);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // }
import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface ResourceDataModel { public CanonicalDataType getCanonicalDataType(); public void setCanonicalDataType(CanonicalDataType type); public ResourceDataModel withCanonicalDataType(CanonicalDataType type); public Iterable<RDMProperty> getIncludedProperties(); // Add a list of CDM properties from the CanonicalDataType public ResourceDataModel includingProperties(CDMProperty... properties); public ResourceDataModel includingProperties(String... properties); // Add Primitive Property from CDM Property public RDMPrimitiveProperty addPrimitiveProperty( CDMPrimitiveProperty property); // Add Primitive Property directly, chainable, builder style public ResourceDataModel withPrimitiveProperty( RDMPrimitiveProperty property); // Add ReferenceLink from CDMReferenceProperty
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface ResourceDataModel { public CanonicalDataType getCanonicalDataType(); public void setCanonicalDataType(CanonicalDataType type); public ResourceDataModel withCanonicalDataType(CanonicalDataType type); public Iterable<RDMProperty> getIncludedProperties(); // Add a list of CDM properties from the CanonicalDataType public ResourceDataModel includingProperties(CDMProperty... properties); public ResourceDataModel includingProperties(String... properties); // Add Primitive Property from CDM Property public RDMPrimitiveProperty addPrimitiveProperty( CDMPrimitiveProperty property); // Add Primitive Property directly, chainable, builder style public ResourceDataModel withPrimitiveProperty( RDMPrimitiveProperty property); // Add ReferenceLink from CDMReferenceProperty
public ReferenceLink addReferenceLink(CDMReferenceProperty property);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java // public interface ObjectResource { // // public Object getCanonicalObject(); // // public void setCanonicalObject(Object obj); // // public URI getURI(); // // public void setURI(URI uri); // // public ObjectResourceDefinition getResourceDefinition(); // // public void setResourceDefinition(ObjectResourceDefinition definition); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java // public interface RDMFactory { // // public static RDMFactory INSTANCE = new NativeRDMFactory(); // // public RDMPrimitiveProperty createRDMPrimitiveProperty( // CDMPrimitiveProperty cdmProperty); // // public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty); // // public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty); // // public ResourceDataModel createResourceDataModel(CanonicalDataType cdt); // // public ObjectResourceDefinition createObjectResourceDefinition(String uriTemplate, ResourceDataModel rdm); // // public ObjectResource createObjectResource(Object canonicalObject, URI uri, // ObjectResourceDefinition ord); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // }
import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.beanutils.PropertyUtils; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.resource.ObjectResource; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMFactory; import com.modelsolv.kaboom.model.resource.ResourceDataModel; import com.modelsolv.kaboom.object.CanonicalObjectReader;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ObjectResourceDefinitionImpl implements ObjectResourceDefinition { private ResourceDataModel resourceDataModel; private String name; private String uriTemplate;
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java // public interface ObjectResource { // // public Object getCanonicalObject(); // // public void setCanonicalObject(Object obj); // // public URI getURI(); // // public void setURI(URI uri); // // public ObjectResourceDefinition getResourceDefinition(); // // public void setResourceDefinition(ObjectResourceDefinition definition); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java // public interface RDMFactory { // // public static RDMFactory INSTANCE = new NativeRDMFactory(); // // public RDMPrimitiveProperty createRDMPrimitiveProperty( // CDMPrimitiveProperty cdmProperty); // // public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty); // // public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty); // // public ResourceDataModel createResourceDataModel(CanonicalDataType cdt); // // public ObjectResourceDefinition createObjectResourceDefinition(String uriTemplate, ResourceDataModel rdm); // // public ObjectResource createObjectResource(Object canonicalObject, URI uri, // ObjectResourceDefinition ord); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionImpl.java import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.beanutils.PropertyUtils; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.resource.ObjectResource; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMFactory; import com.modelsolv.kaboom.model.resource.ResourceDataModel; import com.modelsolv.kaboom.object.CanonicalObjectReader; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ObjectResourceDefinitionImpl implements ObjectResourceDefinition { private ResourceDataModel resourceDataModel; private String name; private String uriTemplate;
private Map<String, CDMProperty> parameterBindings = new HashMap<String, CDMProperty>();
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java // public interface ObjectResource { // // public Object getCanonicalObject(); // // public void setCanonicalObject(Object obj); // // public URI getURI(); // // public void setURI(URI uri); // // public ObjectResourceDefinition getResourceDefinition(); // // public void setResourceDefinition(ObjectResourceDefinition definition); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java // public interface RDMFactory { // // public static RDMFactory INSTANCE = new NativeRDMFactory(); // // public RDMPrimitiveProperty createRDMPrimitiveProperty( // CDMPrimitiveProperty cdmProperty); // // public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty); // // public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty); // // public ResourceDataModel createResourceDataModel(CanonicalDataType cdt); // // public ObjectResourceDefinition createObjectResourceDefinition(String uriTemplate, ResourceDataModel rdm); // // public ObjectResource createObjectResource(Object canonicalObject, URI uri, // ObjectResourceDefinition ord); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // }
import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.beanutils.PropertyUtils; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.resource.ObjectResource; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMFactory; import com.modelsolv.kaboom.model.resource.ResourceDataModel; import com.modelsolv.kaboom.object.CanonicalObjectReader;
} @Override public void setName(String name) { this.name = name; } @Override public ObjectResourceDefinition withName(String name) { setName(name); return this; } @Override public void bindTemplateParameter(String parameter, CDMProperty property) { if (!resourceDataModel.getCanonicalDataType().hasProperty(property)) { throw new IllegalArgumentException( "Parameter must be bound to a property of the canonical data type."); } parameterBindings.put(parameter, property); } @Override public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property) { bindTemplateParameter(parameter, property); return this; } @Override
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java // public interface ObjectResource { // // public Object getCanonicalObject(); // // public void setCanonicalObject(Object obj); // // public URI getURI(); // // public void setURI(URI uri); // // public ObjectResourceDefinition getResourceDefinition(); // // public void setResourceDefinition(ObjectResourceDefinition definition); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java // public interface RDMFactory { // // public static RDMFactory INSTANCE = new NativeRDMFactory(); // // public RDMPrimitiveProperty createRDMPrimitiveProperty( // CDMPrimitiveProperty cdmProperty); // // public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty); // // public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty); // // public ResourceDataModel createResourceDataModel(CanonicalDataType cdt); // // public ObjectResourceDefinition createObjectResourceDefinition(String uriTemplate, ResourceDataModel rdm); // // public ObjectResource createObjectResource(Object canonicalObject, URI uri, // ObjectResourceDefinition ord); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionImpl.java import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.beanutils.PropertyUtils; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.resource.ObjectResource; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMFactory; import com.modelsolv.kaboom.model.resource.ResourceDataModel; import com.modelsolv.kaboom.object.CanonicalObjectReader; } @Override public void setName(String name) { this.name = name; } @Override public ObjectResourceDefinition withName(String name) { setName(name); return this; } @Override public void bindTemplateParameter(String parameter, CDMProperty property) { if (!resourceDataModel.getCanonicalDataType().hasProperty(property)) { throw new IllegalArgumentException( "Parameter must be bound to a property of the canonical data type."); } parameterBindings.put(parameter, property); } @Override public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property) { bindTemplateParameter(parameter, property); return this; } @Override
public ObjectResource getResource(Object canonicalObject,
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java // public interface ObjectResource { // // public Object getCanonicalObject(); // // public void setCanonicalObject(Object obj); // // public URI getURI(); // // public void setURI(URI uri); // // public ObjectResourceDefinition getResourceDefinition(); // // public void setResourceDefinition(ObjectResourceDefinition definition); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java // public interface RDMFactory { // // public static RDMFactory INSTANCE = new NativeRDMFactory(); // // public RDMPrimitiveProperty createRDMPrimitiveProperty( // CDMPrimitiveProperty cdmProperty); // // public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty); // // public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty); // // public ResourceDataModel createResourceDataModel(CanonicalDataType cdt); // // public ObjectResourceDefinition createObjectResourceDefinition(String uriTemplate, ResourceDataModel rdm); // // public ObjectResource createObjectResource(Object canonicalObject, URI uri, // ObjectResourceDefinition ord); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // }
import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.beanutils.PropertyUtils; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.resource.ObjectResource; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMFactory; import com.modelsolv.kaboom.model.resource.ResourceDataModel; import com.modelsolv.kaboom.object.CanonicalObjectReader;
@Override public void setName(String name) { this.name = name; } @Override public ObjectResourceDefinition withName(String name) { setName(name); return this; } @Override public void bindTemplateParameter(String parameter, CDMProperty property) { if (!resourceDataModel.getCanonicalDataType().hasProperty(property)) { throw new IllegalArgumentException( "Parameter must be bound to a property of the canonical data type."); } parameterBindings.put(parameter, property); } @Override public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property) { bindTemplateParameter(parameter, property); return this; } @Override public ObjectResource getResource(Object canonicalObject,
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java // public interface ObjectResource { // // public Object getCanonicalObject(); // // public void setCanonicalObject(Object obj); // // public URI getURI(); // // public void setURI(URI uri); // // public ObjectResourceDefinition getResourceDefinition(); // // public void setResourceDefinition(ObjectResourceDefinition definition); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java // public interface RDMFactory { // // public static RDMFactory INSTANCE = new NativeRDMFactory(); // // public RDMPrimitiveProperty createRDMPrimitiveProperty( // CDMPrimitiveProperty cdmProperty); // // public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty); // // public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty); // // public ResourceDataModel createResourceDataModel(CanonicalDataType cdt); // // public ObjectResourceDefinition createObjectResourceDefinition(String uriTemplate, ResourceDataModel rdm); // // public ObjectResource createObjectResource(Object canonicalObject, URI uri, // ObjectResourceDefinition ord); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionImpl.java import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.beanutils.PropertyUtils; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.resource.ObjectResource; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMFactory; import com.modelsolv.kaboom.model.resource.ResourceDataModel; import com.modelsolv.kaboom.object.CanonicalObjectReader; @Override public void setName(String name) { this.name = name; } @Override public ObjectResourceDefinition withName(String name) { setName(name); return this; } @Override public void bindTemplateParameter(String parameter, CDMProperty property) { if (!resourceDataModel.getCanonicalDataType().hasProperty(property)) { throw new IllegalArgumentException( "Parameter must be bound to a property of the canonical data type."); } parameterBindings.put(parameter, property); } @Override public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property) { bindTemplateParameter(parameter, property); return this; } @Override public ObjectResource getResource(Object canonicalObject,
CanonicalObjectReader reader) {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java // public interface ObjectResource { // // public Object getCanonicalObject(); // // public void setCanonicalObject(Object obj); // // public URI getURI(); // // public void setURI(URI uri); // // public ObjectResourceDefinition getResourceDefinition(); // // public void setResourceDefinition(ObjectResourceDefinition definition); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java // public interface RDMFactory { // // public static RDMFactory INSTANCE = new NativeRDMFactory(); // // public RDMPrimitiveProperty createRDMPrimitiveProperty( // CDMPrimitiveProperty cdmProperty); // // public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty); // // public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty); // // public ResourceDataModel createResourceDataModel(CanonicalDataType cdt); // // public ObjectResourceDefinition createObjectResourceDefinition(String uriTemplate, ResourceDataModel rdm); // // public ObjectResource createObjectResource(Object canonicalObject, URI uri, // ObjectResourceDefinition ord); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // }
import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.beanutils.PropertyUtils; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.resource.ObjectResource; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMFactory; import com.modelsolv.kaboom.model.resource.ResourceDataModel; import com.modelsolv.kaboom.object.CanonicalObjectReader;
public void setName(String name) { this.name = name; } @Override public ObjectResourceDefinition withName(String name) { setName(name); return this; } @Override public void bindTemplateParameter(String parameter, CDMProperty property) { if (!resourceDataModel.getCanonicalDataType().hasProperty(property)) { throw new IllegalArgumentException( "Parameter must be bound to a property of the canonical data type."); } parameterBindings.put(parameter, property); } @Override public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property) { bindTemplateParameter(parameter, property); return this; } @Override public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader) { URI uri = bindParameters(canonicalObject, reader);
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResource.java // public interface ObjectResource { // // public Object getCanonicalObject(); // // public void setCanonicalObject(Object obj); // // public URI getURI(); // // public void setURI(URI uri); // // public ObjectResourceDefinition getResourceDefinition(); // // public void setResourceDefinition(ObjectResourceDefinition definition); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java // public interface RDMFactory { // // public static RDMFactory INSTANCE = new NativeRDMFactory(); // // public RDMPrimitiveProperty createRDMPrimitiveProperty( // CDMPrimitiveProperty cdmProperty); // // public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty); // // public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty); // // public ResourceDataModel createResourceDataModel(CanonicalDataType cdt); // // public ObjectResourceDefinition createObjectResourceDefinition(String uriTemplate, ResourceDataModel rdm); // // public ObjectResource createObjectResource(Object canonicalObject, URI uri, // ObjectResourceDefinition ord); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionImpl.java import java.net.URI; import java.net.URISyntaxException; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.beanutils.PropertyUtils; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.resource.ObjectResource; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMFactory; import com.modelsolv.kaboom.model.resource.ResourceDataModel; import com.modelsolv.kaboom.object.CanonicalObjectReader; public void setName(String name) { this.name = name; } @Override public ObjectResourceDefinition withName(String name) { setName(name); return this; } @Override public void bindTemplateParameter(String parameter, CDMProperty property) { if (!resourceDataModel.getCanonicalDataType().hasProperty(property)) { throw new IllegalArgumentException( "Parameter must be bound to a property of the canonical data type."); } parameterBindings.put(parameter, property); } @Override public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property) { bindTemplateParameter(parameter, property); return this; } @Override public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader) { URI uri = bindParameters(canonicalObject, reader);
return RDMFactory.INSTANCE.createObjectResource(canonicalObject, uri,
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/NativeCDMFactory.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMFactory.java // public interface CDMFactory { // // public static CDMFactory INSTANCE = new NativeCDMFactory(); // // public CanonicalDataType createDataType(String name); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type, Cardinality cardinality); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType, Cardinality cardinality); // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // }
import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CDMFactory; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class NativeCDMFactory implements CDMFactory { @Override
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMFactory.java // public interface CDMFactory { // // public static CDMFactory INSTANCE = new NativeCDMFactory(); // // public CanonicalDataType createDataType(String name); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type, Cardinality cardinality); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType, Cardinality cardinality); // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // } // Path: src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/NativeCDMFactory.java import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CDMFactory; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class NativeCDMFactory implements CDMFactory { @Override
public CanonicalDataType createDataType(String name) {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/NativeCDMFactory.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMFactory.java // public interface CDMFactory { // // public static CDMFactory INSTANCE = new NativeCDMFactory(); // // public CanonicalDataType createDataType(String name); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type, Cardinality cardinality); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType, Cardinality cardinality); // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // }
import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CDMFactory; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class NativeCDMFactory implements CDMFactory { @Override public CanonicalDataType createDataType(String name) { return new CanonicalDataTypeImpl(name); } @Override
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMFactory.java // public interface CDMFactory { // // public static CDMFactory INSTANCE = new NativeCDMFactory(); // // public CanonicalDataType createDataType(String name); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type, Cardinality cardinality); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType, Cardinality cardinality); // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // } // Path: src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/NativeCDMFactory.java import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CDMFactory; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class NativeCDMFactory implements CDMFactory { @Override public CanonicalDataType createDataType(String name) { return new CanonicalDataTypeImpl(name); } @Override
public CDMPrimitiveProperty createPrimitiveProperty(String name,
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/NativeCDMFactory.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMFactory.java // public interface CDMFactory { // // public static CDMFactory INSTANCE = new NativeCDMFactory(); // // public CanonicalDataType createDataType(String name); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type, Cardinality cardinality); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType, Cardinality cardinality); // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // }
import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CDMFactory; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class NativeCDMFactory implements CDMFactory { @Override public CanonicalDataType createDataType(String name) { return new CanonicalDataTypeImpl(name); } @Override public CDMPrimitiveProperty createPrimitiveProperty(String name,
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMFactory.java // public interface CDMFactory { // // public static CDMFactory INSTANCE = new NativeCDMFactory(); // // public CanonicalDataType createDataType(String name); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type, Cardinality cardinality); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType, Cardinality cardinality); // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // } // Path: src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/NativeCDMFactory.java import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CDMFactory; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class NativeCDMFactory implements CDMFactory { @Override public CanonicalDataType createDataType(String name) { return new CanonicalDataTypeImpl(name); } @Override public CDMPrimitiveProperty createPrimitiveProperty(String name,
PrimitiveDataType type) {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/NativeCDMFactory.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMFactory.java // public interface CDMFactory { // // public static CDMFactory INSTANCE = new NativeCDMFactory(); // // public CanonicalDataType createDataType(String name); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type, Cardinality cardinality); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType, Cardinality cardinality); // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // }
import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CDMFactory; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class NativeCDMFactory implements CDMFactory { @Override public CanonicalDataType createDataType(String name) { return new CanonicalDataTypeImpl(name); } @Override public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type) { return new CDMPrimitivePropertyImpl(name, type); } @Override public CDMPrimitiveProperty createPrimitiveProperty(String name,
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMFactory.java // public interface CDMFactory { // // public static CDMFactory INSTANCE = new NativeCDMFactory(); // // public CanonicalDataType createDataType(String name); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type, Cardinality cardinality); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType, Cardinality cardinality); // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // } // Path: src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/NativeCDMFactory.java import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CDMFactory; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class NativeCDMFactory implements CDMFactory { @Override public CanonicalDataType createDataType(String name) { return new CanonicalDataTypeImpl(name); } @Override public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type) { return new CDMPrimitivePropertyImpl(name, type); } @Override public CDMPrimitiveProperty createPrimitiveProperty(String name,
PrimitiveDataType type, Cardinality cardinality) {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/NativeCDMFactory.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMFactory.java // public interface CDMFactory { // // public static CDMFactory INSTANCE = new NativeCDMFactory(); // // public CanonicalDataType createDataType(String name); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type, Cardinality cardinality); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType, Cardinality cardinality); // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // }
import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CDMFactory; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class NativeCDMFactory implements CDMFactory { @Override public CanonicalDataType createDataType(String name) { return new CanonicalDataTypeImpl(name); } @Override public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type) { return new CDMPrimitivePropertyImpl(name, type); } @Override public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type, Cardinality cardinality) { return new CDMPrimitivePropertyImpl(name, type, cardinality); } @Override
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMFactory.java // public interface CDMFactory { // // public static CDMFactory INSTANCE = new NativeCDMFactory(); // // public CanonicalDataType createDataType(String name); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type); // // public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type, Cardinality cardinality); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType); // // public CDMReferenceProperty createReferenceProperty(String name, CanonicalDataType targetType, Cardinality cardinality); // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // } // Path: src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/NativeCDMFactory.java import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CDMFactory; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class NativeCDMFactory implements CDMFactory { @Override public CanonicalDataType createDataType(String name) { return new CanonicalDataTypeImpl(name); } @Override public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type) { return new CDMPrimitivePropertyImpl(name, type); } @Override public CDMPrimitiveProperty createPrimitiveProperty(String name, PrimitiveDataType type, Cardinality cardinality) { return new CDMPrimitivePropertyImpl(name, type, cardinality); } @Override
public CDMReferenceProperty createReferenceProperty(String name,
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/RDMReferenceProperty.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/ReadableCDMReferenceProperty.java // public interface ReadableCDMReferenceProperty extends ReadableCDMProperty { // // public CanonicalDataType getTargetDataType(); // // public CDMReferenceProperty getInverseProperty(); // // }
import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.ReadableCDMReferenceProperty;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface RDMReferenceProperty extends RDMProperty, ReadableCDMReferenceProperty { @Override
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/ReadableCDMReferenceProperty.java // public interface ReadableCDMReferenceProperty extends ReadableCDMProperty { // // public CanonicalDataType getTargetDataType(); // // public CDMReferenceProperty getInverseProperty(); // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMReferenceProperty.java import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.ReadableCDMReferenceProperty; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface RDMReferenceProperty extends RDMProperty, ReadableCDMReferenceProperty { @Override
public CDMReferenceProperty getCDMProperty();
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/ReferenceLink.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // }
import com.modelsolv.kaboom.model.canonical.CDMProperty;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface ReferenceLink extends RDMReferenceProperty { /** * The list of included "decorator" properties included in the * ReferenceLink. These may be defined directly in the ReferenceLink, or in * a named LinkDescriptor. * * @return */ public Iterable<RDMProperty> getIncludedProperties();
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/ReferenceLink.java import com.modelsolv.kaboom.model.canonical.CDMProperty; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface ReferenceLink extends RDMReferenceProperty { /** * The list of included "decorator" properties included in the * ReferenceLink. These may be defined directly in the ReferenceLink, or in * a named LinkDescriptor. * * @return */ public Iterable<RDMProperty> getIncludedProperties();
public ReferenceLink includingProperties(CDMProperty... properties);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CanonicalDataTypeImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // }
import java.util.LinkedHashMap; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class CanonicalDataTypeImpl implements CanonicalDataType { private String name;
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // } // Path: src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CanonicalDataTypeImpl.java import java.util.LinkedHashMap; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.canonical.nativeImpl; public class CanonicalDataTypeImpl implements CanonicalDataType { private String name;
private LinkedHashMap<String, CDMProperty> properties = new LinkedHashMap<String, CDMProperty>();
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CanonicalDataTypeImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // }
import java.util.LinkedHashMap; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType;
@Override public String getName() { return name; } @Override public void setName(String name) { this.name = name; } @Override public Iterable<CDMProperty> getProperties() { return properties.values(); } @Override public CDMProperty getProperty(String propName) { if (properties.containsKey(propName)) { return properties.get(propName); } return null; } @Override public boolean hasProperty(CDMProperty property) { return properties.containsValue(property); } @Override
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // } // Path: src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CanonicalDataTypeImpl.java import java.util.LinkedHashMap; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType; @Override public String getName() { return name; } @Override public void setName(String name) { this.name = name; } @Override public Iterable<CDMProperty> getProperties() { return properties.values(); } @Override public CDMProperty getProperty(String propName) { if (properties.containsKey(propName)) { return properties.get(propName); } return null; } @Override public boolean hasProperty(CDMProperty property) { return properties.containsValue(property); } @Override
public CanonicalDataType withPrimitive(String name, PrimitiveDataType type) {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CanonicalDataTypeImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // }
import java.util.LinkedHashMap; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType;
@Override public String getName() { return name; } @Override public void setName(String name) { this.name = name; } @Override public Iterable<CDMProperty> getProperties() { return properties.values(); } @Override public CDMProperty getProperty(String propName) { if (properties.containsKey(propName)) { return properties.get(propName); } return null; } @Override public boolean hasProperty(CDMProperty property) { return properties.containsValue(property); } @Override public CanonicalDataType withPrimitive(String name, PrimitiveDataType type) {
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // } // Path: src/main/java/com/modelsolv/kaboom/model/canonical/nativeImpl/CanonicalDataTypeImpl.java import java.util.LinkedHashMap; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType; @Override public String getName() { return name; } @Override public void setName(String name) { this.name = name; } @Override public Iterable<CDMProperty> getProperties() { return properties.values(); } @Override public CDMProperty getProperty(String propName) { if (properties.containsKey(propName)) { return properties.get(propName); } return null; } @Override public boolean hasProperty(CDMProperty property) { return properties.containsValue(property); } @Override public CanonicalDataType withPrimitive(String name, PrimitiveDataType type) {
return withPrimitive(name, type, Cardinality.ONE);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/RDMPrimitivePropertyImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMPrimitiveProperty.java // public interface RDMPrimitiveProperty extends RDMProperty, ReadableCDMPrimitiveProperty { // @Override // public CDMPrimitiveProperty getCDMProperty(); // }
import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType; import com.modelsolv.kaboom.model.resource.RDMPrimitiveProperty;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class RDMPrimitivePropertyImpl extends RDMPropertyImpl implements RDMPrimitiveProperty {
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMPrimitiveProperty.java // public interface RDMPrimitiveProperty extends RDMProperty, ReadableCDMPrimitiveProperty { // @Override // public CDMPrimitiveProperty getCDMProperty(); // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/RDMPrimitivePropertyImpl.java import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType; import com.modelsolv.kaboom.model.resource.RDMPrimitiveProperty; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class RDMPrimitivePropertyImpl extends RDMPropertyImpl implements RDMPrimitiveProperty {
public RDMPrimitivePropertyImpl(CDMPrimitiveProperty cdmProperty) {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/RDMPrimitivePropertyImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMPrimitiveProperty.java // public interface RDMPrimitiveProperty extends RDMProperty, ReadableCDMPrimitiveProperty { // @Override // public CDMPrimitiveProperty getCDMProperty(); // }
import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType; import com.modelsolv.kaboom.model.resource.RDMPrimitiveProperty;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class RDMPrimitivePropertyImpl extends RDMPropertyImpl implements RDMPrimitiveProperty { public RDMPrimitivePropertyImpl(CDMPrimitiveProperty cdmProperty) { super(cdmProperty); } @Override
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/PrimitiveDataType.java // public enum PrimitiveDataType { // STRING, INTEGER, FLOAT, DECIMAL, BOOLEAN, DATE // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMPrimitiveProperty.java // public interface RDMPrimitiveProperty extends RDMProperty, ReadableCDMPrimitiveProperty { // @Override // public CDMPrimitiveProperty getCDMProperty(); // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/RDMPrimitivePropertyImpl.java import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.PrimitiveDataType; import com.modelsolv.kaboom.model.resource.RDMPrimitiveProperty; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class RDMPrimitivePropertyImpl extends RDMPropertyImpl implements RDMPrimitiveProperty { public RDMPrimitivePropertyImpl(CDMPrimitiveProperty cdmProperty) { super(cdmProperty); } @Override
public PrimitiveDataType getType() {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionRegistryImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinitionRegistry.java // public interface ObjectResourceDefinitionRegistry { // // // TODO: Check use of Singleton pattern, consider DI/Resource Locator. // public static ObjectResourceDefinitionRegistry INSTANCE = new ObjectResourceDefinitionRegistryImpl(); // // /** // * Register a ResourceDataModel. Registering an ObjectResourceDefinition // * with a duplicate name, ResourceDataModel or CanonicalDataType will remove // * the previous entry from the registry, and add this one in its place. // * // * @param rdm // * @param definition // */ // public void registerDefinition(ObjectResourceDefinition definition); // // /** // * Retrieve an ObjectResourceDefinition by its name. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(String name); // // /** // * Retrieve an ObjectResourceDefinition by its associated ResourceDataModel. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(ResourceDataModel rdm); // // /** // * Retrieve an ObjectResourceDefinition by its associated CanonicalDataType. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(CanonicalDataType canonicalDataType); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // }
import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinitionRegistry; import com.modelsolv.kaboom.model.resource.ResourceDataModel;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ObjectResourceDefinitionRegistryImpl implements ObjectResourceDefinitionRegistry {
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinitionRegistry.java // public interface ObjectResourceDefinitionRegistry { // // // TODO: Check use of Singleton pattern, consider DI/Resource Locator. // public static ObjectResourceDefinitionRegistry INSTANCE = new ObjectResourceDefinitionRegistryImpl(); // // /** // * Register a ResourceDataModel. Registering an ObjectResourceDefinition // * with a duplicate name, ResourceDataModel or CanonicalDataType will remove // * the previous entry from the registry, and add this one in its place. // * // * @param rdm // * @param definition // */ // public void registerDefinition(ObjectResourceDefinition definition); // // /** // * Retrieve an ObjectResourceDefinition by its name. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(String name); // // /** // * Retrieve an ObjectResourceDefinition by its associated ResourceDataModel. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(ResourceDataModel rdm); // // /** // * Retrieve an ObjectResourceDefinition by its associated CanonicalDataType. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(CanonicalDataType canonicalDataType); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionRegistryImpl.java import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinitionRegistry; import com.modelsolv.kaboom.model.resource.ResourceDataModel; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ObjectResourceDefinitionRegistryImpl implements ObjectResourceDefinitionRegistry {
private Map<String, ObjectResourceDefinition> nameMap = new HashMap<String, ObjectResourceDefinition>();
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionRegistryImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinitionRegistry.java // public interface ObjectResourceDefinitionRegistry { // // // TODO: Check use of Singleton pattern, consider DI/Resource Locator. // public static ObjectResourceDefinitionRegistry INSTANCE = new ObjectResourceDefinitionRegistryImpl(); // // /** // * Register a ResourceDataModel. Registering an ObjectResourceDefinition // * with a duplicate name, ResourceDataModel or CanonicalDataType will remove // * the previous entry from the registry, and add this one in its place. // * // * @param rdm // * @param definition // */ // public void registerDefinition(ObjectResourceDefinition definition); // // /** // * Retrieve an ObjectResourceDefinition by its name. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(String name); // // /** // * Retrieve an ObjectResourceDefinition by its associated ResourceDataModel. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(ResourceDataModel rdm); // // /** // * Retrieve an ObjectResourceDefinition by its associated CanonicalDataType. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(CanonicalDataType canonicalDataType); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // }
import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinitionRegistry; import com.modelsolv.kaboom.model.resource.ResourceDataModel;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ObjectResourceDefinitionRegistryImpl implements ObjectResourceDefinitionRegistry { private Map<String, ObjectResourceDefinition> nameMap = new HashMap<String, ObjectResourceDefinition>();
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinitionRegistry.java // public interface ObjectResourceDefinitionRegistry { // // // TODO: Check use of Singleton pattern, consider DI/Resource Locator. // public static ObjectResourceDefinitionRegistry INSTANCE = new ObjectResourceDefinitionRegistryImpl(); // // /** // * Register a ResourceDataModel. Registering an ObjectResourceDefinition // * with a duplicate name, ResourceDataModel or CanonicalDataType will remove // * the previous entry from the registry, and add this one in its place. // * // * @param rdm // * @param definition // */ // public void registerDefinition(ObjectResourceDefinition definition); // // /** // * Retrieve an ObjectResourceDefinition by its name. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(String name); // // /** // * Retrieve an ObjectResourceDefinition by its associated ResourceDataModel. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(ResourceDataModel rdm); // // /** // * Retrieve an ObjectResourceDefinition by its associated CanonicalDataType. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(CanonicalDataType canonicalDataType); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionRegistryImpl.java import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinitionRegistry; import com.modelsolv.kaboom.model.resource.ResourceDataModel; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ObjectResourceDefinitionRegistryImpl implements ObjectResourceDefinitionRegistry { private Map<String, ObjectResourceDefinition> nameMap = new HashMap<String, ObjectResourceDefinition>();
private Map<CanonicalDataType, ObjectResourceDefinition> cdtMap = new HashMap<CanonicalDataType, ObjectResourceDefinition>();
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionRegistryImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinitionRegistry.java // public interface ObjectResourceDefinitionRegistry { // // // TODO: Check use of Singleton pattern, consider DI/Resource Locator. // public static ObjectResourceDefinitionRegistry INSTANCE = new ObjectResourceDefinitionRegistryImpl(); // // /** // * Register a ResourceDataModel. Registering an ObjectResourceDefinition // * with a duplicate name, ResourceDataModel or CanonicalDataType will remove // * the previous entry from the registry, and add this one in its place. // * // * @param rdm // * @param definition // */ // public void registerDefinition(ObjectResourceDefinition definition); // // /** // * Retrieve an ObjectResourceDefinition by its name. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(String name); // // /** // * Retrieve an ObjectResourceDefinition by its associated ResourceDataModel. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(ResourceDataModel rdm); // // /** // * Retrieve an ObjectResourceDefinition by its associated CanonicalDataType. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(CanonicalDataType canonicalDataType); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // }
import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinitionRegistry; import com.modelsolv.kaboom.model.resource.ResourceDataModel;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ObjectResourceDefinitionRegistryImpl implements ObjectResourceDefinitionRegistry { private Map<String, ObjectResourceDefinition> nameMap = new HashMap<String, ObjectResourceDefinition>(); private Map<CanonicalDataType, ObjectResourceDefinition> cdtMap = new HashMap<CanonicalDataType, ObjectResourceDefinition>();
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinitionRegistry.java // public interface ObjectResourceDefinitionRegistry { // // // TODO: Check use of Singleton pattern, consider DI/Resource Locator. // public static ObjectResourceDefinitionRegistry INSTANCE = new ObjectResourceDefinitionRegistryImpl(); // // /** // * Register a ResourceDataModel. Registering an ObjectResourceDefinition // * with a duplicate name, ResourceDataModel or CanonicalDataType will remove // * the previous entry from the registry, and add this one in its place. // * // * @param rdm // * @param definition // */ // public void registerDefinition(ObjectResourceDefinition definition); // // /** // * Retrieve an ObjectResourceDefinition by its name. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(String name); // // /** // * Retrieve an ObjectResourceDefinition by its associated ResourceDataModel. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(ResourceDataModel rdm); // // /** // * Retrieve an ObjectResourceDefinition by its associated CanonicalDataType. // * // * @param name // * @return // */ // public ObjectResourceDefinition getResourceDefinition(CanonicalDataType canonicalDataType); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ResourceDataModel.java // public interface ResourceDataModel { // // public CanonicalDataType getCanonicalDataType(); // // public void setCanonicalDataType(CanonicalDataType type); // // public ResourceDataModel withCanonicalDataType(CanonicalDataType type); // // public Iterable<RDMProperty> getIncludedProperties(); // // // Add a list of CDM properties from the CanonicalDataType // public ResourceDataModel includingProperties(CDMProperty... properties); // // public ResourceDataModel includingProperties(String... properties); // // // Add Primitive Property from CDM Property // public RDMPrimitiveProperty addPrimitiveProperty( // CDMPrimitiveProperty property); // // // Add Primitive Property directly, chainable, builder style // public ResourceDataModel withPrimitiveProperty( // RDMPrimitiveProperty property); // // // Add ReferenceLink from CDMReferenceProperty // public ReferenceLink addReferenceLink(CDMReferenceProperty property); // // // Add ReferenceLink Directly, chainable, builder style // public ResourceDataModel withReferenceLink(ReferenceLink refLink); // // // Add ReferenceEmbed from CDMReferenceProperty // public ReferenceEmbed addReferenceEmbed(CDMReferenceProperty property); // // // Add ReferenceEmbed Directly, chainable, builder style // public ResourceDataModel withReferenceEmbed(ReferenceEmbed refEmbed); // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ObjectResourceDefinitionRegistryImpl.java import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinitionRegistry; import com.modelsolv.kaboom.model.resource.ResourceDataModel; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ObjectResourceDefinitionRegistryImpl implements ObjectResourceDefinitionRegistry { private Map<String, ObjectResourceDefinition> nameMap = new HashMap<String, ObjectResourceDefinition>(); private Map<CanonicalDataType, ObjectResourceDefinition> cdtMap = new HashMap<CanonicalDataType, ObjectResourceDefinition>();
private Map<ResourceDataModel, ObjectResourceDefinition> rdmMap = new HashMap<ResourceDataModel, ObjectResourceDefinition>();
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // }
import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.resource.RDMProperty;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.object; public interface CanonicalObjectReader { public Object getPropertyValue(Object obj, CDMProperty prop);
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // } // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.resource.RDMProperty; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.object; public interface CanonicalObjectReader { public Object getPropertyValue(Object obj, CDMProperty prop);
public Object getPropertyValue(Object obj, RDMProperty prop);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/object/beanImpl/CanonicalObjectBeanReader.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // }
import com.modelsolv.kaboom.object.CanonicalObjectReader; import org.apache.commons.beanutils.PropertyUtils; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.resource.RDMProperty;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.object.beanImpl; /** * A wrapper around a Java Bean that exposes the CanonicalObject interface. * Accesses properties reflectively, and adapts references recursively. * * @author Ted * */ public class CanonicalObjectBeanReader implements CanonicalObjectReader { @Override
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // } // Path: src/main/java/com/modelsolv/kaboom/object/beanImpl/CanonicalObjectBeanReader.java import com.modelsolv.kaboom.object.CanonicalObjectReader; import org.apache.commons.beanutils.PropertyUtils; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.resource.RDMProperty; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.object.beanImpl; /** * A wrapper around a Java Bean that exposes the CanonicalObject interface. * Accesses properties reflectively, and adapts references recursively. * * @author Ted * */ public class CanonicalObjectBeanReader implements CanonicalObjectReader { @Override
public Object getPropertyValue(Object obj, RDMProperty prop) {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/object/beanImpl/CanonicalObjectBeanReader.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // }
import com.modelsolv.kaboom.object.CanonicalObjectReader; import org.apache.commons.beanutils.PropertyUtils; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.resource.RDMProperty;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.object.beanImpl; /** * A wrapper around a Java Bean that exposes the CanonicalObject interface. * Accesses properties reflectively, and adapts references recursively. * * @author Ted * */ public class CanonicalObjectBeanReader implements CanonicalObjectReader { @Override public Object getPropertyValue(Object obj, RDMProperty prop) { return getPropertyValue(obj, prop.getName()); } @Override
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // } // // Path: src/main/java/com/modelsolv/kaboom/object/CanonicalObjectReader.java // public interface CanonicalObjectReader { // // public Object getPropertyValue(Object obj, CDMProperty prop); // // public Object getPropertyValue(Object obj, RDMProperty prop); // // public Object getPropertyValue(Object obj, String propName); // } // Path: src/main/java/com/modelsolv/kaboom/object/beanImpl/CanonicalObjectBeanReader.java import com.modelsolv.kaboom.object.CanonicalObjectReader; import org.apache.commons.beanutils.PropertyUtils; import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.resource.RDMProperty; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.object.beanImpl; /** * A wrapper around a Java Bean that exposes the CanonicalObject interface. * Accesses properties reflectively, and adapts references recursively. * * @author Ted * */ public class CanonicalObjectBeanReader implements CanonicalObjectReader { @Override public Object getPropertyValue(Object obj, RDMProperty prop) { return getPropertyValue(obj, prop.getName()); } @Override
public Object getPropertyValue(Object obj, CDMProperty prop) {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/NativeRDMFactory.java // public class NativeRDMFactory implements RDMFactory { // // @Override // public RDMPrimitiveProperty createRDMPrimitiveProperty( // CDMPrimitiveProperty cdmProperty) { // return new RDMPrimitivePropertyImpl(cdmProperty); // } // // @Override // public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty) { // return new ReferenceLinkImpl(cdmProperty); // } // // @Override // public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty) { // return new ReferenceEmbedImpl(cdmProperty); // } // // @Override // public ResourceDataModel createResourceDataModel(CanonicalDataType cdt) { // return new ResourceDataModelImpl(cdt); // } // // @Override // public ObjectResource createObjectResource(Object canonicalObject, URI uri, // ObjectResourceDefinition definition) { // return new ObjectResourceImpl(canonicalObject, uri, definition); // } // // @Override // public ObjectResourceDefinition createObjectResourceDefinition( // String uriTemplate, ResourceDataModel rdm) { // return new ObjectResourceDefinitionImpl(uriTemplate, rdm); // } // // }
import java.net.URI; import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.nativeImpl.NativeRDMFactory;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface RDMFactory { public static RDMFactory INSTANCE = new NativeRDMFactory(); public RDMPrimitiveProperty createRDMPrimitiveProperty(
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/NativeRDMFactory.java // public class NativeRDMFactory implements RDMFactory { // // @Override // public RDMPrimitiveProperty createRDMPrimitiveProperty( // CDMPrimitiveProperty cdmProperty) { // return new RDMPrimitivePropertyImpl(cdmProperty); // } // // @Override // public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty) { // return new ReferenceLinkImpl(cdmProperty); // } // // @Override // public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty) { // return new ReferenceEmbedImpl(cdmProperty); // } // // @Override // public ResourceDataModel createResourceDataModel(CanonicalDataType cdt) { // return new ResourceDataModelImpl(cdt); // } // // @Override // public ObjectResource createObjectResource(Object canonicalObject, URI uri, // ObjectResourceDefinition definition) { // return new ObjectResourceImpl(canonicalObject, uri, definition); // } // // @Override // public ObjectResourceDefinition createObjectResourceDefinition( // String uriTemplate, ResourceDataModel rdm) { // return new ObjectResourceDefinitionImpl(uriTemplate, rdm); // } // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java import java.net.URI; import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.nativeImpl.NativeRDMFactory; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface RDMFactory { public static RDMFactory INSTANCE = new NativeRDMFactory(); public RDMPrimitiveProperty createRDMPrimitiveProperty(
CDMPrimitiveProperty cdmProperty);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/NativeRDMFactory.java // public class NativeRDMFactory implements RDMFactory { // // @Override // public RDMPrimitiveProperty createRDMPrimitiveProperty( // CDMPrimitiveProperty cdmProperty) { // return new RDMPrimitivePropertyImpl(cdmProperty); // } // // @Override // public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty) { // return new ReferenceLinkImpl(cdmProperty); // } // // @Override // public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty) { // return new ReferenceEmbedImpl(cdmProperty); // } // // @Override // public ResourceDataModel createResourceDataModel(CanonicalDataType cdt) { // return new ResourceDataModelImpl(cdt); // } // // @Override // public ObjectResource createObjectResource(Object canonicalObject, URI uri, // ObjectResourceDefinition definition) { // return new ObjectResourceImpl(canonicalObject, uri, definition); // } // // @Override // public ObjectResourceDefinition createObjectResourceDefinition( // String uriTemplate, ResourceDataModel rdm) { // return new ObjectResourceDefinitionImpl(uriTemplate, rdm); // } // // }
import java.net.URI; import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.nativeImpl.NativeRDMFactory;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface RDMFactory { public static RDMFactory INSTANCE = new NativeRDMFactory(); public RDMPrimitiveProperty createRDMPrimitiveProperty( CDMPrimitiveProperty cdmProperty);
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/NativeRDMFactory.java // public class NativeRDMFactory implements RDMFactory { // // @Override // public RDMPrimitiveProperty createRDMPrimitiveProperty( // CDMPrimitiveProperty cdmProperty) { // return new RDMPrimitivePropertyImpl(cdmProperty); // } // // @Override // public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty) { // return new ReferenceLinkImpl(cdmProperty); // } // // @Override // public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty) { // return new ReferenceEmbedImpl(cdmProperty); // } // // @Override // public ResourceDataModel createResourceDataModel(CanonicalDataType cdt) { // return new ResourceDataModelImpl(cdt); // } // // @Override // public ObjectResource createObjectResource(Object canonicalObject, URI uri, // ObjectResourceDefinition definition) { // return new ObjectResourceImpl(canonicalObject, uri, definition); // } // // @Override // public ObjectResourceDefinition createObjectResourceDefinition( // String uriTemplate, ResourceDataModel rdm) { // return new ObjectResourceDefinitionImpl(uriTemplate, rdm); // } // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java import java.net.URI; import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.nativeImpl.NativeRDMFactory; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface RDMFactory { public static RDMFactory INSTANCE = new NativeRDMFactory(); public RDMPrimitiveProperty createRDMPrimitiveProperty( CDMPrimitiveProperty cdmProperty);
public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/NativeRDMFactory.java // public class NativeRDMFactory implements RDMFactory { // // @Override // public RDMPrimitiveProperty createRDMPrimitiveProperty( // CDMPrimitiveProperty cdmProperty) { // return new RDMPrimitivePropertyImpl(cdmProperty); // } // // @Override // public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty) { // return new ReferenceLinkImpl(cdmProperty); // } // // @Override // public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty) { // return new ReferenceEmbedImpl(cdmProperty); // } // // @Override // public ResourceDataModel createResourceDataModel(CanonicalDataType cdt) { // return new ResourceDataModelImpl(cdt); // } // // @Override // public ObjectResource createObjectResource(Object canonicalObject, URI uri, // ObjectResourceDefinition definition) { // return new ObjectResourceImpl(canonicalObject, uri, definition); // } // // @Override // public ObjectResourceDefinition createObjectResourceDefinition( // String uriTemplate, ResourceDataModel rdm) { // return new ObjectResourceDefinitionImpl(uriTemplate, rdm); // } // // }
import java.net.URI; import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.nativeImpl.NativeRDMFactory;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface RDMFactory { public static RDMFactory INSTANCE = new NativeRDMFactory(); public RDMPrimitiveProperty createRDMPrimitiveProperty( CDMPrimitiveProperty cdmProperty); public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty); public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty);
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMPrimitiveProperty.java // public interface CDMPrimitiveProperty extends CDMProperty, ReadableCDMPrimitiveProperty { // // public void setType(PrimitiveDataType type); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/NativeRDMFactory.java // public class NativeRDMFactory implements RDMFactory { // // @Override // public RDMPrimitiveProperty createRDMPrimitiveProperty( // CDMPrimitiveProperty cdmProperty) { // return new RDMPrimitivePropertyImpl(cdmProperty); // } // // @Override // public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty) { // return new ReferenceLinkImpl(cdmProperty); // } // // @Override // public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty) { // return new ReferenceEmbedImpl(cdmProperty); // } // // @Override // public ResourceDataModel createResourceDataModel(CanonicalDataType cdt) { // return new ResourceDataModelImpl(cdt); // } // // @Override // public ObjectResource createObjectResource(Object canonicalObject, URI uri, // ObjectResourceDefinition definition) { // return new ObjectResourceImpl(canonicalObject, uri, definition); // } // // @Override // public ObjectResourceDefinition createObjectResourceDefinition( // String uriTemplate, ResourceDataModel rdm) { // return new ObjectResourceDefinitionImpl(uriTemplate, rdm); // } // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMFactory.java import java.net.URI; import com.modelsolv.kaboom.model.canonical.CDMPrimitiveProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.nativeImpl.NativeRDMFactory; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource; public interface RDMFactory { public static RDMFactory INSTANCE = new NativeRDMFactory(); public RDMPrimitiveProperty createRDMPrimitiveProperty( CDMPrimitiveProperty cdmProperty); public ReferenceLink createReferenceLink(CDMReferenceProperty cdmProperty); public ReferenceEmbed createReferenceEmbed(CDMReferenceProperty cdmProperty);
public ResourceDataModel createResourceDataModel(CanonicalDataType cdt);
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/RDMPropertyImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // }
import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.resource.RDMProperty;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public abstract class RDMPropertyImpl implements RDMProperty { private CDMProperty cdmProperty; protected RDMPropertyImpl(CDMProperty property) { setCDMProperty(property); } @Override
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/Cardinality.java // public enum Cardinality { // ONE, ZERO_OR_ONE, ONE_OR_MORE, ZERO_OR_MORE // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/RDMPropertyImpl.java import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.Cardinality; import com.modelsolv.kaboom.model.resource.RDMProperty; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public abstract class RDMPropertyImpl implements RDMProperty { private CDMProperty cdmProperty; protected RDMPropertyImpl(CDMProperty property) { setCDMProperty(property); } @Override
public Cardinality getCardinality() {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ReferenceLinkImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ReferenceLink.java // public interface ReferenceLink extends RDMReferenceProperty { // // /** // * The list of included "decorator" properties included in the // * ReferenceLink. These may be defined directly in the ReferenceLink, or in // * a named LinkDescriptor. // * // * @return // */ // public Iterable<RDMProperty> getIncludedProperties(); // // public ReferenceLink includingProperties(CDMProperty... properties); // // public ReferenceLink includingProperties(String... properties); // // /** // * Return true if the ReferenceLink has one or more included properties. // */ // public boolean isDecorated(); // // /** // * // * @return the Link Relation if specified, otherwise null // */ // public String getLinkRelation(); // // public void setLinkRelation(String linkRelation); // // public ReferenceLink withLinkRelation(String linkRelation); // // /** // * The target resource of the link. Will be the default resource for the // * referenced data type, unless it's overridden in the ReferenceLink // * definition. // * // * @return // */ // public ObjectResourceDefinition getTargetResourceDefinition(); // // public void setTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // public ReferenceLink withTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // }
import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMProperty; import com.modelsolv.kaboom.model.resource.ReferenceLink;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ReferenceLinkImpl extends RDMReferencePropertyImpl implements ReferenceLink { private RDMPropertyCollection includedProperties = new RDMPropertyCollection(); private String linkRelation;
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ReferenceLink.java // public interface ReferenceLink extends RDMReferenceProperty { // // /** // * The list of included "decorator" properties included in the // * ReferenceLink. These may be defined directly in the ReferenceLink, or in // * a named LinkDescriptor. // * // * @return // */ // public Iterable<RDMProperty> getIncludedProperties(); // // public ReferenceLink includingProperties(CDMProperty... properties); // // public ReferenceLink includingProperties(String... properties); // // /** // * Return true if the ReferenceLink has one or more included properties. // */ // public boolean isDecorated(); // // /** // * // * @return the Link Relation if specified, otherwise null // */ // public String getLinkRelation(); // // public void setLinkRelation(String linkRelation); // // public ReferenceLink withLinkRelation(String linkRelation); // // /** // * The target resource of the link. Will be the default resource for the // * referenced data type, unless it's overridden in the ReferenceLink // * definition. // * // * @return // */ // public ObjectResourceDefinition getTargetResourceDefinition(); // // public void setTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // public ReferenceLink withTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ReferenceLinkImpl.java import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMProperty; import com.modelsolv.kaboom.model.resource.ReferenceLink; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ReferenceLinkImpl extends RDMReferencePropertyImpl implements ReferenceLink { private RDMPropertyCollection includedProperties = new RDMPropertyCollection(); private String linkRelation;
private ObjectResourceDefinition targetResource;
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ReferenceLinkImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ReferenceLink.java // public interface ReferenceLink extends RDMReferenceProperty { // // /** // * The list of included "decorator" properties included in the // * ReferenceLink. These may be defined directly in the ReferenceLink, or in // * a named LinkDescriptor. // * // * @return // */ // public Iterable<RDMProperty> getIncludedProperties(); // // public ReferenceLink includingProperties(CDMProperty... properties); // // public ReferenceLink includingProperties(String... properties); // // /** // * Return true if the ReferenceLink has one or more included properties. // */ // public boolean isDecorated(); // // /** // * // * @return the Link Relation if specified, otherwise null // */ // public String getLinkRelation(); // // public void setLinkRelation(String linkRelation); // // public ReferenceLink withLinkRelation(String linkRelation); // // /** // * The target resource of the link. Will be the default resource for the // * referenced data type, unless it's overridden in the ReferenceLink // * definition. // * // * @return // */ // public ObjectResourceDefinition getTargetResourceDefinition(); // // public void setTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // public ReferenceLink withTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // }
import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMProperty; import com.modelsolv.kaboom.model.resource.ReferenceLink;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ReferenceLinkImpl extends RDMReferencePropertyImpl implements ReferenceLink { private RDMPropertyCollection includedProperties = new RDMPropertyCollection(); private String linkRelation; private ObjectResourceDefinition targetResource;
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ReferenceLink.java // public interface ReferenceLink extends RDMReferenceProperty { // // /** // * The list of included "decorator" properties included in the // * ReferenceLink. These may be defined directly in the ReferenceLink, or in // * a named LinkDescriptor. // * // * @return // */ // public Iterable<RDMProperty> getIncludedProperties(); // // public ReferenceLink includingProperties(CDMProperty... properties); // // public ReferenceLink includingProperties(String... properties); // // /** // * Return true if the ReferenceLink has one or more included properties. // */ // public boolean isDecorated(); // // /** // * // * @return the Link Relation if specified, otherwise null // */ // public String getLinkRelation(); // // public void setLinkRelation(String linkRelation); // // public ReferenceLink withLinkRelation(String linkRelation); // // /** // * The target resource of the link. Will be the default resource for the // * referenced data type, unless it's overridden in the ReferenceLink // * definition. // * // * @return // */ // public ObjectResourceDefinition getTargetResourceDefinition(); // // public void setTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // public ReferenceLink withTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ReferenceLinkImpl.java import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMProperty; import com.modelsolv.kaboom.model.resource.ReferenceLink; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ReferenceLinkImpl extends RDMReferencePropertyImpl implements ReferenceLink { private RDMPropertyCollection includedProperties = new RDMPropertyCollection(); private String linkRelation; private ObjectResourceDefinition targetResource;
public ReferenceLinkImpl(CDMReferenceProperty property) {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ReferenceLinkImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ReferenceLink.java // public interface ReferenceLink extends RDMReferenceProperty { // // /** // * The list of included "decorator" properties included in the // * ReferenceLink. These may be defined directly in the ReferenceLink, or in // * a named LinkDescriptor. // * // * @return // */ // public Iterable<RDMProperty> getIncludedProperties(); // // public ReferenceLink includingProperties(CDMProperty... properties); // // public ReferenceLink includingProperties(String... properties); // // /** // * Return true if the ReferenceLink has one or more included properties. // */ // public boolean isDecorated(); // // /** // * // * @return the Link Relation if specified, otherwise null // */ // public String getLinkRelation(); // // public void setLinkRelation(String linkRelation); // // public ReferenceLink withLinkRelation(String linkRelation); // // /** // * The target resource of the link. Will be the default resource for the // * referenced data type, unless it's overridden in the ReferenceLink // * definition. // * // * @return // */ // public ObjectResourceDefinition getTargetResourceDefinition(); // // public void setTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // public ReferenceLink withTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // }
import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMProperty; import com.modelsolv.kaboom.model.resource.ReferenceLink;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ReferenceLinkImpl extends RDMReferencePropertyImpl implements ReferenceLink { private RDMPropertyCollection includedProperties = new RDMPropertyCollection(); private String linkRelation; private ObjectResourceDefinition targetResource; public ReferenceLinkImpl(CDMReferenceProperty property) { super(property); } @Override
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ReferenceLink.java // public interface ReferenceLink extends RDMReferenceProperty { // // /** // * The list of included "decorator" properties included in the // * ReferenceLink. These may be defined directly in the ReferenceLink, or in // * a named LinkDescriptor. // * // * @return // */ // public Iterable<RDMProperty> getIncludedProperties(); // // public ReferenceLink includingProperties(CDMProperty... properties); // // public ReferenceLink includingProperties(String... properties); // // /** // * Return true if the ReferenceLink has one or more included properties. // */ // public boolean isDecorated(); // // /** // * // * @return the Link Relation if specified, otherwise null // */ // public String getLinkRelation(); // // public void setLinkRelation(String linkRelation); // // public ReferenceLink withLinkRelation(String linkRelation); // // /** // * The target resource of the link. Will be the default resource for the // * referenced data type, unless it's overridden in the ReferenceLink // * definition. // * // * @return // */ // public ObjectResourceDefinition getTargetResourceDefinition(); // // public void setTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // public ReferenceLink withTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ReferenceLinkImpl.java import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMProperty; import com.modelsolv.kaboom.model.resource.ReferenceLink; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ReferenceLinkImpl extends RDMReferencePropertyImpl implements ReferenceLink { private RDMPropertyCollection includedProperties = new RDMPropertyCollection(); private String linkRelation; private ObjectResourceDefinition targetResource; public ReferenceLinkImpl(CDMReferenceProperty property) { super(property); } @Override
public Iterable<RDMProperty> getIncludedProperties() {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ReferenceLinkImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ReferenceLink.java // public interface ReferenceLink extends RDMReferenceProperty { // // /** // * The list of included "decorator" properties included in the // * ReferenceLink. These may be defined directly in the ReferenceLink, or in // * a named LinkDescriptor. // * // * @return // */ // public Iterable<RDMProperty> getIncludedProperties(); // // public ReferenceLink includingProperties(CDMProperty... properties); // // public ReferenceLink includingProperties(String... properties); // // /** // * Return true if the ReferenceLink has one or more included properties. // */ // public boolean isDecorated(); // // /** // * // * @return the Link Relation if specified, otherwise null // */ // public String getLinkRelation(); // // public void setLinkRelation(String linkRelation); // // public ReferenceLink withLinkRelation(String linkRelation); // // /** // * The target resource of the link. Will be the default resource for the // * referenced data type, unless it's overridden in the ReferenceLink // * definition. // * // * @return // */ // public ObjectResourceDefinition getTargetResourceDefinition(); // // public void setTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // public ReferenceLink withTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // }
import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMProperty; import com.modelsolv.kaboom.model.resource.ReferenceLink;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ReferenceLinkImpl extends RDMReferencePropertyImpl implements ReferenceLink { private RDMPropertyCollection includedProperties = new RDMPropertyCollection(); private String linkRelation; private ObjectResourceDefinition targetResource; public ReferenceLinkImpl(CDMReferenceProperty property) { super(property); } @Override public Iterable<RDMProperty> getIncludedProperties() { return includedProperties; } @Override public String getLinkRelation() { return linkRelation; } @Override
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMProperty.java // public interface CDMProperty extends ReadableCDMProperty { // // public void setName(String name); // // public void setCardinality(Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ObjectResourceDefinition.java // public interface ObjectResourceDefinition extends ResourceDefinition { // // // write-once properties, should be passed in ctor // public String getURITemplate(); // // /** // * @return the ResourceDataModel bound to this class of resources. // */ // public ResourceDataModel getResourceDataModel(); // // // read-writable properties // // public String getName(); // // public void setName(String name); // // public ObjectResourceDefinition withName(String name); // // public void bindTemplateParameter(String parameter, CDMProperty property); // // public ObjectResourceDefinition withTemplateParameter(String parameter, CDMProperty property); // // /** // * Factory method to create or retrieve an individual Resource bound to the // * canonicalObject. The canonicalObject must confirm to the // * ResourceDataModel. This method is responsible for populating the resource // * URI and any other required properties of the Resource. // * // * @param canonicalObject // * @return // */ // public ObjectResource getResource(Object canonicalObject, CanonicalObjectReader reader); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMProperty.java // public interface RDMProperty extends ReadableCDMProperty { // // public CDMProperty getCDMProperty(); // // public void setCDMProperty(CDMProperty property); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/ReferenceLink.java // public interface ReferenceLink extends RDMReferenceProperty { // // /** // * The list of included "decorator" properties included in the // * ReferenceLink. These may be defined directly in the ReferenceLink, or in // * a named LinkDescriptor. // * // * @return // */ // public Iterable<RDMProperty> getIncludedProperties(); // // public ReferenceLink includingProperties(CDMProperty... properties); // // public ReferenceLink includingProperties(String... properties); // // /** // * Return true if the ReferenceLink has one or more included properties. // */ // public boolean isDecorated(); // // /** // * // * @return the Link Relation if specified, otherwise null // */ // public String getLinkRelation(); // // public void setLinkRelation(String linkRelation); // // public ReferenceLink withLinkRelation(String linkRelation); // // /** // * The target resource of the link. Will be the default resource for the // * referenced data type, unless it's overridden in the ReferenceLink // * definition. // * // * @return // */ // public ObjectResourceDefinition getTargetResourceDefinition(); // // public void setTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // public ReferenceLink withTargetResourceDefinition(ObjectResourceDefinition resourceDef); // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/ReferenceLinkImpl.java import com.modelsolv.kaboom.model.canonical.CDMProperty; import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.resource.ObjectResourceDefinition; import com.modelsolv.kaboom.model.resource.RDMProperty; import com.modelsolv.kaboom.model.resource.ReferenceLink; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class ReferenceLinkImpl extends RDMReferencePropertyImpl implements ReferenceLink { private RDMPropertyCollection includedProperties = new RDMPropertyCollection(); private String linkRelation; private ObjectResourceDefinition targetResource; public ReferenceLinkImpl(CDMReferenceProperty property) { super(property); } @Override public Iterable<RDMProperty> getIncludedProperties() { return includedProperties; } @Override public String getLinkRelation() { return linkRelation; } @Override
public ReferenceLink includingProperties(CDMProperty... properties) {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/RDMReferencePropertyImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMReferenceProperty.java // public interface RDMReferenceProperty extends RDMProperty, ReadableCDMReferenceProperty { // // @Override // public CDMReferenceProperty getCDMProperty(); // // }
import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.RDMReferenceProperty;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class RDMReferencePropertyImpl extends RDMPropertyImpl implements RDMReferenceProperty {
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMReferenceProperty.java // public interface RDMReferenceProperty extends RDMProperty, ReadableCDMReferenceProperty { // // @Override // public CDMReferenceProperty getCDMProperty(); // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/RDMReferencePropertyImpl.java import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.RDMReferenceProperty; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class RDMReferencePropertyImpl extends RDMPropertyImpl implements RDMReferenceProperty {
public RDMReferencePropertyImpl(CDMReferenceProperty cdmProperty) {
ModelSolv/Kaboom
src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/RDMReferencePropertyImpl.java
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMReferenceProperty.java // public interface RDMReferenceProperty extends RDMProperty, ReadableCDMReferenceProperty { // // @Override // public CDMReferenceProperty getCDMProperty(); // // }
import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.RDMReferenceProperty;
/******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class RDMReferencePropertyImpl extends RDMPropertyImpl implements RDMReferenceProperty { public RDMReferencePropertyImpl(CDMReferenceProperty cdmProperty) { super(cdmProperty); } @Override
// Path: src/main/java/com/modelsolv/kaboom/model/canonical/CDMReferenceProperty.java // public interface CDMReferenceProperty extends CDMProperty, ReadableCDMReferenceProperty { // // public void setTargetDataType(CanonicalDataType type); // // public CDMReferenceProperty withTargetDataType(CanonicalDataType type); // // public void setInverseProperty(CDMReferenceProperty inverse); // // public CDMReferenceProperty withInverseProperty(CDMReferenceProperty inverse); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/canonical/CanonicalDataType.java // public interface CanonicalDataType { // // public String getName(); // // public void setName(String name); // // public Iterable<CDMProperty> getProperties(); // // public CDMProperty getProperty(String propName); // // public boolean hasProperty(CDMProperty property); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type); // // public CanonicalDataType withPrimitive(String name, PrimitiveDataType type, Cardinality cardinality); // // public CanonicalDataType withReference(String name, CanonicalDataType type); // // public CanonicalDataType withReference(String name, CanonicalDataType type, Cardinality cardinality); // // } // // Path: src/main/java/com/modelsolv/kaboom/model/resource/RDMReferenceProperty.java // public interface RDMReferenceProperty extends RDMProperty, ReadableCDMReferenceProperty { // // @Override // public CDMReferenceProperty getCDMProperty(); // // } // Path: src/main/java/com/modelsolv/kaboom/model/resource/nativeImpl/RDMReferencePropertyImpl.java import com.modelsolv.kaboom.model.canonical.CDMReferenceProperty; import com.modelsolv.kaboom.model.canonical.CanonicalDataType; import com.modelsolv.kaboom.model.resource.RDMReferenceProperty; /******************************************************************************* * Copyright (c) 2014 ModelSolv, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * ModelSolv, Inc. - initial API and implementation. *******************************************************************************/ package com.modelsolv.kaboom.model.resource.nativeImpl; public class RDMReferencePropertyImpl extends RDMPropertyImpl implements RDMReferenceProperty { public RDMReferencePropertyImpl(CDMReferenceProperty cdmProperty) { super(cdmProperty); } @Override
public CanonicalDataType getTargetDataType() {
Genymobile/gnirehtet
relay-java/src/main/java/com/genymobile/gnirehtet/AdbMonitor.java
// Path: relay-java/src/main/java/com/genymobile/gnirehtet/relay/Log.java // public final class Log { // // enum Level { // VERBOSE("V"), // DEBUG("D"), // INFO("I"), // WARNING("W"), // ERROR("E"); // // private final String id; // // Level(String id) { // this.id = id; // } // } // // private static Level threshold = Level.INFO; // // private static final DateFormat FORMAT = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss.SSS"); // private static final Date DATE = new Date(); // // private Log() { // // not instantiable // } // // public static Level getThreshold() { // return threshold; // } // // public static void setThreshold(Level threshold) { // Log.threshold = threshold; // } // // public static boolean isEnabled(Level level) { // return level.ordinal() >= threshold.ordinal(); // } // // public static boolean isVerboseEnabled() { // return isEnabled(Level.VERBOSE); // } // // public static boolean isDebugEnabled() { // return isEnabled(Level.DEBUG); // } // // public static boolean isInfoEnabled() { // return isEnabled(Level.INFO); // } // // public static boolean isWarningEnabled() { // return isEnabled(Level.WARNING); // } // // public static boolean isErrorEnabled() { // return isEnabled(Level.ERROR); // } // // private static String getDate() { // DATE.setTime(System.currentTimeMillis()); // return FORMAT.format(DATE); // } // // private static String format(Level level, String tag, String message) { // return getDate() + " " + level.id + " " + tag + ": " + message; // } // // private static void l(Level level, PrintStream stream, String tag, String message, Throwable e) { // if (isEnabled(level)) { // stream.println(format(level, tag, message)); // if (e != null) { // e.printStackTrace(); // } // } // } // // public static void v(String tag, String message, Throwable e) { // l(Level.VERBOSE, System.out, tag, message, e); // } // // public static void v(String tag, String message) { // v(tag, message, null); // } // // public static void d(String tag, String message, Throwable e) { // l(Level.DEBUG, System.out, tag, message, e); // } // // public static void d(String tag, String message) { // d(tag, message, null); // } // // public static void i(String tag, String message, Throwable e) { // l(Level.INFO, System.out, tag, message, e); // } // // public static void i(String tag, String message) { // i(tag, message, null); // } // // public static void w(String tag, String message, Throwable e) { // l(Level.WARNING, System.out, tag, message, e); // } // // public static void w(String tag, String message) { // w(tag, message, null); // } // // public static void e(String tag, String message, Throwable e) { // l(Level.ERROR, System.err, tag, message, e); // } // // public static void e(String tag, String message) { // e(tag, message, null); // } // }
import com.genymobile.gnirehtet.relay.Log; import java.io.EOFException; import java.io.IOException; import java.net.Inet4Address; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.ByteChannel; import java.nio.channels.ReadableByteChannel; import java.nio.channels.SocketChannel; import java.nio.channels.WritableByteChannel; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List;
/* * Copyright (C) 2017 Genymobile * * 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.genymobile.gnirehtet; public class AdbMonitor { public interface AdbDevicesCallback { void onNewDeviceConnected(String serial); } private static final String TAG = AdbMonitor.class.getSimpleName(); private static final int ADBD_PORT = 5037; private static final String TRACK_DEVICES_REQUEST = "0012host:track-devices"; private static final int BUFFER_SIZE = 1024; private static final int LENGTH_FIELD_SIZE = 4; private static final int OKAY_SIZE = 4; private static final long RETRY_DELAY_ADB_DAEMON_OK = 1000; private static final long RETRY_DELAY_ADB_DAEMON_KO = 5000; private List<String> connectedDevices = new ArrayList<>(); private AdbDevicesCallback callback; private static final byte[] BUFFER = new byte[BUFFER_SIZE]; // used only locally to avoid allocations, so static is ok private final ByteBuffer socketBuffer = ByteBuffer.allocate(BUFFER_SIZE); public AdbMonitor(AdbDevicesCallback callback) { this.callback = callback; } public void monitor() { while (true) { try { trackDevices(); } catch (Exception e) {
// Path: relay-java/src/main/java/com/genymobile/gnirehtet/relay/Log.java // public final class Log { // // enum Level { // VERBOSE("V"), // DEBUG("D"), // INFO("I"), // WARNING("W"), // ERROR("E"); // // private final String id; // // Level(String id) { // this.id = id; // } // } // // private static Level threshold = Level.INFO; // // private static final DateFormat FORMAT = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss.SSS"); // private static final Date DATE = new Date(); // // private Log() { // // not instantiable // } // // public static Level getThreshold() { // return threshold; // } // // public static void setThreshold(Level threshold) { // Log.threshold = threshold; // } // // public static boolean isEnabled(Level level) { // return level.ordinal() >= threshold.ordinal(); // } // // public static boolean isVerboseEnabled() { // return isEnabled(Level.VERBOSE); // } // // public static boolean isDebugEnabled() { // return isEnabled(Level.DEBUG); // } // // public static boolean isInfoEnabled() { // return isEnabled(Level.INFO); // } // // public static boolean isWarningEnabled() { // return isEnabled(Level.WARNING); // } // // public static boolean isErrorEnabled() { // return isEnabled(Level.ERROR); // } // // private static String getDate() { // DATE.setTime(System.currentTimeMillis()); // return FORMAT.format(DATE); // } // // private static String format(Level level, String tag, String message) { // return getDate() + " " + level.id + " " + tag + ": " + message; // } // // private static void l(Level level, PrintStream stream, String tag, String message, Throwable e) { // if (isEnabled(level)) { // stream.println(format(level, tag, message)); // if (e != null) { // e.printStackTrace(); // } // } // } // // public static void v(String tag, String message, Throwable e) { // l(Level.VERBOSE, System.out, tag, message, e); // } // // public static void v(String tag, String message) { // v(tag, message, null); // } // // public static void d(String tag, String message, Throwable e) { // l(Level.DEBUG, System.out, tag, message, e); // } // // public static void d(String tag, String message) { // d(tag, message, null); // } // // public static void i(String tag, String message, Throwable e) { // l(Level.INFO, System.out, tag, message, e); // } // // public static void i(String tag, String message) { // i(tag, message, null); // } // // public static void w(String tag, String message, Throwable e) { // l(Level.WARNING, System.out, tag, message, e); // } // // public static void w(String tag, String message) { // w(tag, message, null); // } // // public static void e(String tag, String message, Throwable e) { // l(Level.ERROR, System.err, tag, message, e); // } // // public static void e(String tag, String message) { // e(tag, message, null); // } // } // Path: relay-java/src/main/java/com/genymobile/gnirehtet/AdbMonitor.java import com.genymobile.gnirehtet.relay.Log; import java.io.EOFException; import java.io.IOException; import java.net.Inet4Address; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.ByteChannel; import java.nio.channels.ReadableByteChannel; import java.nio.channels.SocketChannel; import java.nio.channels.WritableByteChannel; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; /* * Copyright (C) 2017 Genymobile * * 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.genymobile.gnirehtet; public class AdbMonitor { public interface AdbDevicesCallback { void onNewDeviceConnected(String serial); } private static final String TAG = AdbMonitor.class.getSimpleName(); private static final int ADBD_PORT = 5037; private static final String TRACK_DEVICES_REQUEST = "0012host:track-devices"; private static final int BUFFER_SIZE = 1024; private static final int LENGTH_FIELD_SIZE = 4; private static final int OKAY_SIZE = 4; private static final long RETRY_DELAY_ADB_DAEMON_OK = 1000; private static final long RETRY_DELAY_ADB_DAEMON_KO = 5000; private List<String> connectedDevices = new ArrayList<>(); private AdbDevicesCallback callback; private static final byte[] BUFFER = new byte[BUFFER_SIZE]; // used only locally to avoid allocations, so static is ok private final ByteBuffer socketBuffer = ByteBuffer.allocate(BUFFER_SIZE); public AdbMonitor(AdbDevicesCallback callback) { this.callback = callback; } public void monitor() { while (true) { try { trackDevices(); } catch (Exception e) {
Log.e(TAG, "Failed to monitor adb devices", e);
oskopek/StudyGuide
src/main/java/com/oskopek/studyguide/constraint/event/StringMessageEvent.java
// Path: src/main/java/com/oskopek/studyguide/constraint/Constraint.java // @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME) // @JsonSubTypes({@JsonSubTypes.Type(value = CourseEnrollmentCorequisiteConstraint.class, // name = "CourseEnrollmentCorequisiteConstraint"), // @JsonSubTypes.Type(value = CourseEnrollmentEnrolledInConstraint.class, // name = "CourseEnrollmentEnrolledInConstraint"), // @JsonSubTypes.Type(value = CourseEnrollmentPrerequisiteConstraint.class, // name = "CourseEnrollmentPrerequisiteConstraint"), // @JsonSubTypes.Type(value = CourseGroupCreditsPercentageConstraint.class, // name = "CourseGroupCreditsPercentageConstraint"), // @JsonSubTypes.Type(value = CourseGroupCreditsSumConstraint.class, // name = "CourseGroupCreditsSumConstraint"), // @JsonSubTypes.Type(value = CourseGroupFulfilledAllConstraint.class, // name = "CourseGroupFulfilledAllConstraint"), // @JsonSubTypes.Type(value = GlobalCourseMaxFulfilledConstraint.class, // name = "GlobalCourseMaxFulfilledConstraint"), // @JsonSubTypes.Type(value = GlobalCourseRepeatedEnrollmentConstraint.class, // name = "GlobalCourseRepeatedEnrollmentConstraint"), // @JsonSubTypes.Type(value = GlobalCreditsSumConstraint.class, // name = "GlobalCreditsSumConstraint"), // @JsonSubTypes.Type(value = GlobalCreditsSumUntilSemesterConstraint.class, // name = "GlobalCreditsSumUntilSemesterConstraint"), // @JsonSubTypes.Type(value = GlobalLongStudyFeeConstraint.class, // name = "GlobalLongStudyFeeConstraint")}) // public interface Constraint { // // /** // * The method should verify if the given constraint was broken, and if so, // * call the {@link #fireBrokenEvent(String, Course)} with the specific reason. // */ // void validate(); // // /** // * Used for firing a broken constraint event if the constraint is broken. // * // * @param message the reason why the constraint is broken // * @param changed the course that triggered the constraint breakage // */ // void fireBrokenEvent(String message, Course changed); // // /** // * Used for firing a broken constraint event if the constraint is broken. // * // * @param message the reason why the constraint is broken // * @param changed the course enrollment that triggered the constraint breakage // */ // void fireBrokenEvent(String message, CourseEnrollment changed); // // /** // * Used for firing a fixed constraint event if the constraint is fixed. // * // * @param originallyBroken the originally broken (now fixed) constraint // */ // void fireFixedEvent(Constraint originallyBroken); // }
import com.oskopek.studyguide.constraint.Constraint; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import java.util.ResourceBundle;
package com.oskopek.studyguide.constraint.event; /** * Event with a message contained. Used for sending useful tooltip contents to the UI controllers do display to the * user. */ public abstract class StringMessageEvent { protected final transient ResourceBundle messages; private final String message;
// Path: src/main/java/com/oskopek/studyguide/constraint/Constraint.java // @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME) // @JsonSubTypes({@JsonSubTypes.Type(value = CourseEnrollmentCorequisiteConstraint.class, // name = "CourseEnrollmentCorequisiteConstraint"), // @JsonSubTypes.Type(value = CourseEnrollmentEnrolledInConstraint.class, // name = "CourseEnrollmentEnrolledInConstraint"), // @JsonSubTypes.Type(value = CourseEnrollmentPrerequisiteConstraint.class, // name = "CourseEnrollmentPrerequisiteConstraint"), // @JsonSubTypes.Type(value = CourseGroupCreditsPercentageConstraint.class, // name = "CourseGroupCreditsPercentageConstraint"), // @JsonSubTypes.Type(value = CourseGroupCreditsSumConstraint.class, // name = "CourseGroupCreditsSumConstraint"), // @JsonSubTypes.Type(value = CourseGroupFulfilledAllConstraint.class, // name = "CourseGroupFulfilledAllConstraint"), // @JsonSubTypes.Type(value = GlobalCourseMaxFulfilledConstraint.class, // name = "GlobalCourseMaxFulfilledConstraint"), // @JsonSubTypes.Type(value = GlobalCourseRepeatedEnrollmentConstraint.class, // name = "GlobalCourseRepeatedEnrollmentConstraint"), // @JsonSubTypes.Type(value = GlobalCreditsSumConstraint.class, // name = "GlobalCreditsSumConstraint"), // @JsonSubTypes.Type(value = GlobalCreditsSumUntilSemesterConstraint.class, // name = "GlobalCreditsSumUntilSemesterConstraint"), // @JsonSubTypes.Type(value = GlobalLongStudyFeeConstraint.class, // name = "GlobalLongStudyFeeConstraint")}) // public interface Constraint { // // /** // * The method should verify if the given constraint was broken, and if so, // * call the {@link #fireBrokenEvent(String, Course)} with the specific reason. // */ // void validate(); // // /** // * Used for firing a broken constraint event if the constraint is broken. // * // * @param message the reason why the constraint is broken // * @param changed the course that triggered the constraint breakage // */ // void fireBrokenEvent(String message, Course changed); // // /** // * Used for firing a broken constraint event if the constraint is broken. // * // * @param message the reason why the constraint is broken // * @param changed the course enrollment that triggered the constraint breakage // */ // void fireBrokenEvent(String message, CourseEnrollment changed); // // /** // * Used for firing a fixed constraint event if the constraint is fixed. // * // * @param originallyBroken the originally broken (now fixed) constraint // */ // void fireFixedEvent(Constraint originallyBroken); // } // Path: src/main/java/com/oskopek/studyguide/constraint/event/StringMessageEvent.java import com.oskopek.studyguide.constraint.Constraint; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import java.util.ResourceBundle; package com.oskopek.studyguide.constraint.event; /** * Event with a message contained. Used for sending useful tooltip contents to the UI controllers do display to the * user. */ public abstract class StringMessageEvent { protected final transient ResourceBundle messages; private final String message;
private final Constraint brokenConstraint;
oskopek/StudyGuide
src/main/java/com/oskopek/studyguide/view/StudyGuideApplication.java
// Path: src/main/java/com/oskopek/studyguide/model/StudyPlan.java // @JsonPropertyOrder({"courseRegistry", "semesterPlan", "constraints"}) // public interface StudyPlan { // // /** // * A registry of available {@link com.oskopek.studyguide.model.courses.Course}s. // * Not necessarily the only source of courses. // * // * @return may be null // */ // CourseRegistry getCourseRegistry(); // // /** // * Get the corresponding {@link SemesterPlan} instance. // * // * @return a non-null semester plan instance // */ // SemesterPlan getSemesterPlan(); // // /** // * The {@link com.oskopek.studyguide.constraint.Constraint}s placed on this plan. // * // * @return may be null // */ // Constraints getConstraints(); // // }
import com.oskopek.studyguide.model.StudyPlan; import com.oskopek.studyguide.weld.StartupStage; import javafx.animation.FadeTransition; import javafx.application.Application; import javafx.application.Platform; import javafx.beans.property.*; import javafx.beans.value.ObservableValue; import javafx.concurrent.Task; import javafx.concurrent.Worker; import javafx.geometry.Rectangle2D; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Screen; import javafx.stage.Stage; import javafx.stage.StageStyle; import org.apache.commons.validator.routines.UrlValidator; import org.jboss.weld.environment.se.Weld; import org.jboss.weld.environment.se.WeldContainer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.enterprise.util.AnnotationLiteral; import javax.inject.Singleton;
package com.oskopek.studyguide.view; /** * StudyGuide JavaFX main class. */ @Singleton public class StudyGuideApplication extends Application { private final String logoResource = "logo_64x64.png"; private final String logoResourceLarge = "logo_640x640.png"; private final transient Logger logger = LoggerFactory.getLogger(getClass());
// Path: src/main/java/com/oskopek/studyguide/model/StudyPlan.java // @JsonPropertyOrder({"courseRegistry", "semesterPlan", "constraints"}) // public interface StudyPlan { // // /** // * A registry of available {@link com.oskopek.studyguide.model.courses.Course}s. // * Not necessarily the only source of courses. // * // * @return may be null // */ // CourseRegistry getCourseRegistry(); // // /** // * Get the corresponding {@link SemesterPlan} instance. // * // * @return a non-null semester plan instance // */ // SemesterPlan getSemesterPlan(); // // /** // * The {@link com.oskopek.studyguide.constraint.Constraint}s placed on this plan. // * // * @return may be null // */ // Constraints getConstraints(); // // } // Path: src/main/java/com/oskopek/studyguide/view/StudyGuideApplication.java import com.oskopek.studyguide.model.StudyPlan; import com.oskopek.studyguide.weld.StartupStage; import javafx.animation.FadeTransition; import javafx.application.Application; import javafx.application.Platform; import javafx.beans.property.*; import javafx.beans.value.ObservableValue; import javafx.concurrent.Task; import javafx.concurrent.Worker; import javafx.geometry.Rectangle2D; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Screen; import javafx.stage.Stage; import javafx.stage.StageStyle; import org.apache.commons.validator.routines.UrlValidator; import org.jboss.weld.environment.se.Weld; import org.jboss.weld.environment.se.WeldContainer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.enterprise.util.AnnotationLiteral; import javax.inject.Singleton; package com.oskopek.studyguide.view; /** * StudyGuide JavaFX main class. */ @Singleton public class StudyGuideApplication extends Application { private final String logoResource = "logo_64x64.png"; private final String logoResourceLarge = "logo_640x640.png"; private final transient Logger logger = LoggerFactory.getLogger(getClass());
private final ObjectProperty<StudyPlan> studyPlan = new SimpleObjectProperty<>();
oskopek/StudyGuide
src/main/java/com/oskopek/studyguide/view/StudyGuideApplicationStarter.java
// Path: src/main/java/com/oskopek/studyguide/model/DefaultStudyPlan.java // public class DefaultStudyPlan implements StudyPlan { // // private final ObjectProperty<CourseRegistry> courseRegistry; // private final ObjectProperty<SemesterPlan> semesterPlan; // private final ObjectProperty<Constraints> constraints; // // /** // * Create an empty instance of a study plan. // */ // public DefaultStudyPlan() { // this.courseRegistry = new SimpleObjectProperty<>(new CourseRegistry()); // this.semesterPlan = new SimpleObjectProperty<>(new SemesterPlan()); // this.constraints = new SimpleObjectProperty<>(new Constraints()); // } // // @Override // public CourseRegistry getCourseRegistry() { // return courseRegistry.get(); // } // // /** // * Private setter for Jackson persistence. // * // * @param courseRegistry the {@link CourseRegistry} to set // */ // private void setCourseRegistry(CourseRegistry courseRegistry) { // this.courseRegistry.set(courseRegistry); // } // // @Override // public SemesterPlan getSemesterPlan() { // return semesterPlan.get(); // } // // /** // * Private setter for Jackson persistence. // * // * @param semesterPlan the {@link SemesterPlan} to set // */ // private void setSemesterPlan(SemesterPlan semesterPlan) { // this.semesterPlan.set(semesterPlan); // } // // @Override // public Constraints getConstraints() { // return constraints.get(); // } // // /** // * Private setter for Jackson persistence. // * // * @param constraints the {@link Constraints} to set // */ // private void setConstraints(Constraints constraints) { // this.constraints.set(constraints); // } // // /** // * The JavaFX property for {@link #getSemesterPlan()}. // * // * @return the property of {@link #getSemesterPlan()} // */ // public ObjectProperty<SemesterPlan> semesterPlanProperty() { // return semesterPlan; // } // // /** // * The JavaFX property for {@link #getConstraints()}. // * // * @return the property of {@link #getConstraints()} // */ // public ObjectProperty<Constraints> constraintsProperty() { // return constraints; // } // // /** // * The JavaFX property for {@link #getCourseRegistry()}. // * // * @return the property of {@link #getCourseRegistry()} // */ // public ObjectProperty<CourseRegistry> courseRegistryProperty() { // return courseRegistry; // } // // /** // * Remove a course from the course registry. Remove all associated course enrollment constraints and // * remove the course from all course groups in course group constraints. Does <strong>not</strong> remove // * the course from global constraints! // * // * @param toRemove the course to remove // */ // public void removeCourse(Course toRemove) { // getCourseRegistry().removeCourse(toRemove); // List<CourseEnrollment> enrollmentList = getSemesterPlan().allCourseEnrollments() // .filter(ce -> ce.getCourse().equals(toRemove)).collect(Collectors.toList()); // for (CourseEnrollment enrollment : enrollmentList) { // enrollment.getSemester().removeCourseEnrollment(enrollment); // } // getConstraints().getCourseGroupConstraintList().stream().map(cgc -> cgc.getCourseGroup().courseListProperty()) // .forEach(cl -> cl.remove(toRemove)); // getConstraints().removeAllCourseEnrollmentConstraints(enrollmentList); // getConstraints().recheckAll(); // // } // // @Override // public int hashCode() { // return new HashCodeBuilder(17, 37).append(getSemesterPlan()).append(getConstraints()) // .append(getCourseRegistry()).toHashCode(); // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (!(o instanceof DefaultStudyPlan)) { // return false; // } // DefaultStudyPlan that = (DefaultStudyPlan) o; // return new EqualsBuilder().append(getSemesterPlan(), that.getSemesterPlan()) // .append(getConstraints(), that.getConstraints()).append(getCourseRegistry(), that.getCourseRegistry()) // .isEquals(); // } // // @Override // public String toString() { // return "DefaultStudyPlan[semesters=" + getSemesterPlan() + ", courses=" + getCourseRegistry() + ", constraints=" // + getConstraints() + ']'; // } // } // // Path: src/main/java/com/oskopek/studyguide/weld/DeadEventListener.java // @Singleton // public final class DeadEventListener { // // @Inject // private transient Logger logger; // // /** // * Private default constructor for CDI and to prevent instantiation. // */ // private DeadEventListener() { // // intentionally empty // } // // /** // * Listen to dead events and log them. // * // * @param event the dead event // */ // @Subscribe // private void listen(DeadEvent event) { // logger.error("Dead event ({}) pushed from ({})", event.getEvent(), event.getSource()); // } // }
import com.google.common.eventbus.EventBus; import com.oskopek.studyguide.model.DefaultStudyPlan; import com.oskopek.studyguide.weld.DeadEventListener; import com.oskopek.studyguide.weld.StartupStage; import javafx.application.Platform; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.layout.VBox; import javafx.stage.Stage; import javax.enterprise.event.Observes; import javax.enterprise.inject.Instance; import javax.inject.Inject; import javax.inject.Named; import java.io.IOException; import java.io.InputStream;
package com.oskopek.studyguide.view; /** * A CDI-enabled version of {@link StudyGuideApplication} that initializes the root layout. */ class StudyGuideApplicationStarter { @Inject @Named("fxmlloader") private Instance<FXMLLoader> fxmlLoader; @Inject private StudyGuideApplication studyGuideApplication; @Inject private EventBus eventBus; @Inject
// Path: src/main/java/com/oskopek/studyguide/model/DefaultStudyPlan.java // public class DefaultStudyPlan implements StudyPlan { // // private final ObjectProperty<CourseRegistry> courseRegistry; // private final ObjectProperty<SemesterPlan> semesterPlan; // private final ObjectProperty<Constraints> constraints; // // /** // * Create an empty instance of a study plan. // */ // public DefaultStudyPlan() { // this.courseRegistry = new SimpleObjectProperty<>(new CourseRegistry()); // this.semesterPlan = new SimpleObjectProperty<>(new SemesterPlan()); // this.constraints = new SimpleObjectProperty<>(new Constraints()); // } // // @Override // public CourseRegistry getCourseRegistry() { // return courseRegistry.get(); // } // // /** // * Private setter for Jackson persistence. // * // * @param courseRegistry the {@link CourseRegistry} to set // */ // private void setCourseRegistry(CourseRegistry courseRegistry) { // this.courseRegistry.set(courseRegistry); // } // // @Override // public SemesterPlan getSemesterPlan() { // return semesterPlan.get(); // } // // /** // * Private setter for Jackson persistence. // * // * @param semesterPlan the {@link SemesterPlan} to set // */ // private void setSemesterPlan(SemesterPlan semesterPlan) { // this.semesterPlan.set(semesterPlan); // } // // @Override // public Constraints getConstraints() { // return constraints.get(); // } // // /** // * Private setter for Jackson persistence. // * // * @param constraints the {@link Constraints} to set // */ // private void setConstraints(Constraints constraints) { // this.constraints.set(constraints); // } // // /** // * The JavaFX property for {@link #getSemesterPlan()}. // * // * @return the property of {@link #getSemesterPlan()} // */ // public ObjectProperty<SemesterPlan> semesterPlanProperty() { // return semesterPlan; // } // // /** // * The JavaFX property for {@link #getConstraints()}. // * // * @return the property of {@link #getConstraints()} // */ // public ObjectProperty<Constraints> constraintsProperty() { // return constraints; // } // // /** // * The JavaFX property for {@link #getCourseRegistry()}. // * // * @return the property of {@link #getCourseRegistry()} // */ // public ObjectProperty<CourseRegistry> courseRegistryProperty() { // return courseRegistry; // } // // /** // * Remove a course from the course registry. Remove all associated course enrollment constraints and // * remove the course from all course groups in course group constraints. Does <strong>not</strong> remove // * the course from global constraints! // * // * @param toRemove the course to remove // */ // public void removeCourse(Course toRemove) { // getCourseRegistry().removeCourse(toRemove); // List<CourseEnrollment> enrollmentList = getSemesterPlan().allCourseEnrollments() // .filter(ce -> ce.getCourse().equals(toRemove)).collect(Collectors.toList()); // for (CourseEnrollment enrollment : enrollmentList) { // enrollment.getSemester().removeCourseEnrollment(enrollment); // } // getConstraints().getCourseGroupConstraintList().stream().map(cgc -> cgc.getCourseGroup().courseListProperty()) // .forEach(cl -> cl.remove(toRemove)); // getConstraints().removeAllCourseEnrollmentConstraints(enrollmentList); // getConstraints().recheckAll(); // // } // // @Override // public int hashCode() { // return new HashCodeBuilder(17, 37).append(getSemesterPlan()).append(getConstraints()) // .append(getCourseRegistry()).toHashCode(); // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (!(o instanceof DefaultStudyPlan)) { // return false; // } // DefaultStudyPlan that = (DefaultStudyPlan) o; // return new EqualsBuilder().append(getSemesterPlan(), that.getSemesterPlan()) // .append(getConstraints(), that.getConstraints()).append(getCourseRegistry(), that.getCourseRegistry()) // .isEquals(); // } // // @Override // public String toString() { // return "DefaultStudyPlan[semesters=" + getSemesterPlan() + ", courses=" + getCourseRegistry() + ", constraints=" // + getConstraints() + ']'; // } // } // // Path: src/main/java/com/oskopek/studyguide/weld/DeadEventListener.java // @Singleton // public final class DeadEventListener { // // @Inject // private transient Logger logger; // // /** // * Private default constructor for CDI and to prevent instantiation. // */ // private DeadEventListener() { // // intentionally empty // } // // /** // * Listen to dead events and log them. // * // * @param event the dead event // */ // @Subscribe // private void listen(DeadEvent event) { // logger.error("Dead event ({}) pushed from ({})", event.getEvent(), event.getSource()); // } // } // Path: src/main/java/com/oskopek/studyguide/view/StudyGuideApplicationStarter.java import com.google.common.eventbus.EventBus; import com.oskopek.studyguide.model.DefaultStudyPlan; import com.oskopek.studyguide.weld.DeadEventListener; import com.oskopek.studyguide.weld.StartupStage; import javafx.application.Platform; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.layout.VBox; import javafx.stage.Stage; import javax.enterprise.event.Observes; import javax.enterprise.inject.Instance; import javax.inject.Inject; import javax.inject.Named; import java.io.IOException; import java.io.InputStream; package com.oskopek.studyguide.view; /** * A CDI-enabled version of {@link StudyGuideApplication} that initializes the root layout. */ class StudyGuideApplicationStarter { @Inject @Named("fxmlloader") private Instance<FXMLLoader> fxmlLoader; @Inject private StudyGuideApplication studyGuideApplication; @Inject private EventBus eventBus; @Inject
private DeadEventListener deadEventListener;
oskopek/StudyGuide
src/main/java/com/oskopek/studyguide/view/EnterStringDialogPaneCreator.java
// Path: src/main/java/com/oskopek/studyguide/controller/EnterStringController.java // public class EnterStringController extends AbstractController { // // private Dialog<ButtonType> dialog; // // @FXML // private TextField textField; // // /** // * Handles submitting the dialog in case the presses enter into the found course table. // * // * @param event the generated event // */ // @FXML // private void handleOnKeyPressed(KeyEvent event) { // if (event.getCode() == KeyCode.ENTER) { // applyDialog(); // } // } // // /** // * Closes the dialog as if the "Apply" button was clicked. // */ // private void applyDialog() { // dialog.resultProperty().setValue(ButtonType.APPLY); // dialog.close(); // } // // /** // * Get the input text field. // * // * @return the text field, may be null // */ // public TextField getTextField() { // return textField; // } // // /** // * Get the dialog (used for reporting double clicks in the table). // * // * @return the dialog // */ // public Dialog<ButtonType> getDialog() { // return dialog; // } // // /** // * Set the dialog (used for reporting double clicks in the table). // * // * @param dialog the dialog wrapper for {@link EnterStringDialogPaneCreator} // */ // public void setDialog(Dialog<ButtonType> dialog) { // this.dialog = dialog; // } // // /** // * Get the string the user submitted. // * // * @return the submitted string // */ // public String getSubmittedString() { // return textField.getText(); // } // }
import com.oskopek.studyguide.controller.EnterStringController; import javafx.fxml.FXMLLoader; import javafx.scene.control.ButtonType; import javafx.scene.control.Dialog; import javafx.scene.control.DialogPane; import javafx.stage.Modality; import javax.enterprise.inject.Instance; import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; import java.io.IOException; import java.io.InputStream;
package com.oskopek.studyguide.view; /** * Dialog for entering a String. Creates a DialogPane encapsulated in it's controller. */ @Singleton public class EnterStringDialogPaneCreator { @Inject @Named("fxmlloader") private Instance<FXMLLoader> fxmlLoader; /** * Create the dialog for entering a String. * * @param prompt the string message to prompt the user with * @return the controller of the dialog window, enabling to display the dialog and read the selected result */
// Path: src/main/java/com/oskopek/studyguide/controller/EnterStringController.java // public class EnterStringController extends AbstractController { // // private Dialog<ButtonType> dialog; // // @FXML // private TextField textField; // // /** // * Handles submitting the dialog in case the presses enter into the found course table. // * // * @param event the generated event // */ // @FXML // private void handleOnKeyPressed(KeyEvent event) { // if (event.getCode() == KeyCode.ENTER) { // applyDialog(); // } // } // // /** // * Closes the dialog as if the "Apply" button was clicked. // */ // private void applyDialog() { // dialog.resultProperty().setValue(ButtonType.APPLY); // dialog.close(); // } // // /** // * Get the input text field. // * // * @return the text field, may be null // */ // public TextField getTextField() { // return textField; // } // // /** // * Get the dialog (used for reporting double clicks in the table). // * // * @return the dialog // */ // public Dialog<ButtonType> getDialog() { // return dialog; // } // // /** // * Set the dialog (used for reporting double clicks in the table). // * // * @param dialog the dialog wrapper for {@link EnterStringDialogPaneCreator} // */ // public void setDialog(Dialog<ButtonType> dialog) { // this.dialog = dialog; // } // // /** // * Get the string the user submitted. // * // * @return the submitted string // */ // public String getSubmittedString() { // return textField.getText(); // } // } // Path: src/main/java/com/oskopek/studyguide/view/EnterStringDialogPaneCreator.java import com.oskopek.studyguide.controller.EnterStringController; import javafx.fxml.FXMLLoader; import javafx.scene.control.ButtonType; import javafx.scene.control.Dialog; import javafx.scene.control.DialogPane; import javafx.stage.Modality; import javax.enterprise.inject.Instance; import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; import java.io.IOException; import java.io.InputStream; package com.oskopek.studyguide.view; /** * Dialog for entering a String. Creates a DialogPane encapsulated in it's controller. */ @Singleton public class EnterStringDialogPaneCreator { @Inject @Named("fxmlloader") private Instance<FXMLLoader> fxmlLoader; /** * Create the dialog for entering a String. * * @param prompt the string message to prompt the user with * @return the controller of the dialog window, enabling to display the dialog and read the selected result */
public EnterStringController create(String prompt) {
oskopek/StudyGuide
src/main/java/com/oskopek/studyguide/view/ProgressCreator.java
// Path: src/main/java/com/oskopek/studyguide/persistence/ProgressObservable.java // public interface ProgressObservable { // // /** // * The double property that is bound to a UI element showing progress. // * Expects values either equal to {@code -1d} or in the range {@code [0, 1]}. // * // * @return the double property // */ // DoubleProperty progressProperty(); // // }
import com.oskopek.studyguide.persistence.ProgressObservable; import javafx.event.Event; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.ProgressBar; import javafx.scene.layout.VBox; import javafx.stage.Modality; import javafx.stage.Stage; import javafx.stage.StageStyle;
package com.oskopek.studyguide.view; /** * Utility class for creating and displaying blocking progress pop-ups. */ public final class ProgressCreator { /** * Private default constructor to forbid instantiation. */ private ProgressCreator() { // intentionally empty } /** * A util method to display a blocking progress pop-up with the given parameters. * * @param progressObservable the observable object that gives us the progress * @param message the message to display while waiting * @return the stage of the opened dialog with the progress bar */
// Path: src/main/java/com/oskopek/studyguide/persistence/ProgressObservable.java // public interface ProgressObservable { // // /** // * The double property that is bound to a UI element showing progress. // * Expects values either equal to {@code -1d} or in the range {@code [0, 1]}. // * // * @return the double property // */ // DoubleProperty progressProperty(); // // } // Path: src/main/java/com/oskopek/studyguide/view/ProgressCreator.java import com.oskopek.studyguide.persistence.ProgressObservable; import javafx.event.Event; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.ProgressBar; import javafx.scene.layout.VBox; import javafx.stage.Modality; import javafx.stage.Stage; import javafx.stage.StageStyle; package com.oskopek.studyguide.view; /** * Utility class for creating and displaying blocking progress pop-ups. */ public final class ProgressCreator { /** * Private default constructor to forbid instantiation. */ private ProgressCreator() { // intentionally empty } /** * A util method to display a blocking progress pop-up with the given parameters. * * @param progressObservable the observable object that gives us the progress * @param message the message to display while waiting * @return the stage of the opened dialog with the progress bar */
public static Stage showProgress(ProgressObservable progressObservable, String message) {
oskopek/StudyGuide
src/main/java/com/oskopek/studyguide/persistence/MFFWebScraperUtil.java
// Path: src/main/java/com/oskopek/studyguide/model/StudyPlan.java // @JsonPropertyOrder({"courseRegistry", "semesterPlan", "constraints"}) // public interface StudyPlan { // // /** // * A registry of available {@link com.oskopek.studyguide.model.courses.Course}s. // * Not necessarily the only source of courses. // * // * @return may be null // */ // CourseRegistry getCourseRegistry(); // // /** // * Get the corresponding {@link SemesterPlan} instance. // * // * @return a non-null semester plan instance // */ // SemesterPlan getSemesterPlan(); // // /** // * The {@link com.oskopek.studyguide.constraint.Constraint}s placed on this plan. // * // * @return may be null // */ // Constraints getConstraints(); // // }
import com.oskopek.studyguide.model.StudyPlan; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays;
package com.oskopek.studyguide.persistence; /** * A quick util class to scrape a MFF html study plan. */ public final class MFFWebScraperUtil { private static final String sisWebUrl = "https://is.cuni.cz/studium"; private static final String mffIoiInfoUrl = "http://www.mff.cuni.cz/studium/bcmgr/ok/ib3a21.htm"; private final MFFHtmlScraper scraper; /** * An empty default private constructor. */ private MFFWebScraperUtil() { // intentionally empty // TODO add weld init scraper = new MFFHtmlScraper(sisWebUrl); } /** * The main method to run the util. Will overwrite if an existing file with the same name exists. * Naming strategy: {@code test-current_time_in_millis.json}. * * @param args the command line arguments, ignored * @throws IOException if an exception during loading the page or writing the converted json happens */ public static void main(String[] args) throws IOException { MFFWebScraperUtil mffWebScraperUtil = new MFFWebScraperUtil(); mffWebScraperUtil.run(); } /** * The actual "main" method that does all the work. Scrape the study plan from the given URL, * prints the courses that were scraped and saves the plan to a file. * * @throws IOException if an error during scraping or persisting happened */ private void run() throws IOException {
// Path: src/main/java/com/oskopek/studyguide/model/StudyPlan.java // @JsonPropertyOrder({"courseRegistry", "semesterPlan", "constraints"}) // public interface StudyPlan { // // /** // * A registry of available {@link com.oskopek.studyguide.model.courses.Course}s. // * Not necessarily the only source of courses. // * // * @return may be null // */ // CourseRegistry getCourseRegistry(); // // /** // * Get the corresponding {@link SemesterPlan} instance. // * // * @return a non-null semester plan instance // */ // SemesterPlan getSemesterPlan(); // // /** // * The {@link com.oskopek.studyguide.constraint.Constraint}s placed on this plan. // * // * @return may be null // */ // Constraints getConstraints(); // // } // Path: src/main/java/com/oskopek/studyguide/persistence/MFFWebScraperUtil.java import com.oskopek.studyguide.model.StudyPlan; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; package com.oskopek.studyguide.persistence; /** * A quick util class to scrape a MFF html study plan. */ public final class MFFWebScraperUtil { private static final String sisWebUrl = "https://is.cuni.cz/studium"; private static final String mffIoiInfoUrl = "http://www.mff.cuni.cz/studium/bcmgr/ok/ib3a21.htm"; private final MFFHtmlScraper scraper; /** * An empty default private constructor. */ private MFFWebScraperUtil() { // intentionally empty // TODO add weld init scraper = new MFFHtmlScraper(sisWebUrl); } /** * The main method to run the util. Will overwrite if an existing file with the same name exists. * Naming strategy: {@code test-current_time_in_millis.json}. * * @param args the command line arguments, ignored * @throws IOException if an exception during loading the page or writing the converted json happens */ public static void main(String[] args) throws IOException { MFFWebScraperUtil mffWebScraperUtil = new MFFWebScraperUtil(); mffWebScraperUtil.run(); } /** * The actual "main" method that does all the work. Scrape the study plan from the given URL, * prints the courses that were scraped and saves the plan to a file. * * @throws IOException if an error during scraping or persisting happened */ private void run() throws IOException {
StudyPlan studyPlan = scraper.scrapeStudyPlan(mffIoiInfoUrl);
oskopek/StudyGuide
src/main/java/com/oskopek/studyguide/constraint/event/BrokenCourseGroupConstraintEvent.java
// Path: src/main/java/com/oskopek/studyguide/constraint/Constraint.java // @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME) // @JsonSubTypes({@JsonSubTypes.Type(value = CourseEnrollmentCorequisiteConstraint.class, // name = "CourseEnrollmentCorequisiteConstraint"), // @JsonSubTypes.Type(value = CourseEnrollmentEnrolledInConstraint.class, // name = "CourseEnrollmentEnrolledInConstraint"), // @JsonSubTypes.Type(value = CourseEnrollmentPrerequisiteConstraint.class, // name = "CourseEnrollmentPrerequisiteConstraint"), // @JsonSubTypes.Type(value = CourseGroupCreditsPercentageConstraint.class, // name = "CourseGroupCreditsPercentageConstraint"), // @JsonSubTypes.Type(value = CourseGroupCreditsSumConstraint.class, // name = "CourseGroupCreditsSumConstraint"), // @JsonSubTypes.Type(value = CourseGroupFulfilledAllConstraint.class, // name = "CourseGroupFulfilledAllConstraint"), // @JsonSubTypes.Type(value = GlobalCourseMaxFulfilledConstraint.class, // name = "GlobalCourseMaxFulfilledConstraint"), // @JsonSubTypes.Type(value = GlobalCourseRepeatedEnrollmentConstraint.class, // name = "GlobalCourseRepeatedEnrollmentConstraint"), // @JsonSubTypes.Type(value = GlobalCreditsSumConstraint.class, // name = "GlobalCreditsSumConstraint"), // @JsonSubTypes.Type(value = GlobalCreditsSumUntilSemesterConstraint.class, // name = "GlobalCreditsSumUntilSemesterConstraint"), // @JsonSubTypes.Type(value = GlobalLongStudyFeeConstraint.class, // name = "GlobalLongStudyFeeConstraint")}) // public interface Constraint { // // /** // * The method should verify if the given constraint was broken, and if so, // * call the {@link #fireBrokenEvent(String, Course)} with the specific reason. // */ // void validate(); // // /** // * Used for firing a broken constraint event if the constraint is broken. // * // * @param message the reason why the constraint is broken // * @param changed the course that triggered the constraint breakage // */ // void fireBrokenEvent(String message, Course changed); // // /** // * Used for firing a broken constraint event if the constraint is broken. // * // * @param message the reason why the constraint is broken // * @param changed the course enrollment that triggered the constraint breakage // */ // void fireBrokenEvent(String message, CourseEnrollment changed); // // /** // * Used for firing a fixed constraint event if the constraint is fixed. // * // * @param originallyBroken the originally broken (now fixed) constraint // */ // void fireFixedEvent(Constraint originallyBroken); // } // // Path: src/main/java/com/oskopek/studyguide/model/constraints/CourseGroup.java // public class CourseGroup { // // private final ListProperty<Course> courseList; // // /** // * Private default constructor, needed by CDI. // */ // protected CourseGroup() { // // needed by CDI // this.courseList = new SimpleListProperty<>(); // } // // /** // * Builds a new, non-empty course group. // * // * @param courseList non-empty list of courses // * @throws IllegalArgumentException if any parameter is null or any list is empty // */ // public CourseGroup(Collection<Course> courseList) throws IllegalArgumentException { // if (courseList == null || courseList.isEmpty()) { // throw new IllegalArgumentException("The parameters cannot be null and the lists cannot be empty."); // } // this.courseList = new SimpleListProperty<>(FXCollections.observableArrayList(courseList)); // } // // /** // * The list property of courses in this group. // * // * @return non-null, not empty // */ // public ReadOnlyListProperty<Course> courseListProperty() { // return courseList; // } // // /** // * The internal course list. // * // * @return non-null list of {@link Course}s // */ // @JsonGetter // private List<Course> getCourseList() { // return courseList.get(); // } // // /** // * Private setter for Jackson persistence. // * // * @param courseList the list of {@link Course}s to set // */ // @JsonSetter // private void setCourseList(List<Course> courseList) { // this.courseList.set(FXCollections.observableArrayList(courseList)); // } // // @Override // public int hashCode() { // return new HashCodeBuilder(17, 37).append(getCourseList()).toHashCode(); // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (!(o instanceof CourseGroup)) { // return false; // } // CourseGroup group = (CourseGroup) o; // return new EqualsBuilder().append(getCourseList(), group.getCourseList()).isEquals(); // } // // @Override // public String toString() { // return "CourseGroup[" + courseList.size() + ']'; // } // }
import com.oskopek.studyguide.constraint.Constraint; import com.oskopek.studyguide.model.constraints.CourseGroup; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import java.util.ResourceBundle;
package com.oskopek.studyguide.constraint.event; /** * The event used for reporting broken course group constraints. */ public class BrokenCourseGroupConstraintEvent extends StringMessageEvent { private final CourseGroup courseGroup; /** * Default constructor. * * @param messages the resource bundle used for resolving messages to their localized versions * @param message the message to use as a reason why the constraint is broken * @param broken the constraint that was broken and generated this event * @param courseGroup the course group that the constraint broke on */
// Path: src/main/java/com/oskopek/studyguide/constraint/Constraint.java // @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME) // @JsonSubTypes({@JsonSubTypes.Type(value = CourseEnrollmentCorequisiteConstraint.class, // name = "CourseEnrollmentCorequisiteConstraint"), // @JsonSubTypes.Type(value = CourseEnrollmentEnrolledInConstraint.class, // name = "CourseEnrollmentEnrolledInConstraint"), // @JsonSubTypes.Type(value = CourseEnrollmentPrerequisiteConstraint.class, // name = "CourseEnrollmentPrerequisiteConstraint"), // @JsonSubTypes.Type(value = CourseGroupCreditsPercentageConstraint.class, // name = "CourseGroupCreditsPercentageConstraint"), // @JsonSubTypes.Type(value = CourseGroupCreditsSumConstraint.class, // name = "CourseGroupCreditsSumConstraint"), // @JsonSubTypes.Type(value = CourseGroupFulfilledAllConstraint.class, // name = "CourseGroupFulfilledAllConstraint"), // @JsonSubTypes.Type(value = GlobalCourseMaxFulfilledConstraint.class, // name = "GlobalCourseMaxFulfilledConstraint"), // @JsonSubTypes.Type(value = GlobalCourseRepeatedEnrollmentConstraint.class, // name = "GlobalCourseRepeatedEnrollmentConstraint"), // @JsonSubTypes.Type(value = GlobalCreditsSumConstraint.class, // name = "GlobalCreditsSumConstraint"), // @JsonSubTypes.Type(value = GlobalCreditsSumUntilSemesterConstraint.class, // name = "GlobalCreditsSumUntilSemesterConstraint"), // @JsonSubTypes.Type(value = GlobalLongStudyFeeConstraint.class, // name = "GlobalLongStudyFeeConstraint")}) // public interface Constraint { // // /** // * The method should verify if the given constraint was broken, and if so, // * call the {@link #fireBrokenEvent(String, Course)} with the specific reason. // */ // void validate(); // // /** // * Used for firing a broken constraint event if the constraint is broken. // * // * @param message the reason why the constraint is broken // * @param changed the course that triggered the constraint breakage // */ // void fireBrokenEvent(String message, Course changed); // // /** // * Used for firing a broken constraint event if the constraint is broken. // * // * @param message the reason why the constraint is broken // * @param changed the course enrollment that triggered the constraint breakage // */ // void fireBrokenEvent(String message, CourseEnrollment changed); // // /** // * Used for firing a fixed constraint event if the constraint is fixed. // * // * @param originallyBroken the originally broken (now fixed) constraint // */ // void fireFixedEvent(Constraint originallyBroken); // } // // Path: src/main/java/com/oskopek/studyguide/model/constraints/CourseGroup.java // public class CourseGroup { // // private final ListProperty<Course> courseList; // // /** // * Private default constructor, needed by CDI. // */ // protected CourseGroup() { // // needed by CDI // this.courseList = new SimpleListProperty<>(); // } // // /** // * Builds a new, non-empty course group. // * // * @param courseList non-empty list of courses // * @throws IllegalArgumentException if any parameter is null or any list is empty // */ // public CourseGroup(Collection<Course> courseList) throws IllegalArgumentException { // if (courseList == null || courseList.isEmpty()) { // throw new IllegalArgumentException("The parameters cannot be null and the lists cannot be empty."); // } // this.courseList = new SimpleListProperty<>(FXCollections.observableArrayList(courseList)); // } // // /** // * The list property of courses in this group. // * // * @return non-null, not empty // */ // public ReadOnlyListProperty<Course> courseListProperty() { // return courseList; // } // // /** // * The internal course list. // * // * @return non-null list of {@link Course}s // */ // @JsonGetter // private List<Course> getCourseList() { // return courseList.get(); // } // // /** // * Private setter for Jackson persistence. // * // * @param courseList the list of {@link Course}s to set // */ // @JsonSetter // private void setCourseList(List<Course> courseList) { // this.courseList.set(FXCollections.observableArrayList(courseList)); // } // // @Override // public int hashCode() { // return new HashCodeBuilder(17, 37).append(getCourseList()).toHashCode(); // } // // @Override // public boolean equals(Object o) { // if (this == o) { // return true; // } // if (!(o instanceof CourseGroup)) { // return false; // } // CourseGroup group = (CourseGroup) o; // return new EqualsBuilder().append(getCourseList(), group.getCourseList()).isEquals(); // } // // @Override // public String toString() { // return "CourseGroup[" + courseList.size() + ']'; // } // } // Path: src/main/java/com/oskopek/studyguide/constraint/event/BrokenCourseGroupConstraintEvent.java import com.oskopek.studyguide.constraint.Constraint; import com.oskopek.studyguide.model.constraints.CourseGroup; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import java.util.ResourceBundle; package com.oskopek.studyguide.constraint.event; /** * The event used for reporting broken course group constraints. */ public class BrokenCourseGroupConstraintEvent extends StringMessageEvent { private final CourseGroup courseGroup; /** * Default constructor. * * @param messages the resource bundle used for resolving messages to their localized versions * @param message the message to use as a reason why the constraint is broken * @param broken the constraint that was broken and generated this event * @param courseGroup the course group that the constraint broke on */
public BrokenCourseGroupConstraintEvent(ResourceBundle messages, String message, Constraint broken,
elvis-liu/dummie
src/main/java/com/exmertec/dummie/generator/field/FieldValueGenerator.java
// Path: src/main/java/com/exmertec/dummie/cache/Constant.java // public class Constant { // public static final String DEFAULT_STRING_VALUE = "DEFAULT.STRING-value"; // } // // Path: src/main/java/com/exmertec/dummie/generator/data/DataGenerator.java // public abstract class DataGenerator { // // private final List<FieldValueGenerator> generators; // // private final Set<String> randomFieldKeys; // // private final Set<Class<?>> randomFieldType; // // protected DataCache dataCache; // // protected GenerationStrategy strategy; // // public DataGenerator(GenerationStrategy strategy) { // this(strategy, new KeyValueDataCache()); // } // // public DataGenerator(GenerationStrategy strategy, DataCache dataCache) { // this.dataCache = dataCache; // this.strategy = strategy; // // generators = new ArrayList<FieldValueGenerator>(); // randomFieldKeys = new HashSet<String>(); // randomFieldType = new HashSet<Class<?>>(); // // addDefaultGenerators(); // } // // private void addDefaultGenerators() { // generators.add(new StringFieldValueGenerator()); // generators.add(new ListFieldValueGenerator()); // generators.add(new MapFieldValueGenerator()); // generators.add(new SetFieldValueGenerator()); // generators.add(new BooleanFieldValueGenerator()); // generators.add(new ByteFieldValueGenerator()); // generators.add(new CharacterFieldValueGenerator()); // generators.add(new DoubleFieldValueGenerator()); // generators.add(new FloatFieldValueGenerator()); // generators.add(new IntegerFieldValueGenerator()); // generators.add(new LongFieldValueGenerator()); // generators.add(new ShortFieldValueGenerator()); // generators.add(new EnumFieldValueGenerator()); // generators.add(new BigDecimalFieldValueGenerator()); // } // // public Object getData(Field field) { // Class<?> fieldType = field.getType(); // Object value = dataCache.getCachedData(fieldType, field.getName()); // if (value == null) { // FieldValueGenerator generator = getGenerator(fieldType, field.getName()); // if (generator != null) { // value = generator.generate(this, field); // } // } // return value; // } // // public Object getData(Class<?> dataType, String key) { // Object value = dataCache.getCachedData(dataType, key); // if (value == null) { // FieldValueGenerator generator = getGenerator(dataType, key); // if (generator != null) { // value = generator.generate(this, dataType, key); // } // } // return value; // } // // public <T> void cacheData(Class<T> dataType, String key, Object value) { // dataCache.cacheData(dataType, key, value); // } // // public <T> void cacheData(Class<T> clazz, Object value) { // dataCache.cacheData(clazz, value); // } // // public <T> void dynamicCacheData(Class<T> dataType, String key, Object value) { // if (getStrategy(dataType, key) == GenerationStrategy.DEFAULT) { // dataCache.cacheData(dataType, key, value); // } // } // // public void random(Class<?> clazz) { // randomFieldType.add(clazz); // } // // public void random(String key) { // randomFieldKeys.add(key); // } // // protected GenerationStrategy getStrategy(Class<?> dataType, String key) { // return randomFieldType.contains(dataType) || randomFieldKeys.contains(key) ? // GenerationStrategy.RANDOM : strategy; // } // // protected FieldValueGenerator switchGeneratorStrategy(FieldValueGenerator generator, // Class<?> dataType, String key) { // generator.setStrategy(getStrategy(dataType, key)); // return generator; // } // // private FieldValueGenerator getGenerator(Class<?> dataType, String key) { // return switchGeneratorStrategy(getCachedGenerator(dataType), dataType, key); // } // // private FieldValueGenerator getCachedGenerator(Class<?> dataType) { // for (FieldValueGenerator generator: generators) { // if (generator.isMatchType(dataType)) { // return generator; // } // } // // return getDefaultFieldValueGenerator(dataType); // } // // protected abstract FieldValueGenerator getDefaultFieldValueGenerator(Class<?> dataType); // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import com.exmertec.dummie.cache.Constant; import com.exmertec.dummie.generator.data.DataGenerator; import com.exmertec.dummie.configuration.GenerationStrategy; import java.lang.reflect.Field; import java.util.UUID;
package com.exmertec.dummie.generator.field; public abstract class FieldValueGenerator { private final Class<?>[] fieldTypes;
// Path: src/main/java/com/exmertec/dummie/cache/Constant.java // public class Constant { // public static final String DEFAULT_STRING_VALUE = "DEFAULT.STRING-value"; // } // // Path: src/main/java/com/exmertec/dummie/generator/data/DataGenerator.java // public abstract class DataGenerator { // // private final List<FieldValueGenerator> generators; // // private final Set<String> randomFieldKeys; // // private final Set<Class<?>> randomFieldType; // // protected DataCache dataCache; // // protected GenerationStrategy strategy; // // public DataGenerator(GenerationStrategy strategy) { // this(strategy, new KeyValueDataCache()); // } // // public DataGenerator(GenerationStrategy strategy, DataCache dataCache) { // this.dataCache = dataCache; // this.strategy = strategy; // // generators = new ArrayList<FieldValueGenerator>(); // randomFieldKeys = new HashSet<String>(); // randomFieldType = new HashSet<Class<?>>(); // // addDefaultGenerators(); // } // // private void addDefaultGenerators() { // generators.add(new StringFieldValueGenerator()); // generators.add(new ListFieldValueGenerator()); // generators.add(new MapFieldValueGenerator()); // generators.add(new SetFieldValueGenerator()); // generators.add(new BooleanFieldValueGenerator()); // generators.add(new ByteFieldValueGenerator()); // generators.add(new CharacterFieldValueGenerator()); // generators.add(new DoubleFieldValueGenerator()); // generators.add(new FloatFieldValueGenerator()); // generators.add(new IntegerFieldValueGenerator()); // generators.add(new LongFieldValueGenerator()); // generators.add(new ShortFieldValueGenerator()); // generators.add(new EnumFieldValueGenerator()); // generators.add(new BigDecimalFieldValueGenerator()); // } // // public Object getData(Field field) { // Class<?> fieldType = field.getType(); // Object value = dataCache.getCachedData(fieldType, field.getName()); // if (value == null) { // FieldValueGenerator generator = getGenerator(fieldType, field.getName()); // if (generator != null) { // value = generator.generate(this, field); // } // } // return value; // } // // public Object getData(Class<?> dataType, String key) { // Object value = dataCache.getCachedData(dataType, key); // if (value == null) { // FieldValueGenerator generator = getGenerator(dataType, key); // if (generator != null) { // value = generator.generate(this, dataType, key); // } // } // return value; // } // // public <T> void cacheData(Class<T> dataType, String key, Object value) { // dataCache.cacheData(dataType, key, value); // } // // public <T> void cacheData(Class<T> clazz, Object value) { // dataCache.cacheData(clazz, value); // } // // public <T> void dynamicCacheData(Class<T> dataType, String key, Object value) { // if (getStrategy(dataType, key) == GenerationStrategy.DEFAULT) { // dataCache.cacheData(dataType, key, value); // } // } // // public void random(Class<?> clazz) { // randomFieldType.add(clazz); // } // // public void random(String key) { // randomFieldKeys.add(key); // } // // protected GenerationStrategy getStrategy(Class<?> dataType, String key) { // return randomFieldType.contains(dataType) || randomFieldKeys.contains(key) ? // GenerationStrategy.RANDOM : strategy; // } // // protected FieldValueGenerator switchGeneratorStrategy(FieldValueGenerator generator, // Class<?> dataType, String key) { // generator.setStrategy(getStrategy(dataType, key)); // return generator; // } // // private FieldValueGenerator getGenerator(Class<?> dataType, String key) { // return switchGeneratorStrategy(getCachedGenerator(dataType), dataType, key); // } // // private FieldValueGenerator getCachedGenerator(Class<?> dataType) { // for (FieldValueGenerator generator: generators) { // if (generator.isMatchType(dataType)) { // return generator; // } // } // // return getDefaultFieldValueGenerator(dataType); // } // // protected abstract FieldValueGenerator getDefaultFieldValueGenerator(Class<?> dataType); // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/main/java/com/exmertec/dummie/generator/field/FieldValueGenerator.java import com.exmertec.dummie.cache.Constant; import com.exmertec.dummie.generator.data.DataGenerator; import com.exmertec.dummie.configuration.GenerationStrategy; import java.lang.reflect.Field; import java.util.UUID; package com.exmertec.dummie.generator.field; public abstract class FieldValueGenerator { private final Class<?>[] fieldTypes;
protected GenerationStrategy strategy;
elvis-liu/dummie
src/main/java/com/exmertec/dummie/generator/field/FieldValueGenerator.java
// Path: src/main/java/com/exmertec/dummie/cache/Constant.java // public class Constant { // public static final String DEFAULT_STRING_VALUE = "DEFAULT.STRING-value"; // } // // Path: src/main/java/com/exmertec/dummie/generator/data/DataGenerator.java // public abstract class DataGenerator { // // private final List<FieldValueGenerator> generators; // // private final Set<String> randomFieldKeys; // // private final Set<Class<?>> randomFieldType; // // protected DataCache dataCache; // // protected GenerationStrategy strategy; // // public DataGenerator(GenerationStrategy strategy) { // this(strategy, new KeyValueDataCache()); // } // // public DataGenerator(GenerationStrategy strategy, DataCache dataCache) { // this.dataCache = dataCache; // this.strategy = strategy; // // generators = new ArrayList<FieldValueGenerator>(); // randomFieldKeys = new HashSet<String>(); // randomFieldType = new HashSet<Class<?>>(); // // addDefaultGenerators(); // } // // private void addDefaultGenerators() { // generators.add(new StringFieldValueGenerator()); // generators.add(new ListFieldValueGenerator()); // generators.add(new MapFieldValueGenerator()); // generators.add(new SetFieldValueGenerator()); // generators.add(new BooleanFieldValueGenerator()); // generators.add(new ByteFieldValueGenerator()); // generators.add(new CharacterFieldValueGenerator()); // generators.add(new DoubleFieldValueGenerator()); // generators.add(new FloatFieldValueGenerator()); // generators.add(new IntegerFieldValueGenerator()); // generators.add(new LongFieldValueGenerator()); // generators.add(new ShortFieldValueGenerator()); // generators.add(new EnumFieldValueGenerator()); // generators.add(new BigDecimalFieldValueGenerator()); // } // // public Object getData(Field field) { // Class<?> fieldType = field.getType(); // Object value = dataCache.getCachedData(fieldType, field.getName()); // if (value == null) { // FieldValueGenerator generator = getGenerator(fieldType, field.getName()); // if (generator != null) { // value = generator.generate(this, field); // } // } // return value; // } // // public Object getData(Class<?> dataType, String key) { // Object value = dataCache.getCachedData(dataType, key); // if (value == null) { // FieldValueGenerator generator = getGenerator(dataType, key); // if (generator != null) { // value = generator.generate(this, dataType, key); // } // } // return value; // } // // public <T> void cacheData(Class<T> dataType, String key, Object value) { // dataCache.cacheData(dataType, key, value); // } // // public <T> void cacheData(Class<T> clazz, Object value) { // dataCache.cacheData(clazz, value); // } // // public <T> void dynamicCacheData(Class<T> dataType, String key, Object value) { // if (getStrategy(dataType, key) == GenerationStrategy.DEFAULT) { // dataCache.cacheData(dataType, key, value); // } // } // // public void random(Class<?> clazz) { // randomFieldType.add(clazz); // } // // public void random(String key) { // randomFieldKeys.add(key); // } // // protected GenerationStrategy getStrategy(Class<?> dataType, String key) { // return randomFieldType.contains(dataType) || randomFieldKeys.contains(key) ? // GenerationStrategy.RANDOM : strategy; // } // // protected FieldValueGenerator switchGeneratorStrategy(FieldValueGenerator generator, // Class<?> dataType, String key) { // generator.setStrategy(getStrategy(dataType, key)); // return generator; // } // // private FieldValueGenerator getGenerator(Class<?> dataType, String key) { // return switchGeneratorStrategy(getCachedGenerator(dataType), dataType, key); // } // // private FieldValueGenerator getCachedGenerator(Class<?> dataType) { // for (FieldValueGenerator generator: generators) { // if (generator.isMatchType(dataType)) { // return generator; // } // } // // return getDefaultFieldValueGenerator(dataType); // } // // protected abstract FieldValueGenerator getDefaultFieldValueGenerator(Class<?> dataType); // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import com.exmertec.dummie.cache.Constant; import com.exmertec.dummie.generator.data.DataGenerator; import com.exmertec.dummie.configuration.GenerationStrategy; import java.lang.reflect.Field; import java.util.UUID;
package com.exmertec.dummie.generator.field; public abstract class FieldValueGenerator { private final Class<?>[] fieldTypes; protected GenerationStrategy strategy; protected FieldValueGenerator(Class<?>... fieldTypes) { this(GenerationStrategy.DEFAULT, fieldTypes); } protected FieldValueGenerator(GenerationStrategy strategy, Class<?>... fieldTypes) { this.strategy = strategy; this.fieldTypes = fieldTypes; }
// Path: src/main/java/com/exmertec/dummie/cache/Constant.java // public class Constant { // public static final String DEFAULT_STRING_VALUE = "DEFAULT.STRING-value"; // } // // Path: src/main/java/com/exmertec/dummie/generator/data/DataGenerator.java // public abstract class DataGenerator { // // private final List<FieldValueGenerator> generators; // // private final Set<String> randomFieldKeys; // // private final Set<Class<?>> randomFieldType; // // protected DataCache dataCache; // // protected GenerationStrategy strategy; // // public DataGenerator(GenerationStrategy strategy) { // this(strategy, new KeyValueDataCache()); // } // // public DataGenerator(GenerationStrategy strategy, DataCache dataCache) { // this.dataCache = dataCache; // this.strategy = strategy; // // generators = new ArrayList<FieldValueGenerator>(); // randomFieldKeys = new HashSet<String>(); // randomFieldType = new HashSet<Class<?>>(); // // addDefaultGenerators(); // } // // private void addDefaultGenerators() { // generators.add(new StringFieldValueGenerator()); // generators.add(new ListFieldValueGenerator()); // generators.add(new MapFieldValueGenerator()); // generators.add(new SetFieldValueGenerator()); // generators.add(new BooleanFieldValueGenerator()); // generators.add(new ByteFieldValueGenerator()); // generators.add(new CharacterFieldValueGenerator()); // generators.add(new DoubleFieldValueGenerator()); // generators.add(new FloatFieldValueGenerator()); // generators.add(new IntegerFieldValueGenerator()); // generators.add(new LongFieldValueGenerator()); // generators.add(new ShortFieldValueGenerator()); // generators.add(new EnumFieldValueGenerator()); // generators.add(new BigDecimalFieldValueGenerator()); // } // // public Object getData(Field field) { // Class<?> fieldType = field.getType(); // Object value = dataCache.getCachedData(fieldType, field.getName()); // if (value == null) { // FieldValueGenerator generator = getGenerator(fieldType, field.getName()); // if (generator != null) { // value = generator.generate(this, field); // } // } // return value; // } // // public Object getData(Class<?> dataType, String key) { // Object value = dataCache.getCachedData(dataType, key); // if (value == null) { // FieldValueGenerator generator = getGenerator(dataType, key); // if (generator != null) { // value = generator.generate(this, dataType, key); // } // } // return value; // } // // public <T> void cacheData(Class<T> dataType, String key, Object value) { // dataCache.cacheData(dataType, key, value); // } // // public <T> void cacheData(Class<T> clazz, Object value) { // dataCache.cacheData(clazz, value); // } // // public <T> void dynamicCacheData(Class<T> dataType, String key, Object value) { // if (getStrategy(dataType, key) == GenerationStrategy.DEFAULT) { // dataCache.cacheData(dataType, key, value); // } // } // // public void random(Class<?> clazz) { // randomFieldType.add(clazz); // } // // public void random(String key) { // randomFieldKeys.add(key); // } // // protected GenerationStrategy getStrategy(Class<?> dataType, String key) { // return randomFieldType.contains(dataType) || randomFieldKeys.contains(key) ? // GenerationStrategy.RANDOM : strategy; // } // // protected FieldValueGenerator switchGeneratorStrategy(FieldValueGenerator generator, // Class<?> dataType, String key) { // generator.setStrategy(getStrategy(dataType, key)); // return generator; // } // // private FieldValueGenerator getGenerator(Class<?> dataType, String key) { // return switchGeneratorStrategy(getCachedGenerator(dataType), dataType, key); // } // // private FieldValueGenerator getCachedGenerator(Class<?> dataType) { // for (FieldValueGenerator generator: generators) { // if (generator.isMatchType(dataType)) { // return generator; // } // } // // return getDefaultFieldValueGenerator(dataType); // } // // protected abstract FieldValueGenerator getDefaultFieldValueGenerator(Class<?> dataType); // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/main/java/com/exmertec/dummie/generator/field/FieldValueGenerator.java import com.exmertec.dummie.cache.Constant; import com.exmertec.dummie.generator.data.DataGenerator; import com.exmertec.dummie.configuration.GenerationStrategy; import java.lang.reflect.Field; import java.util.UUID; package com.exmertec.dummie.generator.field; public abstract class FieldValueGenerator { private final Class<?>[] fieldTypes; protected GenerationStrategy strategy; protected FieldValueGenerator(Class<?>... fieldTypes) { this(GenerationStrategy.DEFAULT, fieldTypes); } protected FieldValueGenerator(GenerationStrategy strategy, Class<?>... fieldTypes) { this.strategy = strategy; this.fieldTypes = fieldTypes; }
public Object generate(DataGenerator dataGenerator, Field field) {
elvis-liu/dummie
src/main/java/com/exmertec/dummie/generator/field/FieldValueGenerator.java
// Path: src/main/java/com/exmertec/dummie/cache/Constant.java // public class Constant { // public static final String DEFAULT_STRING_VALUE = "DEFAULT.STRING-value"; // } // // Path: src/main/java/com/exmertec/dummie/generator/data/DataGenerator.java // public abstract class DataGenerator { // // private final List<FieldValueGenerator> generators; // // private final Set<String> randomFieldKeys; // // private final Set<Class<?>> randomFieldType; // // protected DataCache dataCache; // // protected GenerationStrategy strategy; // // public DataGenerator(GenerationStrategy strategy) { // this(strategy, new KeyValueDataCache()); // } // // public DataGenerator(GenerationStrategy strategy, DataCache dataCache) { // this.dataCache = dataCache; // this.strategy = strategy; // // generators = new ArrayList<FieldValueGenerator>(); // randomFieldKeys = new HashSet<String>(); // randomFieldType = new HashSet<Class<?>>(); // // addDefaultGenerators(); // } // // private void addDefaultGenerators() { // generators.add(new StringFieldValueGenerator()); // generators.add(new ListFieldValueGenerator()); // generators.add(new MapFieldValueGenerator()); // generators.add(new SetFieldValueGenerator()); // generators.add(new BooleanFieldValueGenerator()); // generators.add(new ByteFieldValueGenerator()); // generators.add(new CharacterFieldValueGenerator()); // generators.add(new DoubleFieldValueGenerator()); // generators.add(new FloatFieldValueGenerator()); // generators.add(new IntegerFieldValueGenerator()); // generators.add(new LongFieldValueGenerator()); // generators.add(new ShortFieldValueGenerator()); // generators.add(new EnumFieldValueGenerator()); // generators.add(new BigDecimalFieldValueGenerator()); // } // // public Object getData(Field field) { // Class<?> fieldType = field.getType(); // Object value = dataCache.getCachedData(fieldType, field.getName()); // if (value == null) { // FieldValueGenerator generator = getGenerator(fieldType, field.getName()); // if (generator != null) { // value = generator.generate(this, field); // } // } // return value; // } // // public Object getData(Class<?> dataType, String key) { // Object value = dataCache.getCachedData(dataType, key); // if (value == null) { // FieldValueGenerator generator = getGenerator(dataType, key); // if (generator != null) { // value = generator.generate(this, dataType, key); // } // } // return value; // } // // public <T> void cacheData(Class<T> dataType, String key, Object value) { // dataCache.cacheData(dataType, key, value); // } // // public <T> void cacheData(Class<T> clazz, Object value) { // dataCache.cacheData(clazz, value); // } // // public <T> void dynamicCacheData(Class<T> dataType, String key, Object value) { // if (getStrategy(dataType, key) == GenerationStrategy.DEFAULT) { // dataCache.cacheData(dataType, key, value); // } // } // // public void random(Class<?> clazz) { // randomFieldType.add(clazz); // } // // public void random(String key) { // randomFieldKeys.add(key); // } // // protected GenerationStrategy getStrategy(Class<?> dataType, String key) { // return randomFieldType.contains(dataType) || randomFieldKeys.contains(key) ? // GenerationStrategy.RANDOM : strategy; // } // // protected FieldValueGenerator switchGeneratorStrategy(FieldValueGenerator generator, // Class<?> dataType, String key) { // generator.setStrategy(getStrategy(dataType, key)); // return generator; // } // // private FieldValueGenerator getGenerator(Class<?> dataType, String key) { // return switchGeneratorStrategy(getCachedGenerator(dataType), dataType, key); // } // // private FieldValueGenerator getCachedGenerator(Class<?> dataType) { // for (FieldValueGenerator generator: generators) { // if (generator.isMatchType(dataType)) { // return generator; // } // } // // return getDefaultFieldValueGenerator(dataType); // } // // protected abstract FieldValueGenerator getDefaultFieldValueGenerator(Class<?> dataType); // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import com.exmertec.dummie.cache.Constant; import com.exmertec.dummie.generator.data.DataGenerator; import com.exmertec.dummie.configuration.GenerationStrategy; import java.lang.reflect.Field; import java.util.UUID;
package com.exmertec.dummie.generator.field; public abstract class FieldValueGenerator { private final Class<?>[] fieldTypes; protected GenerationStrategy strategy; protected FieldValueGenerator(Class<?>... fieldTypes) { this(GenerationStrategy.DEFAULT, fieldTypes); } protected FieldValueGenerator(GenerationStrategy strategy, Class<?>... fieldTypes) { this.strategy = strategy; this.fieldTypes = fieldTypes; } public Object generate(DataGenerator dataGenerator, Field field) { return generate(dataGenerator, field.getType(), field.getName()); } public Object generate(DataGenerator dataGenerator, Class<?> fieldType, String fieldName) { switch (strategy) { case RANDOM: return randomGenerator(dataGenerator, fieldType, fieldName); case DEFAULT: default: return defaultGenerator(dataGenerator, fieldType, fieldName); } } protected String generateKeyValue() {
// Path: src/main/java/com/exmertec/dummie/cache/Constant.java // public class Constant { // public static final String DEFAULT_STRING_VALUE = "DEFAULT.STRING-value"; // } // // Path: src/main/java/com/exmertec/dummie/generator/data/DataGenerator.java // public abstract class DataGenerator { // // private final List<FieldValueGenerator> generators; // // private final Set<String> randomFieldKeys; // // private final Set<Class<?>> randomFieldType; // // protected DataCache dataCache; // // protected GenerationStrategy strategy; // // public DataGenerator(GenerationStrategy strategy) { // this(strategy, new KeyValueDataCache()); // } // // public DataGenerator(GenerationStrategy strategy, DataCache dataCache) { // this.dataCache = dataCache; // this.strategy = strategy; // // generators = new ArrayList<FieldValueGenerator>(); // randomFieldKeys = new HashSet<String>(); // randomFieldType = new HashSet<Class<?>>(); // // addDefaultGenerators(); // } // // private void addDefaultGenerators() { // generators.add(new StringFieldValueGenerator()); // generators.add(new ListFieldValueGenerator()); // generators.add(new MapFieldValueGenerator()); // generators.add(new SetFieldValueGenerator()); // generators.add(new BooleanFieldValueGenerator()); // generators.add(new ByteFieldValueGenerator()); // generators.add(new CharacterFieldValueGenerator()); // generators.add(new DoubleFieldValueGenerator()); // generators.add(new FloatFieldValueGenerator()); // generators.add(new IntegerFieldValueGenerator()); // generators.add(new LongFieldValueGenerator()); // generators.add(new ShortFieldValueGenerator()); // generators.add(new EnumFieldValueGenerator()); // generators.add(new BigDecimalFieldValueGenerator()); // } // // public Object getData(Field field) { // Class<?> fieldType = field.getType(); // Object value = dataCache.getCachedData(fieldType, field.getName()); // if (value == null) { // FieldValueGenerator generator = getGenerator(fieldType, field.getName()); // if (generator != null) { // value = generator.generate(this, field); // } // } // return value; // } // // public Object getData(Class<?> dataType, String key) { // Object value = dataCache.getCachedData(dataType, key); // if (value == null) { // FieldValueGenerator generator = getGenerator(dataType, key); // if (generator != null) { // value = generator.generate(this, dataType, key); // } // } // return value; // } // // public <T> void cacheData(Class<T> dataType, String key, Object value) { // dataCache.cacheData(dataType, key, value); // } // // public <T> void cacheData(Class<T> clazz, Object value) { // dataCache.cacheData(clazz, value); // } // // public <T> void dynamicCacheData(Class<T> dataType, String key, Object value) { // if (getStrategy(dataType, key) == GenerationStrategy.DEFAULT) { // dataCache.cacheData(dataType, key, value); // } // } // // public void random(Class<?> clazz) { // randomFieldType.add(clazz); // } // // public void random(String key) { // randomFieldKeys.add(key); // } // // protected GenerationStrategy getStrategy(Class<?> dataType, String key) { // return randomFieldType.contains(dataType) || randomFieldKeys.contains(key) ? // GenerationStrategy.RANDOM : strategy; // } // // protected FieldValueGenerator switchGeneratorStrategy(FieldValueGenerator generator, // Class<?> dataType, String key) { // generator.setStrategy(getStrategy(dataType, key)); // return generator; // } // // private FieldValueGenerator getGenerator(Class<?> dataType, String key) { // return switchGeneratorStrategy(getCachedGenerator(dataType), dataType, key); // } // // private FieldValueGenerator getCachedGenerator(Class<?> dataType) { // for (FieldValueGenerator generator: generators) { // if (generator.isMatchType(dataType)) { // return generator; // } // } // // return getDefaultFieldValueGenerator(dataType); // } // // protected abstract FieldValueGenerator getDefaultFieldValueGenerator(Class<?> dataType); // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/main/java/com/exmertec/dummie/generator/field/FieldValueGenerator.java import com.exmertec.dummie.cache.Constant; import com.exmertec.dummie.generator.data.DataGenerator; import com.exmertec.dummie.configuration.GenerationStrategy; import java.lang.reflect.Field; import java.util.UUID; package com.exmertec.dummie.generator.field; public abstract class FieldValueGenerator { private final Class<?>[] fieldTypes; protected GenerationStrategy strategy; protected FieldValueGenerator(Class<?>... fieldTypes) { this(GenerationStrategy.DEFAULT, fieldTypes); } protected FieldValueGenerator(GenerationStrategy strategy, Class<?>... fieldTypes) { this.strategy = strategy; this.fieldTypes = fieldTypes; } public Object generate(DataGenerator dataGenerator, Field field) { return generate(dataGenerator, field.getType(), field.getName()); } public Object generate(DataGenerator dataGenerator, Class<?> fieldType, String fieldName) { switch (strategy) { case RANDOM: return randomGenerator(dataGenerator, fieldType, fieldName); case DEFAULT: default: return defaultGenerator(dataGenerator, fieldType, fieldName); } } protected String generateKeyValue() {
return strategy == GenerationStrategy.RANDOM ? UUID.randomUUID().toString() : Constant.DEFAULT_STRING_VALUE;
elvis-liu/dummie
src/test/java/com/exmertec/dummie/BigDecimalTest.java
// Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // }
import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.math.BigDecimal; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat;
package com.exmertec.dummie; public class BigDecimalTest { @Test public void should_success_create_big_decimal_type_field() throws Exception { BigDecimalData data = Dummie.create(BigDecimalData.class); assertThat(data, not(nullValue())); assertThat(data.getValue(), not(nullValue())); } @Test public void should_create_object_with_random_strategy() throws Exception {
// Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // Path: src/test/java/com/exmertec/dummie/BigDecimalTest.java import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.math.BigDecimal; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; package com.exmertec.dummie; public class BigDecimalTest { @Test public void should_success_create_big_decimal_type_field() throws Exception { BigDecimalData data = Dummie.create(BigDecimalData.class); assertThat(data, not(nullValue())); assertThat(data.getValue(), not(nullValue())); } @Test public void should_create_object_with_random_strategy() throws Exception {
BigDecimalData data = withStrategy(GenerationStrategy.RANDOM).create(BigDecimalData.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/BigDecimalTest.java
// Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // }
import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.math.BigDecimal; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat;
package com.exmertec.dummie; public class BigDecimalTest { @Test public void should_success_create_big_decimal_type_field() throws Exception { BigDecimalData data = Dummie.create(BigDecimalData.class); assertThat(data, not(nullValue())); assertThat(data.getValue(), not(nullValue())); } @Test public void should_create_object_with_random_strategy() throws Exception {
// Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // Path: src/test/java/com/exmertec/dummie/BigDecimalTest.java import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.math.BigDecimal; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; package com.exmertec.dummie; public class BigDecimalTest { @Test public void should_success_create_big_decimal_type_field() throws Exception { BigDecimalData data = Dummie.create(BigDecimalData.class); assertThat(data, not(nullValue())); assertThat(data.getValue(), not(nullValue())); } @Test public void should_create_object_with_random_strategy() throws Exception {
BigDecimalData data = withStrategy(GenerationStrategy.RANDOM).create(BigDecimalData.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/InflateSuperClassTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.IsNot.not; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test;
package com.exmertec.dummie; public class InflateSuperClassTest { @Test public void should_success_inflate_super_class() throws Exception { Employee employee = Dummie.create(Employee.class); validate(employee); } @Test public void should_create_object_with_random_strategy() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/InflateSuperClassTest.java import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.IsNot.not; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; package com.exmertec.dummie; public class InflateSuperClassTest { @Test public void should_success_inflate_super_class() throws Exception { Employee employee = Dummie.create(Employee.class); validate(employee); } @Test public void should_create_object_with_random_strategy() throws Exception {
Employee employee = withStrategy(GenerationStrategy.RANDOM).create(Employee.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/InflateSuperClassTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.IsNot.not; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test;
package com.exmertec.dummie; public class InflateSuperClassTest { @Test public void should_success_inflate_super_class() throws Exception { Employee employee = Dummie.create(Employee.class); validate(employee); } @Test public void should_create_object_with_random_strategy() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/InflateSuperClassTest.java import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.IsNot.not; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; package com.exmertec.dummie; public class InflateSuperClassTest { @Test public void should_success_inflate_super_class() throws Exception { Employee employee = Dummie.create(Employee.class); validate(employee); } @Test public void should_create_object_with_random_strategy() throws Exception {
Employee employee = withStrategy(GenerationStrategy.RANDOM).create(Employee.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/MapTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.HashMap; import java.util.Map;
package com.exmertec.dummie; public class MapTest { @Test public void should_create_object_with_map_field() {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/MapTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.HashMap; import java.util.Map; package com.exmertec.dummie; public class MapTest { @Test public void should_create_object_with_map_field() {
MapData data = create(MapData.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/MapTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.HashMap; import java.util.Map;
package com.exmertec.dummie; public class MapTest { @Test public void should_create_object_with_map_field() { MapData data = create(MapData.class); validateSimpleMap(data); } @Test public void should_create_object_with_random_strategy() {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/MapTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.HashMap; import java.util.Map; package com.exmertec.dummie; public class MapTest { @Test public void should_create_object_with_map_field() { MapData data = create(MapData.class); validateSimpleMap(data); } @Test public void should_create_object_with_random_strategy() {
MapData data = withStrategy(GenerationStrategy.RANDOM).create(MapData.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/MapTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.HashMap; import java.util.Map;
package com.exmertec.dummie; public class MapTest { @Test public void should_create_object_with_map_field() { MapData data = create(MapData.class); validateSimpleMap(data); } @Test public void should_create_object_with_random_strategy() {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/MapTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.HashMap; import java.util.Map; package com.exmertec.dummie; public class MapTest { @Test public void should_create_object_with_map_field() { MapData data = create(MapData.class); validateSimpleMap(data); } @Test public void should_create_object_with_random_strategy() {
MapData data = withStrategy(GenerationStrategy.RANDOM).create(MapData.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/SetTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.HashSet; import java.util.Set;
package com.exmertec.dummie; public class SetTest { @Test public void should_create_object_with_set_field() {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/SetTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.HashSet; import java.util.Set; package com.exmertec.dummie; public class SetTest { @Test public void should_create_object_with_set_field() {
SetData data = create(SetData.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/SetTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.HashSet; import java.util.Set;
package com.exmertec.dummie; public class SetTest { @Test public void should_create_object_with_set_field() { SetData data = create(SetData.class); assertThat(data, not(nullValue())); assertThat(data.getNotParameterized().size(), is(0)); assertThat(data.getParameterized().size(), is(1)); } @Test public void should_create_object_with_hashset_field() { HashSetData data = create(HashSetData.class); assertThat(data, not(nullValue())); assertThat(data.getNotParameterized().size(), is(0)); assertThat(data.getParameterized().size(), is(1)); } @Test public void should_create_diff_cache_for_set_and_hashset() throws Exception { MixSetData data = create(MixSetData.class); validateMixSetData(data); } @Test public void should_create_object_with_set_field_and_random_strategy() {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/SetTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.HashSet; import java.util.Set; package com.exmertec.dummie; public class SetTest { @Test public void should_create_object_with_set_field() { SetData data = create(SetData.class); assertThat(data, not(nullValue())); assertThat(data.getNotParameterized().size(), is(0)); assertThat(data.getParameterized().size(), is(1)); } @Test public void should_create_object_with_hashset_field() { HashSetData data = create(HashSetData.class); assertThat(data, not(nullValue())); assertThat(data.getNotParameterized().size(), is(0)); assertThat(data.getParameterized().size(), is(1)); } @Test public void should_create_diff_cache_for_set_and_hashset() throws Exception { MixSetData data = create(MixSetData.class); validateMixSetData(data); } @Test public void should_create_object_with_set_field_and_random_strategy() {
MixSetData data = withStrategy(GenerationStrategy.RANDOM)
elvis-liu/dummie
src/test/java/com/exmertec/dummie/SetTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.HashSet; import java.util.Set;
package com.exmertec.dummie; public class SetTest { @Test public void should_create_object_with_set_field() { SetData data = create(SetData.class); assertThat(data, not(nullValue())); assertThat(data.getNotParameterized().size(), is(0)); assertThat(data.getParameterized().size(), is(1)); } @Test public void should_create_object_with_hashset_field() { HashSetData data = create(HashSetData.class); assertThat(data, not(nullValue())); assertThat(data.getNotParameterized().size(), is(0)); assertThat(data.getParameterized().size(), is(1)); } @Test public void should_create_diff_cache_for_set_and_hashset() throws Exception { MixSetData data = create(MixSetData.class); validateMixSetData(data); } @Test public void should_create_object_with_set_field_and_random_strategy() {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/SetTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.HashSet; import java.util.Set; package com.exmertec.dummie; public class SetTest { @Test public void should_create_object_with_set_field() { SetData data = create(SetData.class); assertThat(data, not(nullValue())); assertThat(data.getNotParameterized().size(), is(0)); assertThat(data.getParameterized().size(), is(1)); } @Test public void should_create_object_with_hashset_field() { HashSetData data = create(HashSetData.class); assertThat(data, not(nullValue())); assertThat(data.getNotParameterized().size(), is(0)); assertThat(data.getParameterized().size(), is(1)); } @Test public void should_create_diff_cache_for_set_and_hashset() throws Exception { MixSetData data = create(MixSetData.class); validateMixSetData(data); } @Test public void should_create_object_with_set_field_and_random_strategy() {
MixSetData data = withStrategy(GenerationStrategy.RANDOM)
elvis-liu/dummie
src/test/java/com/exmertec/dummie/LevelCacheTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory cycleLogic(CycleLogic logic) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.cycleLogic(logic); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/CycleLogic.java // public enum CycleLogic { // LEVEL, CYCLE // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.cycleLogic; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNull.notNullValue; import static org.hamcrest.core.IsNull.nullValue; import com.exmertec.dummie.configuration.CycleLogic; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.List; import java.util.Set;
package com.exmertec.dummie; public class LevelCacheTest { @Test public void should_create_object_with_matched_floor() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory cycleLogic(CycleLogic logic) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.cycleLogic(logic); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/CycleLogic.java // public enum CycleLogic { // LEVEL, CYCLE // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/LevelCacheTest.java import static com.exmertec.dummie.Dummie.cycleLogic; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNull.notNullValue; import static org.hamcrest.core.IsNull.nullValue; import com.exmertec.dummie.configuration.CycleLogic; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.List; import java.util.Set; package com.exmertec.dummie; public class LevelCacheTest { @Test public void should_create_object_with_matched_floor() throws Exception {
NestingData3 data = cycleLogic(CycleLogic.LEVEL).create(NestingData3.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/LevelCacheTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory cycleLogic(CycleLogic logic) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.cycleLogic(logic); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/CycleLogic.java // public enum CycleLogic { // LEVEL, CYCLE // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.cycleLogic; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNull.notNullValue; import static org.hamcrest.core.IsNull.nullValue; import com.exmertec.dummie.configuration.CycleLogic; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.List; import java.util.Set;
package com.exmertec.dummie; public class LevelCacheTest { @Test public void should_create_object_with_matched_floor() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory cycleLogic(CycleLogic logic) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.cycleLogic(logic); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/CycleLogic.java // public enum CycleLogic { // LEVEL, CYCLE // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/LevelCacheTest.java import static com.exmertec.dummie.Dummie.cycleLogic; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNull.notNullValue; import static org.hamcrest.core.IsNull.nullValue; import com.exmertec.dummie.configuration.CycleLogic; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.List; import java.util.Set; package com.exmertec.dummie; public class LevelCacheTest { @Test public void should_create_object_with_matched_floor() throws Exception {
NestingData3 data = cycleLogic(CycleLogic.LEVEL).create(NestingData3.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/LevelCacheTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory cycleLogic(CycleLogic logic) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.cycleLogic(logic); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/CycleLogic.java // public enum CycleLogic { // LEVEL, CYCLE // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.cycleLogic; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNull.notNullValue; import static org.hamcrest.core.IsNull.nullValue; import com.exmertec.dummie.configuration.CycleLogic; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.List; import java.util.Set;
package com.exmertec.dummie; public class LevelCacheTest { @Test public void should_create_object_with_matched_floor() throws Exception { NestingData3 data = cycleLogic(CycleLogic.LEVEL).create(NestingData3.class); validateNestingData3(data); } private void validateNestingData3(NestingData3 data) { assertThat(data, not(nullValue())); assertThat(data.getData(), not(nullValue())); assertThat(data.getData().getData(), notNullValue()); assertThat(data.getData().getData().getName(), is(nullValue())); assertThat(data.getData().getData().getNestingData2s(), is(nullValue())); assertThat(data.getData1s(), not(nullValue())); assertThat(data.getData1s().toArray()[0], notNullValue()); } @Test public void should_create_object_with_strategy_and_floor() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory cycleLogic(CycleLogic logic) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.cycleLogic(logic); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/CycleLogic.java // public enum CycleLogic { // LEVEL, CYCLE // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/LevelCacheTest.java import static com.exmertec.dummie.Dummie.cycleLogic; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNull.notNullValue; import static org.hamcrest.core.IsNull.nullValue; import com.exmertec.dummie.configuration.CycleLogic; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.List; import java.util.Set; package com.exmertec.dummie; public class LevelCacheTest { @Test public void should_create_object_with_matched_floor() throws Exception { NestingData3 data = cycleLogic(CycleLogic.LEVEL).create(NestingData3.class); validateNestingData3(data); } private void validateNestingData3(NestingData3 data) { assertThat(data, not(nullValue())); assertThat(data.getData(), not(nullValue())); assertThat(data.getData().getData(), notNullValue()); assertThat(data.getData().getData().getName(), is(nullValue())); assertThat(data.getData().getData().getNestingData2s(), is(nullValue())); assertThat(data.getData1s(), not(nullValue())); assertThat(data.getData1s().toArray()[0], notNullValue()); } @Test public void should_create_object_with_strategy_and_floor() throws Exception {
NestingData3 data = withStrategy(GenerationStrategy.RANDOM)
elvis-liu/dummie
src/test/java/com/exmertec/dummie/LevelCacheTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory cycleLogic(CycleLogic logic) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.cycleLogic(logic); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/CycleLogic.java // public enum CycleLogic { // LEVEL, CYCLE // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.cycleLogic; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNull.notNullValue; import static org.hamcrest.core.IsNull.nullValue; import com.exmertec.dummie.configuration.CycleLogic; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.List; import java.util.Set;
package com.exmertec.dummie; public class LevelCacheTest { @Test public void should_create_object_with_matched_floor() throws Exception { NestingData3 data = cycleLogic(CycleLogic.LEVEL).create(NestingData3.class); validateNestingData3(data); } private void validateNestingData3(NestingData3 data) { assertThat(data, not(nullValue())); assertThat(data.getData(), not(nullValue())); assertThat(data.getData().getData(), notNullValue()); assertThat(data.getData().getData().getName(), is(nullValue())); assertThat(data.getData().getData().getNestingData2s(), is(nullValue())); assertThat(data.getData1s(), not(nullValue())); assertThat(data.getData1s().toArray()[0], notNullValue()); } @Test public void should_create_object_with_strategy_and_floor() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory cycleLogic(CycleLogic logic) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.cycleLogic(logic); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/CycleLogic.java // public enum CycleLogic { // LEVEL, CYCLE // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/LevelCacheTest.java import static com.exmertec.dummie.Dummie.cycleLogic; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsNot.not; import static org.hamcrest.core.IsNull.notNullValue; import static org.hamcrest.core.IsNull.nullValue; import com.exmertec.dummie.configuration.CycleLogic; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.List; import java.util.Set; package com.exmertec.dummie; public class LevelCacheTest { @Test public void should_create_object_with_matched_floor() throws Exception { NestingData3 data = cycleLogic(CycleLogic.LEVEL).create(NestingData3.class); validateNestingData3(data); } private void validateNestingData3(NestingData3 data) { assertThat(data, not(nullValue())); assertThat(data.getData(), not(nullValue())); assertThat(data.getData().getData(), notNullValue()); assertThat(data.getData().getData().getName(), is(nullValue())); assertThat(data.getData().getData().getNestingData2s(), is(nullValue())); assertThat(data.getData1s(), not(nullValue())); assertThat(data.getData1s().toArray()[0], notNullValue()); } @Test public void should_create_object_with_strategy_and_floor() throws Exception {
NestingData3 data = withStrategy(GenerationStrategy.RANDOM)
elvis-liu/dummie
src/test/java/com/exmertec/dummie/StringTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test;
package com.exmertec.dummie; public class StringTest { @Test public void should_create_object_with_string_field() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/StringTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; package com.exmertec.dummie; public class StringTest { @Test public void should_create_object_with_string_field() throws Exception {
StringData data = create(StringData.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/StringTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test;
package com.exmertec.dummie; public class StringTest { @Test public void should_create_object_with_string_field() throws Exception { StringData data = create(StringData.class); assertThat(data, not(nullValue())); assertThat(data.getStringValue(), is("stringValue")); } @Test public void should_create_object_with_random_strategy() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/StringTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; package com.exmertec.dummie; public class StringTest { @Test public void should_create_object_with_string_field() throws Exception { StringData data = create(StringData.class); assertThat(data, not(nullValue())); assertThat(data.getStringValue(), is("stringValue")); } @Test public void should_create_object_with_random_strategy() throws Exception {
StringData data = withStrategy(GenerationStrategy.RANDOM)
elvis-liu/dummie
src/test/java/com/exmertec/dummie/StringTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test;
package com.exmertec.dummie; public class StringTest { @Test public void should_create_object_with_string_field() throws Exception { StringData data = create(StringData.class); assertThat(data, not(nullValue())); assertThat(data.getStringValue(), is("stringValue")); } @Test public void should_create_object_with_random_strategy() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/StringTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; package com.exmertec.dummie; public class StringTest { @Test public void should_create_object_with_string_field() throws Exception { StringData data = create(StringData.class); assertThat(data, not(nullValue())); assertThat(data.getStringValue(), is("stringValue")); } @Test public void should_create_object_with_random_strategy() throws Exception {
StringData data = withStrategy(GenerationStrategy.RANDOM)
elvis-liu/dummie
src/test/java/com/exmertec/dummie/StringTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test;
package com.exmertec.dummie; public class StringTest { @Test public void should_create_object_with_string_field() throws Exception { StringData data = create(StringData.class); assertThat(data, not(nullValue())); assertThat(data.getStringValue(), is("stringValue")); } @Test public void should_create_object_with_random_strategy() throws Exception { StringData data = withStrategy(GenerationStrategy.RANDOM) .create(StringData.class); assertThat(data, not(nullValue())); assertThat(data.getStringValue(), not(nullValue())); } @Test public void should_allow_customize_string_type_fields() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/StringTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; package com.exmertec.dummie; public class StringTest { @Test public void should_create_object_with_string_field() throws Exception { StringData data = create(StringData.class); assertThat(data, not(nullValue())); assertThat(data.getStringValue(), is("stringValue")); } @Test public void should_create_object_with_random_strategy() throws Exception { StringData data = withStrategy(GenerationStrategy.RANDOM) .create(StringData.class); assertThat(data, not(nullValue())); assertThat(data.getStringValue(), not(nullValue())); } @Test public void should_allow_customize_string_type_fields() throws Exception {
StringData data = prepare(StringData.class).override("stringValue", "test").build();
elvis-liu/dummie
src/test/java/com/exmertec/dummie/ListCacheTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.List;
package com.exmertec.dummie; public class ListCacheTest { @Test public void should_create_object() {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/ListCacheTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.List; package com.exmertec.dummie; public class ListCacheTest { @Test public void should_create_object() {
NestingData1 nestingData1 = create(NestingData1.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/ListCacheTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.List;
package com.exmertec.dummie; public class ListCacheTest { @Test public void should_create_object() { NestingData1 nestingData1 = create(NestingData1.class); validate(nestingData1); } @Test(expected = StackOverflowError.class) public void should_throw_stack_over_flow_with_random_strategy_and_cycle_dependency() {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/ListCacheTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.List; package com.exmertec.dummie; public class ListCacheTest { @Test public void should_create_object() { NestingData1 nestingData1 = create(NestingData1.class); validate(nestingData1); } @Test(expected = StackOverflowError.class) public void should_throw_stack_over_flow_with_random_strategy_and_cycle_dependency() {
withStrategy(GenerationStrategy.RANDOM).create(NestingData1.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/ListCacheTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.List;
package com.exmertec.dummie; public class ListCacheTest { @Test public void should_create_object() { NestingData1 nestingData1 = create(NestingData1.class); validate(nestingData1); } @Test(expected = StackOverflowError.class) public void should_throw_stack_over_flow_with_random_strategy_and_cycle_dependency() {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/ListCacheTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.List; package com.exmertec.dummie; public class ListCacheTest { @Test public void should_create_object() { NestingData1 nestingData1 = create(NestingData1.class); validate(nestingData1); } @Test(expected = StackOverflowError.class) public void should_throw_stack_over_flow_with_random_strategy_and_cycle_dependency() {
withStrategy(GenerationStrategy.RANDOM).create(NestingData1.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/OverrideTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import org.junit.Test;
package com.exmertec.dummie; public class OverrideTest { @Test public void should_create_object() {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // Path: src/test/java/com/exmertec/dummie/OverrideTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import org.junit.Test; package com.exmertec.dummie; public class OverrideTest { @Test public void should_create_object() {
NestingData1 nestingData1 = create(NestingData1.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/OverrideTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import org.junit.Test;
package com.exmertec.dummie; public class OverrideTest { @Test public void should_create_object() { NestingData1 nestingData1 = create(NestingData1.class); assertThat(nestingData1, not(nullValue())); assertThat(nestingData1.getNestingData2s(), not(nullValue())); assertThat(nestingData1.getNestingData2s().getData(), not(nullValue())); } @Test public void should_prepare_class_and_success_cached() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // Path: src/test/java/com/exmertec/dummie/OverrideTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import org.junit.Test; package com.exmertec.dummie; public class OverrideTest { @Test public void should_create_object() { NestingData1 nestingData1 = create(NestingData1.class); assertThat(nestingData1, not(nullValue())); assertThat(nestingData1.getNestingData2s(), not(nullValue())); assertThat(nestingData1.getNestingData2s().getData(), not(nullValue())); } @Test public void should_prepare_class_and_success_cached() throws Exception {
NestingData1 nestingData1 = prepare(NestingData1.class).override(String.class, "abc").build();
elvis-liu/dummie
src/test/java/com/exmertec/dummie/ListTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.ArrayList; import java.util.LinkedList; import java.util.List;
package com.exmertec.dummie; public class ListTest { @Test public void should_create_object_with_list_field() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/ListTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; package com.exmertec.dummie; public class ListTest { @Test public void should_create_object_with_list_field() throws Exception {
ListData data = create(ListData.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/ListTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.ArrayList; import java.util.LinkedList; import java.util.List;
package com.exmertec.dummie; public class ListTest { @Test public void should_create_object_with_list_field() throws Exception { ListData data = create(ListData.class); validateSimpleList(data); } private void validateSimpleList(ListData data) { assertThat(data, not(nullValue())); assertThat(data.getNotParameterized().size(), is(0)); assertThat(data.getParameterized().size(), is(1)); assertThat(data.getParameterized().get(0), not(nullValue())); } @Test public void should_create_object_with_random_strategy() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/ListTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; package com.exmertec.dummie; public class ListTest { @Test public void should_create_object_with_list_field() throws Exception { ListData data = create(ListData.class); validateSimpleList(data); } private void validateSimpleList(ListData data) { assertThat(data, not(nullValue())); assertThat(data.getNotParameterized().size(), is(0)); assertThat(data.getParameterized().size(), is(1)); assertThat(data.getParameterized().get(0), not(nullValue())); } @Test public void should_create_object_with_random_strategy() throws Exception {
ListData data = withStrategy(GenerationStrategy.RANDOM).create(ListData.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/ListTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.ArrayList; import java.util.LinkedList; import java.util.List;
package com.exmertec.dummie; public class ListTest { @Test public void should_create_object_with_list_field() throws Exception { ListData data = create(ListData.class); validateSimpleList(data); } private void validateSimpleList(ListData data) { assertThat(data, not(nullValue())); assertThat(data.getNotParameterized().size(), is(0)); assertThat(data.getParameterized().size(), is(1)); assertThat(data.getParameterized().get(0), not(nullValue())); } @Test public void should_create_object_with_random_strategy() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/ListTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; package com.exmertec.dummie; public class ListTest { @Test public void should_create_object_with_list_field() throws Exception { ListData data = create(ListData.class); validateSimpleList(data); } private void validateSimpleList(ListData data) { assertThat(data, not(nullValue())); assertThat(data.getNotParameterized().size(), is(0)); assertThat(data.getParameterized().size(), is(1)); assertThat(data.getParameterized().get(0), not(nullValue())); } @Test public void should_create_object_with_random_strategy() throws Exception {
ListData data = withStrategy(GenerationStrategy.RANDOM).create(ListData.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/RandomTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // }
import static com.exmertec.dummie.Dummie.prepare; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import org.junit.Test;
package com.exmertec.dummie; public class RandomTest { @Test public void should_prepare_class_and_custom_random() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // Path: src/test/java/com/exmertec/dummie/RandomTest.java import static com.exmertec.dummie.Dummie.prepare; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import org.junit.Test; package com.exmertec.dummie; public class RandomTest { @Test public void should_prepare_class_and_custom_random() throws Exception {
NestingData1 nestingData1 = prepare(NestingData1.class).random(String.class).build();
elvis-liu/dummie
src/main/java/com/exmertec/dummie/Dummie.java
// Path: src/main/java/com/exmertec/dummie/configuration/CycleLogic.java // public enum CycleLogic { // LEVEL, CYCLE // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import com.exmertec.dummie.configuration.CycleLogic; import com.exmertec.dummie.configuration.GenerationStrategy;
package com.exmertec.dummie; public class Dummie { public static <T> T create(Class<T> type) { return prepare(type).build(); } public static <T> DummyBuilder<T> prepare(Class<T> type) { return new DummyBuilderFactory().prepare(type); }
// Path: src/main/java/com/exmertec/dummie/configuration/CycleLogic.java // public enum CycleLogic { // LEVEL, CYCLE // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/main/java/com/exmertec/dummie/Dummie.java import com.exmertec.dummie.configuration.CycleLogic; import com.exmertec.dummie.configuration.GenerationStrategy; package com.exmertec.dummie; public class Dummie { public static <T> T create(Class<T> type) { return prepare(type).build(); } public static <T> DummyBuilder<T> prepare(Class<T> type) { return new DummyBuilderFactory().prepare(type); }
public static DummyBuilderFactory cycleLogic(CycleLogic logic) {
elvis-liu/dummie
src/main/java/com/exmertec/dummie/Dummie.java
// Path: src/main/java/com/exmertec/dummie/configuration/CycleLogic.java // public enum CycleLogic { // LEVEL, CYCLE // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import com.exmertec.dummie.configuration.CycleLogic; import com.exmertec.dummie.configuration.GenerationStrategy;
package com.exmertec.dummie; public class Dummie { public static <T> T create(Class<T> type) { return prepare(type).build(); } public static <T> DummyBuilder<T> prepare(Class<T> type) { return new DummyBuilderFactory().prepare(type); } public static DummyBuilderFactory cycleLogic(CycleLogic logic) { DummyBuilderFactory factory = new DummyBuilderFactory(); factory.cycleLogic(logic); return factory; }
// Path: src/main/java/com/exmertec/dummie/configuration/CycleLogic.java // public enum CycleLogic { // LEVEL, CYCLE // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/main/java/com/exmertec/dummie/Dummie.java import com.exmertec.dummie.configuration.CycleLogic; import com.exmertec.dummie.configuration.GenerationStrategy; package com.exmertec.dummie; public class Dummie { public static <T> T create(Class<T> type) { return prepare(type).build(); } public static <T> DummyBuilder<T> prepare(Class<T> type) { return new DummyBuilderFactory().prepare(type); } public static DummyBuilderFactory cycleLogic(CycleLogic logic) { DummyBuilderFactory factory = new DummyBuilderFactory(); factory.cycleLogic(logic); return factory; }
public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) {
elvis-liu/dummie
src/test/java/com/exmertec/dummie/EnumTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertEquals; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test;
package com.exmertec.dummie; public class EnumTest { @Test public void should_create_object_with_enum_field() {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/EnumTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertEquals; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; package com.exmertec.dummie; public class EnumTest { @Test public void should_create_object_with_enum_field() {
EnumData enumData = create(EnumData.class);
elvis-liu/dummie
src/test/java/com/exmertec/dummie/EnumTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertEquals; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test;
package com.exmertec.dummie; public class EnumTest { @Test public void should_create_object_with_enum_field() { EnumData enumData = create(EnumData.class); assertThat(enumData, not(nullValue())); assertThat(enumData.getDataType(), equalTo(DataType.STRING)); } @Test public void should_create_object_without_any_constant() { EmptyEnumData emptyEnumData = create(EmptyEnumData.class); assertThat(emptyEnumData, not(nullValue())); assertThat(emptyEnumData.getDataType(), is(nullValue())); } @Test public void should_create_object_with_random_strategy() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/EnumTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertEquals; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; package com.exmertec.dummie; public class EnumTest { @Test public void should_create_object_with_enum_field() { EnumData enumData = create(EnumData.class); assertThat(enumData, not(nullValue())); assertThat(enumData.getDataType(), equalTo(DataType.STRING)); } @Test public void should_create_object_without_any_constant() { EmptyEnumData emptyEnumData = create(EmptyEnumData.class); assertThat(emptyEnumData, not(nullValue())); assertThat(emptyEnumData.getDataType(), is(nullValue())); } @Test public void should_create_object_with_random_strategy() throws Exception {
EnumData enumData = withStrategy(GenerationStrategy.RANDOM)
elvis-liu/dummie
src/test/java/com/exmertec/dummie/EnumTest.java
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // }
import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertEquals; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test;
package com.exmertec.dummie; public class EnumTest { @Test public void should_create_object_with_enum_field() { EnumData enumData = create(EnumData.class); assertThat(enumData, not(nullValue())); assertThat(enumData.getDataType(), equalTo(DataType.STRING)); } @Test public void should_create_object_without_any_constant() { EmptyEnumData emptyEnumData = create(EmptyEnumData.class); assertThat(emptyEnumData, not(nullValue())); assertThat(emptyEnumData.getDataType(), is(nullValue())); } @Test public void should_create_object_with_random_strategy() throws Exception {
// Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> T create(Class<T> type) { // return prepare(type).build(); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static <T> DummyBuilder<T> prepare(Class<T> type) { // return new DummyBuilderFactory().prepare(type); // } // // Path: src/main/java/com/exmertec/dummie/Dummie.java // public static DummyBuilderFactory withStrategy(GenerationStrategy strategy) { // DummyBuilderFactory factory = new DummyBuilderFactory(); // factory.withStrategy(strategy); // return factory; // } // // Path: src/main/java/com/exmertec/dummie/configuration/GenerationStrategy.java // public enum GenerationStrategy { // DEFAULT, RANDOM // } // Path: src/test/java/com/exmertec/dummie/EnumTest.java import static com.exmertec.dummie.Dummie.create; import static com.exmertec.dummie.Dummie.prepare; import static com.exmertec.dummie.Dummie.withStrategy; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertEquals; import com.exmertec.dummie.configuration.GenerationStrategy; import org.junit.Test; package com.exmertec.dummie; public class EnumTest { @Test public void should_create_object_with_enum_field() { EnumData enumData = create(EnumData.class); assertThat(enumData, not(nullValue())); assertThat(enumData.getDataType(), equalTo(DataType.STRING)); } @Test public void should_create_object_without_any_constant() { EmptyEnumData emptyEnumData = create(EmptyEnumData.class); assertThat(emptyEnumData, not(nullValue())); assertThat(emptyEnumData.getDataType(), is(nullValue())); } @Test public void should_create_object_with_random_strategy() throws Exception {
EnumData enumData = withStrategy(GenerationStrategy.RANDOM)