id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
144,100
apache/fluo-recipes
modules/core/src/main/java/org/apache/fluo/recipes/core/map/CollisionFreeMap.java
CollisionFreeMap.configure
public static void configure(FluoConfiguration fluoConfig, Options opts) { org.apache.fluo.recipes.core.combine.CombineQueue.FluentOptions cqopts = CombineQueue.configure(opts.mapId).keyType(opts.keyType).valueType(opts.valueType) .buckets(opts.numBuckets); if (opts.bucketsPerTablet != null) { cqopts.bucketsPerTablet(opts.bucketsPerTablet); } if (opts.bufferSize != null) { cqopts.bufferSize(opts.bufferSize); } cqopts.save(fluoConfig); opts.save(fluoConfig.getAppConfiguration()); fluoConfig.addObserver(new org.apache.fluo.api.config.ObserverSpecification( CollisionFreeMapObserver.class.getName(), ImmutableMap.of("mapId", opts.mapId))); }
java
public static void configure(FluoConfiguration fluoConfig, Options opts) { org.apache.fluo.recipes.core.combine.CombineQueue.FluentOptions cqopts = CombineQueue.configure(opts.mapId).keyType(opts.keyType).valueType(opts.valueType) .buckets(opts.numBuckets); if (opts.bucketsPerTablet != null) { cqopts.bucketsPerTablet(opts.bucketsPerTablet); } if (opts.bufferSize != null) { cqopts.bufferSize(opts.bufferSize); } cqopts.save(fluoConfig); opts.save(fluoConfig.getAppConfiguration()); fluoConfig.addObserver(new org.apache.fluo.api.config.ObserverSpecification( CollisionFreeMapObserver.class.getName(), ImmutableMap.of("mapId", opts.mapId))); }
[ "public", "static", "void", "configure", "(", "FluoConfiguration", "fluoConfig", ",", "Options", "opts", ")", "{", "org", ".", "apache", ".", "fluo", ".", "recipes", ".", "core", ".", "combine", ".", "CombineQueue", ".", "FluentOptions", "cqopts", "=", "CombineQueue", ".", "configure", "(", "opts", ".", "mapId", ")", ".", "keyType", "(", "opts", ".", "keyType", ")", ".", "valueType", "(", "opts", ".", "valueType", ")", ".", "buckets", "(", "opts", ".", "numBuckets", ")", ";", "if", "(", "opts", ".", "bucketsPerTablet", "!=", "null", ")", "{", "cqopts", ".", "bucketsPerTablet", "(", "opts", ".", "bucketsPerTablet", ")", ";", "}", "if", "(", "opts", ".", "bufferSize", "!=", "null", ")", "{", "cqopts", ".", "bufferSize", "(", "opts", ".", "bufferSize", ")", ";", "}", "cqopts", ".", "save", "(", "fluoConfig", ")", ";", "opts", ".", "save", "(", "fluoConfig", ".", "getAppConfiguration", "(", ")", ")", ";", "fluoConfig", ".", "addObserver", "(", "new", "org", ".", "apache", ".", "fluo", ".", "api", ".", "config", ".", "ObserverSpecification", "(", "CollisionFreeMapObserver", ".", "class", ".", "getName", "(", ")", ",", "ImmutableMap", ".", "of", "(", "\"mapId\"", ",", "opts", ".", "mapId", ")", ")", ")", ";", "}" ]
This method configures a collision free map for use. It must be called before initializing Fluo.
[ "This", "method", "configures", "a", "collision", "free", "map", "for", "use", ".", "It", "must", "be", "called", "before", "initializing", "Fluo", "." ]
24c11234c9654b16d999437ff49ddc3db86665f8
https://github.com/apache/fluo-recipes/blob/24c11234c9654b16d999437ff49ddc3db86665f8/modules/core/src/main/java/org/apache/fluo/recipes/core/map/CollisionFreeMap.java#L379-L395
144,101
apache/fluo-recipes
modules/core/src/main/java/org/apache/fluo/recipes/core/export/ExportQueue.java
ExportQueue.configure
@Deprecated public static void configure(FluoConfiguration fluoConfig, Options opts) { SimpleConfiguration appConfig = fluoConfig.getAppConfiguration(); opts.save(appConfig); fluoConfig.addObserver( new org.apache.fluo.api.config.ObserverSpecification(ExportObserver.class.getName(), Collections.singletonMap("queueId", opts.fluentCfg.queueId))); }
java
@Deprecated public static void configure(FluoConfiguration fluoConfig, Options opts) { SimpleConfiguration appConfig = fluoConfig.getAppConfiguration(); opts.save(appConfig); fluoConfig.addObserver( new org.apache.fluo.api.config.ObserverSpecification(ExportObserver.class.getName(), Collections.singletonMap("queueId", opts.fluentCfg.queueId))); }
[ "@", "Deprecated", "public", "static", "void", "configure", "(", "FluoConfiguration", "fluoConfig", ",", "Options", "opts", ")", "{", "SimpleConfiguration", "appConfig", "=", "fluoConfig", ".", "getAppConfiguration", "(", ")", ";", "opts", ".", "save", "(", "appConfig", ")", ";", "fluoConfig", ".", "addObserver", "(", "new", "org", ".", "apache", ".", "fluo", ".", "api", ".", "config", ".", "ObserverSpecification", "(", "ExportObserver", ".", "class", ".", "getName", "(", ")", ",", "Collections", ".", "singletonMap", "(", "\"queueId\"", ",", "opts", ".", "fluentCfg", ".", "queueId", ")", ")", ")", ";", "}" ]
Call this method before initializing Fluo. @param fluoConfig The configuration that will be used to initialize fluo. @deprecated since 1.1.0 use {@link #configure(String)} and {@link #registerObserver(ObserverProvider.Registry, org.apache.fluo.recipes.core.export.function.Exporter)} instead.
[ "Call", "this", "method", "before", "initializing", "Fluo", "." ]
24c11234c9654b16d999437ff49ddc3db86665f8
https://github.com/apache/fluo-recipes/blob/24c11234c9654b16d999437ff49ddc3db86665f8/modules/core/src/main/java/org/apache/fluo/recipes/core/export/ExportQueue.java#L188-L196
144,102
apache/fluo-recipes
modules/core/src/main/java/org/apache/fluo/recipes/core/transaction/RecordingTransaction.java
RecordingTransaction.wrap
public static RecordingTransaction wrap(Transaction tx, Predicate<LogEntry> filter) { return new RecordingTransaction(tx, filter); }
java
public static RecordingTransaction wrap(Transaction tx, Predicate<LogEntry> filter) { return new RecordingTransaction(tx, filter); }
[ "public", "static", "RecordingTransaction", "wrap", "(", "Transaction", "tx", ",", "Predicate", "<", "LogEntry", ">", "filter", ")", "{", "return", "new", "RecordingTransaction", "(", "tx", ",", "filter", ")", ";", "}" ]
Creates a RecordingTransaction using the provided LogEntry filter and existing Transaction
[ "Creates", "a", "RecordingTransaction", "using", "the", "provided", "LogEntry", "filter", "and", "existing", "Transaction" ]
24c11234c9654b16d999437ff49ddc3db86665f8
https://github.com/apache/fluo-recipes/blob/24c11234c9654b16d999437ff49ddc3db86665f8/modules/core/src/main/java/org/apache/fluo/recipes/core/transaction/RecordingTransaction.java#L63-L65
144,103
seam/faces
api/src/main/java/org/jboss/seam/faces/component/UIInputContainer.java
UIInputContainer.scan
protected InputContainerElements scan(final UIComponent component, InputContainerElements elements, final FacesContext context) { if (elements == null) { elements = new InputContainerElements(); } // NOTE we need to walk the tree ignoring rendered attribute because it's condition // could be based on what we discover if ((elements.getLabel() == null) && (component instanceof HtmlOutputLabel)) { elements.setLabel((HtmlOutputLabel) component); } else if (component instanceof EditableValueHolder) { elements.registerInput((EditableValueHolder) component, getDefaultValidator(context), context); } else if (component instanceof UIMessage) { elements.registerMessage((UIMessage) component); } // may need to walk smarter to ensure "element of least suprise" for (UIComponent child : component.getChildren()) { scan(child, elements, context); } return elements; }
java
protected InputContainerElements scan(final UIComponent component, InputContainerElements elements, final FacesContext context) { if (elements == null) { elements = new InputContainerElements(); } // NOTE we need to walk the tree ignoring rendered attribute because it's condition // could be based on what we discover if ((elements.getLabel() == null) && (component instanceof HtmlOutputLabel)) { elements.setLabel((HtmlOutputLabel) component); } else if (component instanceof EditableValueHolder) { elements.registerInput((EditableValueHolder) component, getDefaultValidator(context), context); } else if (component instanceof UIMessage) { elements.registerMessage((UIMessage) component); } // may need to walk smarter to ensure "element of least suprise" for (UIComponent child : component.getChildren()) { scan(child, elements, context); } return elements; }
[ "protected", "InputContainerElements", "scan", "(", "final", "UIComponent", "component", ",", "InputContainerElements", "elements", ",", "final", "FacesContext", "context", ")", "{", "if", "(", "elements", "==", "null", ")", "{", "elements", "=", "new", "InputContainerElements", "(", ")", ";", "}", "// NOTE we need to walk the tree ignoring rendered attribute because it's condition", "// could be based on what we discover", "if", "(", "(", "elements", ".", "getLabel", "(", ")", "==", "null", ")", "&&", "(", "component", "instanceof", "HtmlOutputLabel", ")", ")", "{", "elements", ".", "setLabel", "(", "(", "HtmlOutputLabel", ")", "component", ")", ";", "}", "else", "if", "(", "component", "instanceof", "EditableValueHolder", ")", "{", "elements", ".", "registerInput", "(", "(", "EditableValueHolder", ")", "component", ",", "getDefaultValidator", "(", "context", ")", ",", "context", ")", ";", "}", "else", "if", "(", "component", "instanceof", "UIMessage", ")", "{", "elements", ".", "registerMessage", "(", "(", "UIMessage", ")", "component", ")", ";", "}", "// may need to walk smarter to ensure \"element of least suprise\"", "for", "(", "UIComponent", "child", ":", "component", ".", "getChildren", "(", ")", ")", "{", "scan", "(", "child", ",", "elements", ",", "context", ")", ";", "}", "return", "elements", ";", "}" ]
Walk the component tree branch built by the composite component and locate the input container elements. @return a composite object of the input container elements
[ "Walk", "the", "component", "tree", "branch", "built", "by", "the", "composite", "component", "and", "locate", "the", "input", "container", "elements", "." ]
2fdedbc7070318c2c58bfffb8a26f1ea1d0ee1e3
https://github.com/seam/faces/blob/2fdedbc7070318c2c58bfffb8a26f1ea1d0ee1e3/api/src/main/java/org/jboss/seam/faces/component/UIInputContainer.java#L250-L271
144,104
seam/faces
api/src/main/java/org/jboss/seam/faces/component/UIInputContainer.java
UIInputContainer.assignIds
public void assignIds(final InputContainerElements elements, final FacesContext context) { boolean refreshIds = false; if (getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) { setId(elements.getPropertyName(context)); refreshIds = true; } UIComponent label = elements.getLabel(); if (label != null) { if (label.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) { label.setId(getDefaultLabelId()); } else if (refreshIds) { label.setId(label.getId()); } } for (int i = 0, len = elements.getInputs().size(); i < len; i++) { UIComponent input = (UIComponent) elements.getInputs().get(i); if (input.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) { input.setId(getDefaultInputId() + (i == 0 ? "" : (i + 1))); } else if (refreshIds) { input.setId(input.getId()); } } for (int i = 0, len = elements.getMessages().size(); i < len; i++) { UIComponent msg = elements.getMessages().get(i); if (msg.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) { msg.setId(getDefaultMessageId() + (i == 0 ? "" : (i + 1))); } else if (refreshIds) { msg.setId(msg.getId()); } } }
java
public void assignIds(final InputContainerElements elements, final FacesContext context) { boolean refreshIds = false; if (getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) { setId(elements.getPropertyName(context)); refreshIds = true; } UIComponent label = elements.getLabel(); if (label != null) { if (label.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) { label.setId(getDefaultLabelId()); } else if (refreshIds) { label.setId(label.getId()); } } for (int i = 0, len = elements.getInputs().size(); i < len; i++) { UIComponent input = (UIComponent) elements.getInputs().get(i); if (input.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) { input.setId(getDefaultInputId() + (i == 0 ? "" : (i + 1))); } else if (refreshIds) { input.setId(input.getId()); } } for (int i = 0, len = elements.getMessages().size(); i < len; i++) { UIComponent msg = elements.getMessages().get(i); if (msg.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) { msg.setId(getDefaultMessageId() + (i == 0 ? "" : (i + 1))); } else if (refreshIds) { msg.setId(msg.getId()); } } }
[ "public", "void", "assignIds", "(", "final", "InputContainerElements", "elements", ",", "final", "FacesContext", "context", ")", "{", "boolean", "refreshIds", "=", "false", ";", "if", "(", "getId", "(", ")", ".", "startsWith", "(", "UIViewRoot", ".", "UNIQUE_ID_PREFIX", ")", ")", "{", "setId", "(", "elements", ".", "getPropertyName", "(", "context", ")", ")", ";", "refreshIds", "=", "true", ";", "}", "UIComponent", "label", "=", "elements", ".", "getLabel", "(", ")", ";", "if", "(", "label", "!=", "null", ")", "{", "if", "(", "label", ".", "getId", "(", ")", ".", "startsWith", "(", "UIViewRoot", ".", "UNIQUE_ID_PREFIX", ")", ")", "{", "label", ".", "setId", "(", "getDefaultLabelId", "(", ")", ")", ";", "}", "else", "if", "(", "refreshIds", ")", "{", "label", ".", "setId", "(", "label", ".", "getId", "(", ")", ")", ";", "}", "}", "for", "(", "int", "i", "=", "0", ",", "len", "=", "elements", ".", "getInputs", "(", ")", ".", "size", "(", ")", ";", "i", "<", "len", ";", "i", "++", ")", "{", "UIComponent", "input", "=", "(", "UIComponent", ")", "elements", ".", "getInputs", "(", ")", ".", "get", "(", "i", ")", ";", "if", "(", "input", ".", "getId", "(", ")", ".", "startsWith", "(", "UIViewRoot", ".", "UNIQUE_ID_PREFIX", ")", ")", "{", "input", ".", "setId", "(", "getDefaultInputId", "(", ")", "+", "(", "i", "==", "0", "?", "\"\"", ":", "(", "i", "+", "1", ")", ")", ")", ";", "}", "else", "if", "(", "refreshIds", ")", "{", "input", ".", "setId", "(", "input", ".", "getId", "(", ")", ")", ";", "}", "}", "for", "(", "int", "i", "=", "0", ",", "len", "=", "elements", ".", "getMessages", "(", ")", ".", "size", "(", ")", ";", "i", "<", "len", ";", "i", "++", ")", "{", "UIComponent", "msg", "=", "elements", ".", "getMessages", "(", ")", ".", "get", "(", "i", ")", ";", "if", "(", "msg", ".", "getId", "(", ")", ".", "startsWith", "(", "UIViewRoot", ".", "UNIQUE_ID_PREFIX", ")", ")", "{", "msg", ".", "setId", "(", "getDefaultMessageId", "(", ")", "+", "(", "i", "==", "0", "?", "\"\"", ":", "(", "i", "+", "1", ")", ")", ")", ";", "}", "else", "if", "(", "refreshIds", ")", "{", "msg", ".", "setId", "(", "msg", ".", "getId", "(", ")", ")", ";", "}", "}", "}" ]
assigning ids seems to break form submissions, but I don't know why
[ "assigning", "ids", "seems", "to", "break", "form", "submissions", "but", "I", "don", "t", "know", "why" ]
2fdedbc7070318c2c58bfffb8a26f1ea1d0ee1e3
https://github.com/seam/faces/blob/2fdedbc7070318c2c58bfffb8a26f1ea1d0ee1e3/api/src/main/java/org/jboss/seam/faces/component/UIInputContainer.java#L274-L304
144,105
seam/faces
api/src/main/java/org/jboss/seam/faces/component/UIInputContainer.java
UIInputContainer.getDefaultValidator
private Validator getDefaultValidator(final FacesContext context) throws FacesException { if (!beanValidationPresent) { return null; } ValidatorFactory validatorFactory; Object cachedObject = context.getExternalContext().getApplicationMap().get(BeanValidator.VALIDATOR_FACTORY_KEY); if (cachedObject instanceof ValidatorFactory) { validatorFactory = (ValidatorFactory) cachedObject; } else { try { validatorFactory = Validation.buildDefaultValidatorFactory(); } catch (ValidationException e) { throw new FacesException("Could not build a default Bean Validator factory", e); } context.getExternalContext().getApplicationMap().put(BeanValidator.VALIDATOR_FACTORY_KEY, validatorFactory); } return validatorFactory.getValidator(); }
java
private Validator getDefaultValidator(final FacesContext context) throws FacesException { if (!beanValidationPresent) { return null; } ValidatorFactory validatorFactory; Object cachedObject = context.getExternalContext().getApplicationMap().get(BeanValidator.VALIDATOR_FACTORY_KEY); if (cachedObject instanceof ValidatorFactory) { validatorFactory = (ValidatorFactory) cachedObject; } else { try { validatorFactory = Validation.buildDefaultValidatorFactory(); } catch (ValidationException e) { throw new FacesException("Could not build a default Bean Validator factory", e); } context.getExternalContext().getApplicationMap().put(BeanValidator.VALIDATOR_FACTORY_KEY, validatorFactory); } return validatorFactory.getValidator(); }
[ "private", "Validator", "getDefaultValidator", "(", "final", "FacesContext", "context", ")", "throws", "FacesException", "{", "if", "(", "!", "beanValidationPresent", ")", "{", "return", "null", ";", "}", "ValidatorFactory", "validatorFactory", ";", "Object", "cachedObject", "=", "context", ".", "getExternalContext", "(", ")", ".", "getApplicationMap", "(", ")", ".", "get", "(", "BeanValidator", ".", "VALIDATOR_FACTORY_KEY", ")", ";", "if", "(", "cachedObject", "instanceof", "ValidatorFactory", ")", "{", "validatorFactory", "=", "(", "ValidatorFactory", ")", "cachedObject", ";", "}", "else", "{", "try", "{", "validatorFactory", "=", "Validation", ".", "buildDefaultValidatorFactory", "(", ")", ";", "}", "catch", "(", "ValidationException", "e", ")", "{", "throw", "new", "FacesException", "(", "\"Could not build a default Bean Validator factory\"", ",", "e", ")", ";", "}", "context", ".", "getExternalContext", "(", ")", ".", "getApplicationMap", "(", ")", ".", "put", "(", "BeanValidator", ".", "VALIDATOR_FACTORY_KEY", ",", "validatorFactory", ")", ";", "}", "return", "validatorFactory", ".", "getValidator", "(", ")", ";", "}" ]
Get the default Bean Validation Validator to read the contraints for a property.
[ "Get", "the", "default", "Bean", "Validation", "Validator", "to", "read", "the", "contraints", "for", "a", "property", "." ]
2fdedbc7070318c2c58bfffb8a26f1ea1d0ee1e3
https://github.com/seam/faces/blob/2fdedbc7070318c2c58bfffb8a26f1ea1d0ee1e3/api/src/main/java/org/jboss/seam/faces/component/UIInputContainer.java#L316-L334
144,106
olivergondza/dumpling
core/src/main/java/com/github/olivergondza/dumpling/model/ProcessThread.java
ProcessThread.getBlockedThreads
public @Nonnull SetType getBlockedThreads() { Set<ThreadType> blocked = new LinkedHashSet<ThreadType>(); for (ThreadType thread: runtime.getThreads()) { if (thread == this) continue; if (getAcquiredLocks().contains(thread.getWaitingToLock())) { blocked.add(thread); } } return runtime.getThreadSet(blocked); }
java
public @Nonnull SetType getBlockedThreads() { Set<ThreadType> blocked = new LinkedHashSet<ThreadType>(); for (ThreadType thread: runtime.getThreads()) { if (thread == this) continue; if (getAcquiredLocks().contains(thread.getWaitingToLock())) { blocked.add(thread); } } return runtime.getThreadSet(blocked); }
[ "public", "@", "Nonnull", "SetType", "getBlockedThreads", "(", ")", "{", "Set", "<", "ThreadType", ">", "blocked", "=", "new", "LinkedHashSet", "<", "ThreadType", ">", "(", ")", ";", "for", "(", "ThreadType", "thread", ":", "runtime", ".", "getThreads", "(", ")", ")", "{", "if", "(", "thread", "==", "this", ")", "continue", ";", "if", "(", "getAcquiredLocks", "(", ")", ".", "contains", "(", "thread", ".", "getWaitingToLock", "(", ")", ")", ")", "{", "blocked", ".", "add", "(", "thread", ")", ";", "}", "}", "return", "runtime", ".", "getThreadSet", "(", "blocked", ")", ";", "}" ]
Get threads that are waiting for lock held by this thread.
[ "Get", "threads", "that", "are", "waiting", "for", "lock", "held", "by", "this", "thread", "." ]
ac698735fcc7c023db0c1637cc1f522cb3576c7f
https://github.com/olivergondza/dumpling/blob/ac698735fcc7c023db0c1637cc1f522cb3576c7f/core/src/main/java/com/github/olivergondza/dumpling/model/ProcessThread.java#L180-L189
144,107
olivergondza/dumpling
core/src/main/java/com/github/olivergondza/dumpling/model/ProcessThread.java
ProcessThread.getBlockingThreads
public @Nonnull SetType getBlockingThreads() { final ThreadType blocking = getBlockingThread(); if (blocking == null) return runtime.getEmptyThreadSet(); return runtime.getThreadSet(Collections.singleton(blocking)); }
java
public @Nonnull SetType getBlockingThreads() { final ThreadType blocking = getBlockingThread(); if (blocking == null) return runtime.getEmptyThreadSet(); return runtime.getThreadSet(Collections.singleton(blocking)); }
[ "public", "@", "Nonnull", "SetType", "getBlockingThreads", "(", ")", "{", "final", "ThreadType", "blocking", "=", "getBlockingThread", "(", ")", ";", "if", "(", "blocking", "==", "null", ")", "return", "runtime", ".", "getEmptyThreadSet", "(", ")", ";", "return", "runtime", ".", "getThreadSet", "(", "Collections", ".", "singleton", "(", "blocking", ")", ")", ";", "}" ]
Get threads holding lock this thread is trying to acquire. @return {@link ThreadSet} that contains blocked thread or empty set if this thread does not hold any lock.
[ "Get", "threads", "holding", "lock", "this", "thread", "is", "trying", "to", "acquire", "." ]
ac698735fcc7c023db0c1637cc1f522cb3576c7f
https://github.com/olivergondza/dumpling/blob/ac698735fcc7c023db0c1637cc1f522cb3576c7f/core/src/main/java/com/github/olivergondza/dumpling/model/ProcessThread.java#L196-L201
144,108
olivergondza/dumpling
core/src/main/java/com/github/olivergondza/dumpling/model/ProcessThread.java
ProcessThread.getBlockingThread
public @CheckForNull ThreadType getBlockingThread() { if (state.waitingToLock == null && state.waitingOnLock == null) { return null; } for (ThreadType thread: runtime.getThreads()) { if (thread == this) continue; Set<ThreadLock> acquired = thread.getAcquiredLocks(); if (acquired.isEmpty()) continue; if (acquired.contains(state.waitingToLock) || acquired.contains(state.waitingOnLock)) { return thread; } } return null; }
java
public @CheckForNull ThreadType getBlockingThread() { if (state.waitingToLock == null && state.waitingOnLock == null) { return null; } for (ThreadType thread: runtime.getThreads()) { if (thread == this) continue; Set<ThreadLock> acquired = thread.getAcquiredLocks(); if (acquired.isEmpty()) continue; if (acquired.contains(state.waitingToLock) || acquired.contains(state.waitingOnLock)) { return thread; } } return null; }
[ "public", "@", "CheckForNull", "ThreadType", "getBlockingThread", "(", ")", "{", "if", "(", "state", ".", "waitingToLock", "==", "null", "&&", "state", ".", "waitingOnLock", "==", "null", ")", "{", "return", "null", ";", "}", "for", "(", "ThreadType", "thread", ":", "runtime", ".", "getThreads", "(", ")", ")", "{", "if", "(", "thread", "==", "this", ")", "continue", ";", "Set", "<", "ThreadLock", ">", "acquired", "=", "thread", ".", "getAcquiredLocks", "(", ")", ";", "if", "(", "acquired", ".", "isEmpty", "(", ")", ")", "continue", ";", "if", "(", "acquired", ".", "contains", "(", "state", ".", "waitingToLock", ")", "||", "acquired", ".", "contains", "(", "state", ".", "waitingOnLock", ")", ")", "{", "return", "thread", ";", "}", "}", "return", "null", ";", "}" ]
Get thread blocking this threads execution. @return Blocking thread or null if not block by a thread.
[ "Get", "thread", "blocking", "this", "threads", "execution", "." ]
ac698735fcc7c023db0c1637cc1f522cb3576c7f
https://github.com/olivergondza/dumpling/blob/ac698735fcc7c023db0c1637cc1f522cb3576c7f/core/src/main/java/com/github/olivergondza/dumpling/model/ProcessThread.java#L207-L222
144,109
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java
RelationalJMapper.init
private void init(String xmlPath) throws MalformedURLException, IOException{ XML xml = new XML(true, xmlPath); if(!xml.isInheritedMapped(configuredClass)) Error.classNotMapped(configuredClass); for (Class<?> classe :getClasses(xml)){ relationalManyToOneMapper.put(classe.getName(), new JMapper(configuredClass, classe,ChooseConfig.DESTINATION, xmlPath)); relationalOneToManyMapper.put(classe.getName(), new JMapper(classe, configuredClass,ChooseConfig.SOURCE, xmlPath)); } }
java
private void init(String xmlPath) throws MalformedURLException, IOException{ XML xml = new XML(true, xmlPath); if(!xml.isInheritedMapped(configuredClass)) Error.classNotMapped(configuredClass); for (Class<?> classe :getClasses(xml)){ relationalManyToOneMapper.put(classe.getName(), new JMapper(configuredClass, classe,ChooseConfig.DESTINATION, xmlPath)); relationalOneToManyMapper.put(classe.getName(), new JMapper(classe, configuredClass,ChooseConfig.SOURCE, xmlPath)); } }
[ "private", "void", "init", "(", "String", "xmlPath", ")", "throws", "MalformedURLException", ",", "IOException", "{", "XML", "xml", "=", "new", "XML", "(", "true", ",", "xmlPath", ")", ";", "if", "(", "!", "xml", ".", "isInheritedMapped", "(", "configuredClass", ")", ")", "Error", ".", "classNotMapped", "(", "configuredClass", ")", ";", "for", "(", "Class", "<", "?", ">", "classe", ":", "getClasses", "(", "xml", ")", ")", "{", "relationalManyToOneMapper", ".", "put", "(", "classe", ".", "getName", "(", ")", ",", "new", "JMapper", "(", "configuredClass", ",", "classe", ",", "ChooseConfig", ".", "DESTINATION", ",", "xmlPath", ")", ")", ";", "relationalOneToManyMapper", ".", "put", "(", "classe", ".", "getName", "(", ")", ",", "new", "JMapper", "(", "classe", ",", "configuredClass", ",", "ChooseConfig", ".", "SOURCE", ",", "xmlPath", ")", ")", ";", "}", "}" ]
This method initializes relational maps starting from XML. @param xmlPath xml path @throws MalformedURLException @throws IOException
[ "This", "method", "initializes", "relational", "maps", "starting", "from", "XML", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java#L163-L173
144,110
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java
RelationalJMapper.getClasses
private Set<Class<?>> getClasses(XML xml){ HashSet<Class<?>> result = new HashSet<Class<?>>(); // in case of override only the last global configuration must be analyzed Global global = null; for (Class<?> clazz : getAllsuperClasses(configuredClass)) { // only if global configuration is null will be searched global configuration on super classes if(isNull(global)){ global = xml.loadGlobals().get(clazz.getName()); if(!isNull(global)){ addClasses(global.getClasses(),result); if(global.getExcluded()!=null) for (Attribute attribute : xml.loadAttributes().get(clazz.getName())) for (String fieldName : global.getExcluded()) if(attribute.getName().equals(fieldName)) addClasses(attribute.getClasses(),result,attribute.getName()); } } List<Attribute> attributes = xml.loadAttributes().get(clazz.getName()); if(!isNull(attributes)) for (Attribute attribute : attributes) if( isNull(global) || isPresent(global.getExcluded(), attribute.getName()) || ( !isEmpty(global.getAttributes()) && !isPresent(global.getAttributes(), new SimplyAttribute(attribute.getName())) ) ) addClasses(attribute.getClasses(),result,attribute.getName()); } return result; }
java
private Set<Class<?>> getClasses(XML xml){ HashSet<Class<?>> result = new HashSet<Class<?>>(); // in case of override only the last global configuration must be analyzed Global global = null; for (Class<?> clazz : getAllsuperClasses(configuredClass)) { // only if global configuration is null will be searched global configuration on super classes if(isNull(global)){ global = xml.loadGlobals().get(clazz.getName()); if(!isNull(global)){ addClasses(global.getClasses(),result); if(global.getExcluded()!=null) for (Attribute attribute : xml.loadAttributes().get(clazz.getName())) for (String fieldName : global.getExcluded()) if(attribute.getName().equals(fieldName)) addClasses(attribute.getClasses(),result,attribute.getName()); } } List<Attribute> attributes = xml.loadAttributes().get(clazz.getName()); if(!isNull(attributes)) for (Attribute attribute : attributes) if( isNull(global) || isPresent(global.getExcluded(), attribute.getName()) || ( !isEmpty(global.getAttributes()) && !isPresent(global.getAttributes(), new SimplyAttribute(attribute.getName())) ) ) addClasses(attribute.getClasses(),result,attribute.getName()); } return result; }
[ "private", "Set", "<", "Class", "<", "?", ">", ">", "getClasses", "(", "XML", "xml", ")", "{", "HashSet", "<", "Class", "<", "?", ">", ">", "result", "=", "new", "HashSet", "<", "Class", "<", "?", ">", ">", "(", ")", ";", "// in case of override only the last global configuration must be analyzed\r", "Global", "global", "=", "null", ";", "for", "(", "Class", "<", "?", ">", "clazz", ":", "getAllsuperClasses", "(", "configuredClass", ")", ")", "{", "// only if global configuration is null will be searched global configuration on super classes\r", "if", "(", "isNull", "(", "global", ")", ")", "{", "global", "=", "xml", ".", "loadGlobals", "(", ")", ".", "get", "(", "clazz", ".", "getName", "(", ")", ")", ";", "if", "(", "!", "isNull", "(", "global", ")", ")", "{", "addClasses", "(", "global", ".", "getClasses", "(", ")", ",", "result", ")", ";", "if", "(", "global", ".", "getExcluded", "(", ")", "!=", "null", ")", "for", "(", "Attribute", "attribute", ":", "xml", ".", "loadAttributes", "(", ")", ".", "get", "(", "clazz", ".", "getName", "(", ")", ")", ")", "for", "(", "String", "fieldName", ":", "global", ".", "getExcluded", "(", ")", ")", "if", "(", "attribute", ".", "getName", "(", ")", ".", "equals", "(", "fieldName", ")", ")", "addClasses", "(", "attribute", ".", "getClasses", "(", ")", ",", "result", ",", "attribute", ".", "getName", "(", ")", ")", ";", "}", "}", "List", "<", "Attribute", ">", "attributes", "=", "xml", ".", "loadAttributes", "(", ")", ".", "get", "(", "clazz", ".", "getName", "(", ")", ")", ";", "if", "(", "!", "isNull", "(", "attributes", ")", ")", "for", "(", "Attribute", "attribute", ":", "attributes", ")", "if", "(", "isNull", "(", "global", ")", "||", "isPresent", "(", "global", ".", "getExcluded", "(", ")", ",", "attribute", ".", "getName", "(", ")", ")", "||", "(", "!", "isEmpty", "(", "global", ".", "getAttributes", "(", ")", ")", "&&", "!", "isPresent", "(", "global", ".", "getAttributes", "(", ")", ",", "new", "SimplyAttribute", "(", "attribute", ".", "getName", "(", ")", ")", ")", ")", ")", "addClasses", "(", "attribute", ".", "getClasses", "(", ")", ",", "result", ",", "attribute", ".", "getName", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Returns all Target Classes contained in the XML. @param xml xml to analyze @return target classes
[ "Returns", "all", "Target", "Classes", "contained", "in", "the", "XML", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java#L180-L215
144,111
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java
RelationalJMapper.init
private void init(){ if(!Annotation.isInheritedMapped(configuredClass)) Error.classNotMapped(configuredClass); for (Class<?> classe :getClasses()){ relationalManyToOneMapper.put(classe.getName(), new JMapper(configuredClass, classe,ChooseConfig.DESTINATION)); relationalOneToManyMapper.put(classe.getName(), new JMapper(classe, configuredClass,ChooseConfig.SOURCE)); } }
java
private void init(){ if(!Annotation.isInheritedMapped(configuredClass)) Error.classNotMapped(configuredClass); for (Class<?> classe :getClasses()){ relationalManyToOneMapper.put(classe.getName(), new JMapper(configuredClass, classe,ChooseConfig.DESTINATION)); relationalOneToManyMapper.put(classe.getName(), new JMapper(classe, configuredClass,ChooseConfig.SOURCE)); } }
[ "private", "void", "init", "(", ")", "{", "if", "(", "!", "Annotation", ".", "isInheritedMapped", "(", "configuredClass", ")", ")", "Error", ".", "classNotMapped", "(", "configuredClass", ")", ";", "for", "(", "Class", "<", "?", ">", "classe", ":", "getClasses", "(", ")", ")", "{", "relationalManyToOneMapper", ".", "put", "(", "classe", ".", "getName", "(", ")", ",", "new", "JMapper", "(", "configuredClass", ",", "classe", ",", "ChooseConfig", ".", "DESTINATION", ")", ")", ";", "relationalOneToManyMapper", ".", "put", "(", "classe", ".", "getName", "(", ")", ",", "new", "JMapper", "(", "classe", ",", "configuredClass", ",", "ChooseConfig", ".", "SOURCE", ")", ")", ";", "}", "}" ]
This method initializes relational maps
[ "This", "method", "initializes", "relational", "maps" ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java#L220-L229
144,112
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java
RelationalJMapper.getClasses
private Set<Class<?>> getClasses() { HashSet<Class<?>> result = new HashSet<Class<?>>(); // in case of override only the last global configuration must be analyzed JGlobalMap jGlobalMap = null; for (Class<?> clazz : getAllsuperClasses(configuredClass)) { // only if global configuration is null will be searched global configuration on super classes if(isNull(jGlobalMap)){ jGlobalMap = clazz.getAnnotation(JGlobalMap.class); //if the field configuration is defined in the global map if(!isNull(jGlobalMap)){ addClasses(jGlobalMap.classes(),result); if(!isNull(jGlobalMap.excluded())) for (Field field : getListOfFields(configuredClass)){ JMap jMap = field.getAnnotation(JMap.class); if(!isNull(jMap)) for (String fieldName : jGlobalMap.excluded()) if(field.getName().equals(fieldName)) addClasses(jMap.classes(),result,field.getName()); } return result; } } } for (Field field : getListOfFields(configuredClass)){ JMap jMap = field.getAnnotation(JMap.class); if(!isNull(jMap)) addClasses(jMap.classes(),result,field.getName()); } return result; }
java
private Set<Class<?>> getClasses() { HashSet<Class<?>> result = new HashSet<Class<?>>(); // in case of override only the last global configuration must be analyzed JGlobalMap jGlobalMap = null; for (Class<?> clazz : getAllsuperClasses(configuredClass)) { // only if global configuration is null will be searched global configuration on super classes if(isNull(jGlobalMap)){ jGlobalMap = clazz.getAnnotation(JGlobalMap.class); //if the field configuration is defined in the global map if(!isNull(jGlobalMap)){ addClasses(jGlobalMap.classes(),result); if(!isNull(jGlobalMap.excluded())) for (Field field : getListOfFields(configuredClass)){ JMap jMap = field.getAnnotation(JMap.class); if(!isNull(jMap)) for (String fieldName : jGlobalMap.excluded()) if(field.getName().equals(fieldName)) addClasses(jMap.classes(),result,field.getName()); } return result; } } } for (Field field : getListOfFields(configuredClass)){ JMap jMap = field.getAnnotation(JMap.class); if(!isNull(jMap)) addClasses(jMap.classes(),result,field.getName()); } return result; }
[ "private", "Set", "<", "Class", "<", "?", ">", ">", "getClasses", "(", ")", "{", "HashSet", "<", "Class", "<", "?", ">", ">", "result", "=", "new", "HashSet", "<", "Class", "<", "?", ">", ">", "(", ")", ";", "// in case of override only the last global configuration must be analyzed\r", "JGlobalMap", "jGlobalMap", "=", "null", ";", "for", "(", "Class", "<", "?", ">", "clazz", ":", "getAllsuperClasses", "(", "configuredClass", ")", ")", "{", "// only if global configuration is null will be searched global configuration on super classes\r", "if", "(", "isNull", "(", "jGlobalMap", ")", ")", "{", "jGlobalMap", "=", "clazz", ".", "getAnnotation", "(", "JGlobalMap", ".", "class", ")", ";", "//if the field configuration is defined in the global map\r", "if", "(", "!", "isNull", "(", "jGlobalMap", ")", ")", "{", "addClasses", "(", "jGlobalMap", ".", "classes", "(", ")", ",", "result", ")", ";", "if", "(", "!", "isNull", "(", "jGlobalMap", ".", "excluded", "(", ")", ")", ")", "for", "(", "Field", "field", ":", "getListOfFields", "(", "configuredClass", ")", ")", "{", "JMap", "jMap", "=", "field", ".", "getAnnotation", "(", "JMap", ".", "class", ")", ";", "if", "(", "!", "isNull", "(", "jMap", ")", ")", "for", "(", "String", "fieldName", ":", "jGlobalMap", ".", "excluded", "(", ")", ")", "if", "(", "field", ".", "getName", "(", ")", ".", "equals", "(", "fieldName", ")", ")", "addClasses", "(", "jMap", ".", "classes", "(", ")", ",", "result", ",", "field", ".", "getName", "(", ")", ")", ";", "}", "return", "result", ";", "}", "}", "}", "for", "(", "Field", "field", ":", "getListOfFields", "(", "configuredClass", ")", ")", "{", "JMap", "jMap", "=", "field", ".", "getAnnotation", "(", "JMap", ".", "class", ")", ";", "if", "(", "!", "isNull", "(", "jMap", ")", ")", "addClasses", "(", "jMap", ".", "classes", "(", ")", ",", "result", ",", "field", ".", "getName", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Returns all Target Classes @return a List of Target Classes
[ "Returns", "all", "Target", "Classes" ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java#L235-L270
144,113
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java
RelationalJMapper.destinationClassControl
private <I> I destinationClassControl(Exception exception, Class<I> clazz){ try{ if(clazz == null)throw new IllegalArgumentException("it's mandatory define the destination class"); }catch (Exception e) {JmapperLog.error(e);return null;} return logAndReturnNull(exception); }
java
private <I> I destinationClassControl(Exception exception, Class<I> clazz){ try{ if(clazz == null)throw new IllegalArgumentException("it's mandatory define the destination class"); }catch (Exception e) {JmapperLog.error(e);return null;} return logAndReturnNull(exception); }
[ "private", "<", "I", ">", "I", "destinationClassControl", "(", "Exception", "exception", ",", "Class", "<", "I", ">", "clazz", ")", "{", "try", "{", "if", "(", "clazz", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"it's mandatory define the destination class\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "JmapperLog", ".", "error", "(", "e", ")", ";", "return", "null", ";", "}", "return", "logAndReturnNull", "(", "exception", ")", ";", "}" ]
This method verifies that the destinationClass exists. @param exception exception to handle @param clazz class to check @return a new instance of Class given as input
[ "This", "method", "verifies", "that", "the", "destinationClass", "exists", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java#L315-L320
144,114
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java
RelationalJMapper.getJMapper
private <D,S> JMapper<D,S> getJMapper(HashMap<String,JMapper> map,Object source){ Class<?> sourceClass = source instanceof Class?((Class<?>)source):source.getClass(); JMapper<D,S> jMapper = map.get(sourceClass.getName()); if(jMapper == null) Error.classNotMapped(source, configuredClass); return jMapper; }
java
private <D,S> JMapper<D,S> getJMapper(HashMap<String,JMapper> map,Object source){ Class<?> sourceClass = source instanceof Class?((Class<?>)source):source.getClass(); JMapper<D,S> jMapper = map.get(sourceClass.getName()); if(jMapper == null) Error.classNotMapped(source, configuredClass); return jMapper; }
[ "private", "<", "D", ",", "S", ">", "JMapper", "<", "D", ",", "S", ">", "getJMapper", "(", "HashMap", "<", "String", ",", "JMapper", ">", "map", ",", "Object", "source", ")", "{", "Class", "<", "?", ">", "sourceClass", "=", "source", "instanceof", "Class", "?", "(", "(", "Class", "<", "?", ">", ")", "source", ")", ":", "source", ".", "getClass", "(", ")", ";", "JMapper", "<", "D", ",", "S", ">", "jMapper", "=", "map", ".", "get", "(", "sourceClass", ".", "getName", "(", ")", ")", ";", "if", "(", "jMapper", "==", "null", ")", "Error", ".", "classNotMapped", "(", "source", ",", "configuredClass", ")", ";", "return", "jMapper", ";", "}" ]
Returns the desired JMapper instance. @param map the map of relationships @param source key of the map @return the instance of JMapper
[ "Returns", "the", "desired", "JMapper", "instance", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java#L327-L332
144,115
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/api/Global.java
Global.excludedAttributes
public Global excludedAttributes(String... attributes){ for (String attribute : attributes) global.excluded.add(new XmlExcludedAttribute(attribute)); return this; }
java
public Global excludedAttributes(String... attributes){ for (String attribute : attributes) global.excluded.add(new XmlExcludedAttribute(attribute)); return this; }
[ "public", "Global", "excludedAttributes", "(", "String", "...", "attributes", ")", "{", "for", "(", "String", "attribute", ":", "attributes", ")", "global", ".", "excluded", ".", "(", "new", "XmlExcludedAttribute", "(", "attribute", ")", ")", ";", "return", "this", ";", "}" ]
Attributes to exclude from mapping. @param attributes excluded attributes @return this instance of JMapperGlobal
[ "Attributes", "to", "exclude", "from", "mapping", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/api/Global.java#L86-L92
144,116
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/api/Global.java
Global.targetClasses
public Global targetClasses(Class<?>... classes){ for (Class<?> targetClass : classes) global.classes.add(new TargetClass(targetClass).toXStream()); return this; }
java
public Global targetClasses(Class<?>... classes){ for (Class<?> targetClass : classes) global.classes.add(new TargetClass(targetClass).toXStream()); return this; }
[ "public", "Global", "targetClasses", "(", "Class", "<", "?", ">", "...", "classes", ")", "{", "for", "(", "Class", "<", "?", ">", "targetClass", ":", "classes", ")", "global", ".", "classes", ".", "(", "new", "TargetClass", "(", "targetClass", ")", ".", "toXStream", "(", ")", ")", ";", "return", "this", ";", "}" ]
Target classes. @param classes target classes @return this instance of JMapperGlobal
[ "Target", "classes", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/api/Global.java#L99-L105
144,117
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/operations/OperationAnalyzer.java
OperationAnalyzer.isUndefined
public boolean isUndefined(final Field destination,final Field source) { info = null; for (IOperationAnalyzer analyzer : analyzers) if(analyzer.verifyConditions(destination,source)) info = analyzer.getInfoOperation(destination, source); // if the operation has not been identified if(isNull(info)) info = undefinedOperation(); boolean conversionMethodExists = conversionAnalyzer.fieldsToCheck(destination,source); OperationType operationType = info.getOperationType(); if(operationType.isUndefined() && !conversionMethodExists)return true; if(conversionMethodExists) // explicit conversion between primitive types info.setInstructionType(operationType.isBasic()?OperationType.BASIC_CONVERSION // explicit conversion between complex types :OperationType.CONVERSION); return false; }
java
public boolean isUndefined(final Field destination,final Field source) { info = null; for (IOperationAnalyzer analyzer : analyzers) if(analyzer.verifyConditions(destination,source)) info = analyzer.getInfoOperation(destination, source); // if the operation has not been identified if(isNull(info)) info = undefinedOperation(); boolean conversionMethodExists = conversionAnalyzer.fieldsToCheck(destination,source); OperationType operationType = info.getOperationType(); if(operationType.isUndefined() && !conversionMethodExists)return true; if(conversionMethodExists) // explicit conversion between primitive types info.setInstructionType(operationType.isBasic()?OperationType.BASIC_CONVERSION // explicit conversion between complex types :OperationType.CONVERSION); return false; }
[ "public", "boolean", "isUndefined", "(", "final", "Field", "destination", ",", "final", "Field", "source", ")", "{", "info", "=", "null", ";", "for", "(", "IOperationAnalyzer", "analyzer", ":", "analyzers", ")", "if", "(", "analyzer", ".", "verifyConditions", "(", "destination", ",", "source", ")", ")", "info", "=", "analyzer", ".", "getInfoOperation", "(", "destination", ",", "source", ")", ";", "// if the operation has not been identified\r", "if", "(", "isNull", "(", "info", ")", ")", "info", "=", "undefinedOperation", "(", ")", ";", "boolean", "conversionMethodExists", "=", "conversionAnalyzer", ".", "fieldsToCheck", "(", "destination", ",", "source", ")", ";", "OperationType", "operationType", "=", "info", ".", "getOperationType", "(", ")", ";", "if", "(", "operationType", ".", "isUndefined", "(", ")", "&&", "!", "conversionMethodExists", ")", "return", "true", ";", "if", "(", "conversionMethodExists", ")", "// explicit conversion between primitive types\r", "info", ".", "setInstructionType", "(", "operationType", ".", "isBasic", "(", ")", "?", "OperationType", ".", "BASIC_CONVERSION", "// explicit conversion between complex types\r", ":", "OperationType", ".", "CONVERSION", ")", ";", "return", "false", ";", "}" ]
This method analyzes the fields, calculates the info and returns true if operation is undefined. @param destination destination field @param source source field @return returns true if an operation between fields exists @see InfoOperation
[ "This", "method", "analyzes", "the", "fields", "calculates", "the", "info", "and", "returns", "true", "if", "operation", "is", "undefined", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/OperationAnalyzer.java#L75-L97
144,118
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/ConfigReader.java
ConfigReader.getValue
private String getValue(final String value, final String mappedFieldName) { if (isNull(value)) return null; return value.equals(DEFAULT_FIELD_VALUE)?mappedFieldName:value; }
java
private String getValue(final String value, final String mappedFieldName) { if (isNull(value)) return null; return value.equals(DEFAULT_FIELD_VALUE)?mappedFieldName:value; }
[ "private", "String", "getValue", "(", "final", "String", "value", ",", "final", "String", "mappedFieldName", ")", "{", "if", "(", "isNull", "(", "value", ")", ")", "return", "null", ";", "return", "value", ".", "equals", "(", "DEFAULT_FIELD_VALUE", ")", "?", "mappedFieldName", ":", "value", ";", "}" ]
This method compare the name of the target field with the DEFAULT_FIELD_VALUE and returns the final value. @param value configuration parameter @param mappedFieldName name of the configured field @return the name of target field @see Constants#DEFAULT_FIELD_VALUE
[ "This", "method", "compare", "the", "name", "of", "the", "target", "field", "with", "the", "DEFAULT_FIELD_VALUE", "and", "returns", "the", "final", "value", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/ConfigReader.java#L70-L75
144,119
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/ConfigReader.java
ConfigReader.getValue
private String getValue(final List<String> attributes,final List<Class<?>> classes,String value,final String mappedFieldName,final Class<?> configuredClass,final Class<?> targetClass){ String regex = getValue(value,mappedFieldName); String mappedClassName = configuredClass.getSimpleName(); String targetClassName = targetClass.getSimpleName(); /* IF ATTRIBUTES AND CLASSES ARE EMPTY */ if( attributes.isEmpty() && classes.isEmpty() ){ String targetFieldName = fieldName(targetClass,regex); if(!isNull(targetFieldName)) return targetFieldName; Error.mapping(mappedFieldName, mappedClassName, regex, targetClassName); } /* IF ATTRIBUTES IS EMPTY AND CLASSES NOT */ if( attributes.isEmpty() && !classes.isEmpty() ){ if(classes.contains(targetClass)){ String targetFieldName = fieldName(targetClass,regex); if(!isNull(targetFieldName)) return targetFieldName; } Error.mapping(mappedFieldName, mappedClassName, regex, targetClassName); } /* IF ATTRIBUTES AND CLASSES ARE VALUED AND THEY HAVE THE SAME LENGTH */ if( !attributes.isEmpty() && !classes.isEmpty() ) if(attributes.size()==classes.size()) if(classes.contains(targetClass)){ // get the attribute from attributes, positioned at the same index of targetClass in classes String targetClassValue = attributes.get(classes.indexOf(targetClass)); regex = getValue(targetClassValue,mappedFieldName); String targetFieldName = fieldName(targetClass,regex); if(!isNull(targetFieldName)) return targetFieldName; Error.mapping(mappedFieldName, mappedClassName, regex, targetClassName); }else Error.mapping(mappedFieldName, mappedClassName, targetClassName); else Error.mapping(mappedFieldName, mappedClassName); /* IF ATTRIBUTES IS FULL AND CLASSES IS EMPTY */ if( !attributes.isEmpty() && classes.isEmpty() ) for (String str : attributes){ regex = getValue(str,mappedFieldName); // if exist the target field in targetClass String targetFieldName = fieldName(targetClass,regex); if(!isNull(targetFieldName)) //returns the corresponding name return targetFieldName; } Error.mapping(mappedFieldName, configuredClass,targetClass); return "this return is never used"; }
java
private String getValue(final List<String> attributes,final List<Class<?>> classes,String value,final String mappedFieldName,final Class<?> configuredClass,final Class<?> targetClass){ String regex = getValue(value,mappedFieldName); String mappedClassName = configuredClass.getSimpleName(); String targetClassName = targetClass.getSimpleName(); /* IF ATTRIBUTES AND CLASSES ARE EMPTY */ if( attributes.isEmpty() && classes.isEmpty() ){ String targetFieldName = fieldName(targetClass,regex); if(!isNull(targetFieldName)) return targetFieldName; Error.mapping(mappedFieldName, mappedClassName, regex, targetClassName); } /* IF ATTRIBUTES IS EMPTY AND CLASSES NOT */ if( attributes.isEmpty() && !classes.isEmpty() ){ if(classes.contains(targetClass)){ String targetFieldName = fieldName(targetClass,regex); if(!isNull(targetFieldName)) return targetFieldName; } Error.mapping(mappedFieldName, mappedClassName, regex, targetClassName); } /* IF ATTRIBUTES AND CLASSES ARE VALUED AND THEY HAVE THE SAME LENGTH */ if( !attributes.isEmpty() && !classes.isEmpty() ) if(attributes.size()==classes.size()) if(classes.contains(targetClass)){ // get the attribute from attributes, positioned at the same index of targetClass in classes String targetClassValue = attributes.get(classes.indexOf(targetClass)); regex = getValue(targetClassValue,mappedFieldName); String targetFieldName = fieldName(targetClass,regex); if(!isNull(targetFieldName)) return targetFieldName; Error.mapping(mappedFieldName, mappedClassName, regex, targetClassName); }else Error.mapping(mappedFieldName, mappedClassName, targetClassName); else Error.mapping(mappedFieldName, mappedClassName); /* IF ATTRIBUTES IS FULL AND CLASSES IS EMPTY */ if( !attributes.isEmpty() && classes.isEmpty() ) for (String str : attributes){ regex = getValue(str,mappedFieldName); // if exist the target field in targetClass String targetFieldName = fieldName(targetClass,regex); if(!isNull(targetFieldName)) //returns the corresponding name return targetFieldName; } Error.mapping(mappedFieldName, configuredClass,targetClass); return "this return is never used"; }
[ "private", "String", "getValue", "(", "final", "List", "<", "String", ">", "attributes", ",", "final", "List", "<", "Class", "<", "?", ">", ">", "classes", ",", "String", "value", ",", "final", "String", "mappedFieldName", ",", "final", "Class", "<", "?", ">", "configuredClass", ",", "final", "Class", "<", "?", ">", "targetClass", ")", "{", "String", "regex", "=", "getValue", "(", "value", ",", "mappedFieldName", ")", ";", "String", "mappedClassName", "=", "configuredClass", ".", "getSimpleName", "(", ")", ";", "String", "targetClassName", "=", "targetClass", ".", "getSimpleName", "(", ")", ";", "/* \t\tIF ATTRIBUTES AND CLASSES ARE EMPTY\t\t */", "if", "(", "attributes", ".", "isEmpty", "(", ")", "&&", "classes", ".", "isEmpty", "(", ")", ")", "{", "String", "targetFieldName", "=", "fieldName", "(", "targetClass", ",", "regex", ")", ";", "if", "(", "!", "isNull", "(", "targetFieldName", ")", ")", "return", "targetFieldName", ";", "Error", ".", "mapping", "(", "mappedFieldName", ",", "mappedClassName", ",", "regex", ",", "targetClassName", ")", ";", "}", "/* \t\tIF ATTRIBUTES IS EMPTY AND CLASSES NOT\t\t */", "if", "(", "attributes", ".", "isEmpty", "(", ")", "&&", "!", "classes", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "classes", ".", "contains", "(", "targetClass", ")", ")", "{", "String", "targetFieldName", "=", "fieldName", "(", "targetClass", ",", "regex", ")", ";", "if", "(", "!", "isNull", "(", "targetFieldName", ")", ")", "return", "targetFieldName", ";", "}", "Error", ".", "mapping", "(", "mappedFieldName", ",", "mappedClassName", ",", "regex", ",", "targetClassName", ")", ";", "}", "/* \t\tIF ATTRIBUTES AND CLASSES ARE VALUED AND THEY HAVE THE SAME LENGTH\t\t */", "if", "(", "!", "attributes", ".", "isEmpty", "(", ")", "&&", "!", "classes", ".", "isEmpty", "(", ")", ")", "if", "(", "attributes", ".", "size", "(", ")", "==", "classes", ".", "size", "(", ")", ")", "if", "(", "classes", ".", "contains", "(", "targetClass", ")", ")", "{", "// get the attribute from attributes, positioned at the same index of targetClass in classes\r", "String", "targetClassValue", "=", "attributes", ".", "get", "(", "classes", ".", "indexOf", "(", "targetClass", ")", ")", ";", "regex", "=", "getValue", "(", "targetClassValue", ",", "mappedFieldName", ")", ";", "String", "targetFieldName", "=", "fieldName", "(", "targetClass", ",", "regex", ")", ";", "if", "(", "!", "isNull", "(", "targetFieldName", ")", ")", "return", "targetFieldName", ";", "Error", ".", "mapping", "(", "mappedFieldName", ",", "mappedClassName", ",", "regex", ",", "targetClassName", ")", ";", "}", "else", "Error", ".", "mapping", "(", "mappedFieldName", ",", "mappedClassName", ",", "targetClassName", ")", ";", "else", "Error", ".", "mapping", "(", "mappedFieldName", ",", "mappedClassName", ")", ";", "/* \t\tIF ATTRIBUTES IS FULL AND CLASSES IS EMPTY\t\t */", "if", "(", "!", "attributes", ".", "isEmpty", "(", ")", "&&", "classes", ".", "isEmpty", "(", ")", ")", "for", "(", "String", "str", ":", "attributes", ")", "{", "regex", "=", "getValue", "(", "str", ",", "mappedFieldName", ")", ";", "// if exist the target field in targetClass \r", "String", "targetFieldName", "=", "fieldName", "(", "targetClass", ",", "regex", ")", ";", "if", "(", "!", "isNull", "(", "targetFieldName", ")", ")", "//returns the corresponding name\r", "return", "targetFieldName", ";", "}", "Error", ".", "mapping", "(", "mappedFieldName", ",", "configuredClass", ",", "targetClass", ")", ";", "return", "\"this return is never used\"", ";", "}" ]
This method finds the target field name from mapped parameters. @param attributes target list of field names @param classes list of target classes @param value name of target attribute @param mappedFieldName name of mapped attribute @param configuredClass configured Class @param targetClass target Class @return the name of the target field if exist, null otherwise
[ "This", "method", "finds", "the", "target", "field", "name", "from", "mapped", "parameters", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/ConfigReader.java#L87-L145
144,120
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/ConfigReader.java
ConfigReader.loadAccessors
public void loadAccessors(Class<?> targetClass, MappedField configuredField, MappedField targetField) { // First checks xml configuration xml.fillMappedField(configuredClass, configuredField) .fillMappedField(targetClass, targetField) // fill target field with custom methods defined in the configured field .fillOppositeField(configuredClass, configuredField, targetField); // If no present custom methods in XML, it checks annotations Annotation.fillMappedField(configuredClass,configuredField); Annotation.fillMappedField(targetClass,targetField); // fill target field with custom methods defined in the configured field Annotation.fillOppositeField(configuredClass,configuredField,targetField); }
java
public void loadAccessors(Class<?> targetClass, MappedField configuredField, MappedField targetField) { // First checks xml configuration xml.fillMappedField(configuredClass, configuredField) .fillMappedField(targetClass, targetField) // fill target field with custom methods defined in the configured field .fillOppositeField(configuredClass, configuredField, targetField); // If no present custom methods in XML, it checks annotations Annotation.fillMappedField(configuredClass,configuredField); Annotation.fillMappedField(targetClass,targetField); // fill target field with custom methods defined in the configured field Annotation.fillOppositeField(configuredClass,configuredField,targetField); }
[ "public", "void", "loadAccessors", "(", "Class", "<", "?", ">", "targetClass", ",", "MappedField", "configuredField", ",", "MappedField", "targetField", ")", "{", "// First checks xml configuration\r", "xml", ".", "fillMappedField", "(", "configuredClass", ",", "configuredField", ")", ".", "fillMappedField", "(", "targetClass", ",", "targetField", ")", "// fill target field with custom methods defined in the configured field\r", ".", "fillOppositeField", "(", "configuredClass", ",", "configuredField", ",", "targetField", ")", ";", "// If no present custom methods in XML, it checks annotations\r", "Annotation", ".", "fillMappedField", "(", "configuredClass", ",", "configuredField", ")", ";", "Annotation", ".", "fillMappedField", "(", "targetClass", ",", "targetField", ")", ";", "// fill target field with custom methods defined in the configured field\r", "Annotation", ".", "fillOppositeField", "(", "configuredClass", ",", "configuredField", ",", "targetField", ")", ";", "}" ]
Fill fields with they custom methods. @param targetClass class of the target field @param configuredField configured field @param targetField target field
[ "Fill", "fields", "with", "they", "custom", "methods", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/ConfigReader.java#L301-L315
144,121
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.getConversionMethods
public List<ConversionMethod> getConversionMethods (Class<?> clazz){ List<ConversionMethod> conversions = new ArrayList<ConversionMethod>(); Map<String, List<ConversionMethod>> conversionsMap = this.conversionsLoad(); for (Class<?> classToCheck : getAllsuperClasses(clazz)){ List<ConversionMethod> methods = conversionsMap.get(classToCheck.getName()); if(methods != null)conversions.addAll(methods); } return conversions; }
java
public List<ConversionMethod> getConversionMethods (Class<?> clazz){ List<ConversionMethod> conversions = new ArrayList<ConversionMethod>(); Map<String, List<ConversionMethod>> conversionsMap = this.conversionsLoad(); for (Class<?> classToCheck : getAllsuperClasses(clazz)){ List<ConversionMethod> methods = conversionsMap.get(classToCheck.getName()); if(methods != null)conversions.addAll(methods); } return conversions; }
[ "public", "List", "<", "ConversionMethod", ">", "getConversionMethods", "(", "Class", "<", "?", ">", "clazz", ")", "{", "List", "<", "ConversionMethod", ">", "conversions", "=", "new", "ArrayList", "<", "ConversionMethod", ">", "(", ")", ";", "Map", "<", "String", ",", "List", "<", "ConversionMethod", ">", ">", "conversionsMap", "=", "this", ".", "conversionsLoad", "(", ")", ";", "for", "(", "Class", "<", "?", ">", "classToCheck", ":", "getAllsuperClasses", "(", "clazz", ")", ")", "{", "List", "<", "ConversionMethod", ">", "methods", "=", "conversionsMap", ".", "get", "(", "classToCheck", ".", "getName", "(", ")", ")", ";", "if", "(", "methods", "!=", "null", ")", "conversions", ".", "addAll", "(", "methods", ")", ";", "}", "return", "conversions", ";", "}" ]
Returns the conversions method belonging to clazz. @param clazz class to check @return the conversion method list
[ "Returns", "the", "conversions", "method", "belonging", "to", "clazz", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L188-L196
144,122
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.getClasses
public List<String> getClasses(){ List<String> classes = new ArrayList<String>(); for (XmlClass xmlClass : xmlJmapper.classes) classes.add(xmlClass.name); return classes; }
java
public List<String> getClasses(){ List<String> classes = new ArrayList<String>(); for (XmlClass xmlClass : xmlJmapper.classes) classes.add(xmlClass.name); return classes; }
[ "public", "List", "<", "String", ">", "getClasses", "(", ")", "{", "List", "<", "String", ">", "classes", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "XmlClass", "xmlClass", ":", "xmlJmapper", ".", "classes", ")", "classes", ".", "(", "xmlClass", ".", "name", ")", ";", "return", "classes", ";", "}" ]
Returns a list with the classes names presents in xml mapping file. @return a list with the classes names presents in xml mapping file
[ "Returns", "a", "list", "with", "the", "classes", "names", "presents", "in", "xml", "mapping", "file", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L202-L207
144,123
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.write
public XML write(){ try { FilesManager.write(xmlJmapper, xmlPath); } catch (IOException e) {JmapperLog.error(e);} return this; }
java
public XML write(){ try { FilesManager.write(xmlJmapper, xmlPath); } catch (IOException e) {JmapperLog.error(e);} return this; }
[ "public", "XML", "write", "(", ")", "{", "try", "{", "FilesManager", ".", "write", "(", "xmlJmapper", ",", "xmlPath", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "JmapperLog", ".", "error", "(", "e", ")", ";", "}", "return", "this", ";", "}" ]
Writes the xml mapping file starting from xmlJmapper object. @return this instance of XML
[ "Writes", "the", "xml", "mapping", "file", "starting", "from", "xmlJmapper", "object", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L213-L217
144,124
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.deleteClass
public XML deleteClass(Class<?> aClass){ boolean isRemoved = xmlJmapper.classes.remove(new XmlClass(aClass.getName())); if(!isRemoved)Error.xmlClassInexistent(this.xmlPath,aClass); return this; }
java
public XML deleteClass(Class<?> aClass){ boolean isRemoved = xmlJmapper.classes.remove(new XmlClass(aClass.getName())); if(!isRemoved)Error.xmlClassInexistent(this.xmlPath,aClass); return this; }
[ "public", "XML", "deleteClass", "(", "Class", "<", "?", ">", "aClass", ")", "{", "boolean", "isRemoved", "=", "xmlJmapper", ".", "classes", ".", "remove", "(", "new", "XmlClass", "(", "aClass", ".", "getName", "(", ")", ")", ")", ";", "if", "(", "!", "isRemoved", ")", "Error", ".", "xmlClassInexistent", "(", "this", ".", "xmlPath", ",", "aClass", ")", ";", "return", "this", ";", "}" ]
This method remove a specific Class from Xml Configuration File @param aClass class to delete @return this instance of XML
[ "This", "method", "remove", "a", "specific", "Class", "from", "Xml", "Configuration", "File" ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L295-L299
144,125
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.addGlobal
public XML addGlobal(Class<?> aClass,Global global){ checksGlobalAbsence(aClass); findXmlClass(aClass).global = Converter.toXmlGlobal(global); return this; }
java
public XML addGlobal(Class<?> aClass,Global global){ checksGlobalAbsence(aClass); findXmlClass(aClass).global = Converter.toXmlGlobal(global); return this; }
[ "public", "XML", "addGlobal", "(", "Class", "<", "?", ">", "aClass", ",", "Global", "global", ")", "{", "checksGlobalAbsence", "(", "aClass", ")", ";", "findXmlClass", "(", "aClass", ")", ".", "global", "=", "Converter", ".", "toXmlGlobal", "(", "global", ")", ";", "return", "this", ";", "}" ]
This method adds the global to an existing Class. @param aClass class to edit @param global global to add @return this instance of XML
[ "This", "method", "adds", "the", "global", "to", "an", "existing", "Class", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L307-L311
144,126
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.deleteGlobal
public XML deleteGlobal(Class<?> aClass){ checksGlobalExistence(aClass); XmlClass xmlClass = findXmlClass(aClass); if(isEmpty(xmlClass.attributes)) deleteClass(aClass); else xmlClass.global = null; return this; }
java
public XML deleteGlobal(Class<?> aClass){ checksGlobalExistence(aClass); XmlClass xmlClass = findXmlClass(aClass); if(isEmpty(xmlClass.attributes)) deleteClass(aClass); else xmlClass.global = null; return this; }
[ "public", "XML", "deleteGlobal", "(", "Class", "<", "?", ">", "aClass", ")", "{", "checksGlobalExistence", "(", "aClass", ")", ";", "XmlClass", "xmlClass", "=", "findXmlClass", "(", "aClass", ")", ";", "if", "(", "isEmpty", "(", "xmlClass", ".", "attributes", ")", ")", "deleteClass", "(", "aClass", ")", ";", "else", "xmlClass", ".", "global", "=", "null", ";", "return", "this", ";", "}" ]
This method deletes the global to an existing Class. @param aClass class to delete @return this instance of XML
[ "This", "method", "deletes", "the", "global", "to", "an", "existing", "Class", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L318-L325
144,127
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.addAttributes
public XML addAttributes(Class<?> aClass,Attribute[] attributes){ checksAttributesExistence(aClass,attributes); for (Attribute attribute : attributes) { if(attributeExists(aClass,attribute)) Error.xmlAttributeExistent(this.xmlPath,attribute, aClass); findXmlClass(aClass).attributes.add(Converter.toXmlAttribute(attribute)); } return this; }
java
public XML addAttributes(Class<?> aClass,Attribute[] attributes){ checksAttributesExistence(aClass,attributes); for (Attribute attribute : attributes) { if(attributeExists(aClass,attribute)) Error.xmlAttributeExistent(this.xmlPath,attribute, aClass); findXmlClass(aClass).attributes.add(Converter.toXmlAttribute(attribute)); } return this; }
[ "public", "XML", "addAttributes", "(", "Class", "<", "?", ">", "aClass", ",", "Attribute", "[", "]", "attributes", ")", "{", "checksAttributesExistence", "(", "aClass", ",", "attributes", ")", ";", "for", "(", "Attribute", "attribute", ":", "attributes", ")", "{", "if", "(", "attributeExists", "(", "aClass", ",", "attribute", ")", ")", "Error", ".", "xmlAttributeExistent", "(", "this", ".", "xmlPath", ",", "attribute", ",", "aClass", ")", ";", "findXmlClass", "(", "aClass", ")", ".", "attributes", ".", "add", "(", "Converter", ".", "toXmlAttribute", "(", "attribute", ")", ")", ";", "}", "return", "this", ";", "}" ]
This method adds the attributes to an existing Class. @param aClass class to which add attributes @param attributes attributes to add @return this instance of XML
[ "This", "method", "adds", "the", "attributes", "to", "an", "existing", "Class", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L333-L341
144,128
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.deleteAttributes
public XML deleteAttributes(Class<?> aClass,String[] attributes){ checksAttributesExistence(aClass,attributes); if(isEmpty(findXmlClass(aClass).attributes) || findXmlClass(aClass).attributes.size()<=1) Error.xmlWrongMethod(aClass); for (String attributeName : attributes) { XmlAttribute attribute = null; for (XmlAttribute xmlAttribute : findXmlClass(aClass).attributes) if(xmlAttribute.name.equals(attributeName)) attribute = xmlAttribute; if(attribute == null) Error.xmlAttributeInexistent(this.xmlPath,attributeName,aClass); findXmlClass(aClass).attributes.remove(attribute); } return this; }
java
public XML deleteAttributes(Class<?> aClass,String[] attributes){ checksAttributesExistence(aClass,attributes); if(isEmpty(findXmlClass(aClass).attributes) || findXmlClass(aClass).attributes.size()<=1) Error.xmlWrongMethod(aClass); for (String attributeName : attributes) { XmlAttribute attribute = null; for (XmlAttribute xmlAttribute : findXmlClass(aClass).attributes) if(xmlAttribute.name.equals(attributeName)) attribute = xmlAttribute; if(attribute == null) Error.xmlAttributeInexistent(this.xmlPath,attributeName,aClass); findXmlClass(aClass).attributes.remove(attribute); } return this; }
[ "public", "XML", "deleteAttributes", "(", "Class", "<", "?", ">", "aClass", ",", "String", "[", "]", "attributes", ")", "{", "checksAttributesExistence", "(", "aClass", ",", "attributes", ")", ";", "if", "(", "isEmpty", "(", "findXmlClass", "(", "aClass", ")", ".", "attributes", ")", "||", "findXmlClass", "(", "aClass", ")", ".", "attributes", ".", "size", "(", ")", "<=", "1", ")", "Error", ".", "xmlWrongMethod", "(", "aClass", ")", ";", "for", "(", "String", "attributeName", ":", "attributes", ")", "{", "XmlAttribute", "attribute", "=", "null", ";", "for", "(", "XmlAttribute", "xmlAttribute", ":", "findXmlClass", "(", "aClass", ")", ".", "attributes", ")", "if", "(", "xmlAttribute", ".", "name", ".", "equals", "(", "attributeName", ")", ")", "attribute", "=", "xmlAttribute", ";", "if", "(", "attribute", "==", "null", ")", "Error", ".", "xmlAttributeInexistent", "(", "this", ".", "xmlPath", ",", "attributeName", ",", "aClass", ")", ";", "findXmlClass", "(", "aClass", ")", ".", "attributes", ".", "remove", "(", "attribute", ")", ";", "}", "return", "this", ";", "}" ]
This method deletes the attributes to an existing Class. @param aClass class to which delete the attributes @param attributes attributes to delete @return this instance of XML
[ "This", "method", "deletes", "the", "attributes", "to", "an", "existing", "Class", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L349-L366
144,129
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.addClass
private XML addClass(Class<?> aClass){ xmlJmapper.classes.add(Converter.toXmlClass(aClass)); return this; }
java
private XML addClass(Class<?> aClass){ xmlJmapper.classes.add(Converter.toXmlClass(aClass)); return this; }
[ "private", "XML", "addClass", "(", "Class", "<", "?", ">", "aClass", ")", "{", "xmlJmapper", ".", "classes", ".", "add", "(", "Converter", ".", "toXmlClass", "(", "aClass", ")", ")", ";", "return", "this", ";", "}" ]
Adds an annotated Class to xmlJmapper structure. @param aClass Class to convert to XmlClass @return this instance of XML
[ "Adds", "an", "annotated", "Class", "to", "xmlJmapper", "structure", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L372-L375
144,130
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.checksClassAbsence
private XML checksClassAbsence(Class<?> aClass){ if(classExists(aClass))Error.xmlClassExistent(this.xmlPath,aClass); return this; }
java
private XML checksClassAbsence(Class<?> aClass){ if(classExists(aClass))Error.xmlClassExistent(this.xmlPath,aClass); return this; }
[ "private", "XML", "checksClassAbsence", "(", "Class", "<", "?", ">", "aClass", ")", "{", "if", "(", "classExists", "(", "aClass", ")", ")", "Error", ".", "xmlClassExistent", "(", "this", ".", "xmlPath", ",", "aClass", ")", ";", "return", "this", ";", "}" ]
Throws an exception if the class exist. @param aClass a Class to check @return this instance of XML
[ "Throws", "an", "exception", "if", "the", "class", "exist", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L433-L436
144,131
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.classExists
private boolean classExists(Class<?> aClass) { if(xmlJmapper.classes == null)return false; return findXmlClass(aClass) !=null?true:false; }
java
private boolean classExists(Class<?> aClass) { if(xmlJmapper.classes == null)return false; return findXmlClass(aClass) !=null?true:false; }
[ "private", "boolean", "classExists", "(", "Class", "<", "?", ">", "aClass", ")", "{", "if", "(", "xmlJmapper", ".", "classes", "==", "null", ")", "return", "false", ";", "return", "findXmlClass", "(", "aClass", ")", "!=", "null", "?", "true", ":", "false", ";", "}" ]
verifies that this class exist in Xml Configuration File. @param aClass Class to verify @return this instance
[ "verifies", "that", "this", "class", "exist", "in", "Xml", "Configuration", "File", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L443-L446
144,132
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.attributeExists
private boolean attributeExists(Class<?> aClass,Attribute attribute){ if(!classExists(aClass))return false; for (XmlAttribute xmlAttribute : findXmlClass(aClass).attributes) if(xmlAttribute.name.equals(attribute.getName()))return true; return false; }
java
private boolean attributeExists(Class<?> aClass,Attribute attribute){ if(!classExists(aClass))return false; for (XmlAttribute xmlAttribute : findXmlClass(aClass).attributes) if(xmlAttribute.name.equals(attribute.getName()))return true; return false; }
[ "private", "boolean", "attributeExists", "(", "Class", "<", "?", ">", "aClass", ",", "Attribute", "attribute", ")", "{", "if", "(", "!", "classExists", "(", "aClass", ")", ")", "return", "false", ";", "for", "(", "XmlAttribute", "xmlAttribute", ":", "findXmlClass", "(", "aClass", ")", ".", "attributes", ")", "if", "(", "xmlAttribute", ".", "name", ".", "equals", "(", "attribute", ".", "getName", "(", ")", ")", ")", "return", "true", ";", "return", "false", ";", "}" ]
This method returns true if the attribute exist in the Class given in input, returns false otherwise. @param aClass Class of the Attribute @param attribute Attribute to check @return true if attribute exist, false otherwise
[ "This", "method", "returns", "true", "if", "the", "attribute", "exist", "in", "the", "Class", "given", "in", "input", "returns", "false", "otherwise", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L454-L460
144,133
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.findXmlClass
private XmlClass findXmlClass(Class<?> aClass){ for (XmlClass xmlClass : xmlJmapper.classes) if(xmlClass.name.equals(aClass.getName())) return xmlClass; return null; }
java
private XmlClass findXmlClass(Class<?> aClass){ for (XmlClass xmlClass : xmlJmapper.classes) if(xmlClass.name.equals(aClass.getName())) return xmlClass; return null; }
[ "private", "XmlClass", "findXmlClass", "(", "Class", "<", "?", ">", "aClass", ")", "{", "for", "(", "XmlClass", "xmlClass", ":", "xmlJmapper", ".", "classes", ")", "if", "(", "xmlClass", ".", "name", ".", "equals", "(", "aClass", ".", "getName", "(", ")", ")", ")", "return", "xmlClass", ";", "return", "null", ";", "}" ]
Finds the Class, given in input, in the xml mapping file and returns a XmlClass instance if exist, null otherwise. @param aClass Class to finds @return a XmlClass if aClass exist in xml mapping file, null otherwise
[ "Finds", "the", "Class", "given", "in", "input", "in", "the", "xml", "mapping", "file", "and", "returns", "a", "XmlClass", "instance", "if", "exist", "null", "otherwise", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L467-L471
144,134
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.isMapped
public boolean isMapped(Class<?> classToCheck){ return !isNull(loadGlobals().get(classToCheck.getName())) || !isEmpty(loadAttributes().get(classToCheck.getName())); }
java
public boolean isMapped(Class<?> classToCheck){ return !isNull(loadGlobals().get(classToCheck.getName())) || !isEmpty(loadAttributes().get(classToCheck.getName())); }
[ "public", "boolean", "isMapped", "(", "Class", "<", "?", ">", "classToCheck", ")", "{", "return", "!", "isNull", "(", "loadGlobals", "(", ")", ".", "get", "(", "classToCheck", ".", "getName", "(", ")", ")", ")", "||", "!", "isEmpty", "(", "loadAttributes", "(", ")", ".", "get", "(", "classToCheck", ".", "getName", "(", ")", ")", ")", ";", "}" ]
Returns true if the class is configured in xml, false otherwise. @param classToCheck class to check @return true if the class is configured in xml, false otherwise
[ "Returns", "true", "if", "the", "class", "is", "configured", "in", "xml", "false", "otherwise", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L491-L494
144,135
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.fillMappedField
public XML fillMappedField(Class<?> configuredClass, MappedField configuredField) { Attribute attribute = getGlobalAttribute(configuredField, configuredClass); if(isNull(attribute)) attribute = getAttribute(configuredField, configuredClass); if(!isNull(attribute)){ if(isEmpty(configuredField.getMethod())) configuredField.getMethod(attribute.getGet()); if(isEmpty(configuredField.setMethod())) configuredField.setMethod(attribute.getSet()); } return this; }
java
public XML fillMappedField(Class<?> configuredClass, MappedField configuredField) { Attribute attribute = getGlobalAttribute(configuredField, configuredClass); if(isNull(attribute)) attribute = getAttribute(configuredField, configuredClass); if(!isNull(attribute)){ if(isEmpty(configuredField.getMethod())) configuredField.getMethod(attribute.getGet()); if(isEmpty(configuredField.setMethod())) configuredField.setMethod(attribute.getSet()); } return this; }
[ "public", "XML", "fillMappedField", "(", "Class", "<", "?", ">", "configuredClass", ",", "MappedField", "configuredField", ")", "{", "Attribute", "attribute", "=", "getGlobalAttribute", "(", "configuredField", ",", "configuredClass", ")", ";", "if", "(", "isNull", "(", "attribute", ")", ")", "attribute", "=", "getAttribute", "(", "configuredField", ",", "configuredClass", ")", ";", "if", "(", "!", "isNull", "(", "attribute", ")", ")", "{", "if", "(", "isEmpty", "(", "configuredField", ".", "getMethod", "(", ")", ")", ")", "configuredField", ".", "getMethod", "(", "attribute", ".", "getGet", "(", ")", ")", ";", "if", "(", "isEmpty", "(", "configuredField", ".", "setMethod", "(", ")", ")", ")", "configuredField", ".", "setMethod", "(", "attribute", ".", "getSet", "(", ")", ")", ";", "}", "return", "this", ";", "}" ]
Enrich configuredField with get and set define in xml configuration. @param configuredClass class of field @param configuredField configured field @return this
[ "Enrich", "configuredField", "with", "get", "and", "set", "define", "in", "xml", "configuration", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L557-L571
144,136
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java
XML.fillOppositeField
public XML fillOppositeField(Class<?> configuredClass, MappedField configuredField, MappedField targetField) { Attribute attribute = null; Global global = loadGlobals().get(configuredClass.getName()); if(!isNull(global)){ String value = global.getValue(); if(!isEmpty(value) && value.equals(targetField.getValue().getName())){ String get = global.getGet(); String set = global.getSet(); if(!isNull(get) || !isNull(set)) attribute = new Attribute(null,new Value(global.getValue(),get,set)); } } if(isNull(attribute)) attribute = getAttribute(configuredField, configuredClass); if(!isNull(attribute)){ Value value = attribute.getValue(); // verifies value if(!isNull(value)) if(targetField.getValue().getName().equals(value.getName())){ if(isEmpty(targetField.getMethod())) targetField.getMethod(value.getGet()); if(isEmpty(targetField.setMethod())) targetField.setMethod(value.getSet()); } SimplyAttribute[] attributes = attribute.getAttributes(); // verifies attributes if(!isNull(attributes)) for (SimplyAttribute targetAttribute : attributes) if(targetField.getValue().getName().equals(targetAttribute.getName())){ if(isEmpty(targetField.getMethod())) targetField.getMethod(targetAttribute.getGet()); if(isEmpty(targetField.setMethod())) targetField.setMethod(targetAttribute.getSet()); } } return this; }
java
public XML fillOppositeField(Class<?> configuredClass, MappedField configuredField, MappedField targetField) { Attribute attribute = null; Global global = loadGlobals().get(configuredClass.getName()); if(!isNull(global)){ String value = global.getValue(); if(!isEmpty(value) && value.equals(targetField.getValue().getName())){ String get = global.getGet(); String set = global.getSet(); if(!isNull(get) || !isNull(set)) attribute = new Attribute(null,new Value(global.getValue(),get,set)); } } if(isNull(attribute)) attribute = getAttribute(configuredField, configuredClass); if(!isNull(attribute)){ Value value = attribute.getValue(); // verifies value if(!isNull(value)) if(targetField.getValue().getName().equals(value.getName())){ if(isEmpty(targetField.getMethod())) targetField.getMethod(value.getGet()); if(isEmpty(targetField.setMethod())) targetField.setMethod(value.getSet()); } SimplyAttribute[] attributes = attribute.getAttributes(); // verifies attributes if(!isNull(attributes)) for (SimplyAttribute targetAttribute : attributes) if(targetField.getValue().getName().equals(targetAttribute.getName())){ if(isEmpty(targetField.getMethod())) targetField.getMethod(targetAttribute.getGet()); if(isEmpty(targetField.setMethod())) targetField.setMethod(targetAttribute.getSet()); } } return this; }
[ "public", "XML", "fillOppositeField", "(", "Class", "<", "?", ">", "configuredClass", ",", "MappedField", "configuredField", ",", "MappedField", "targetField", ")", "{", "Attribute", "attribute", "=", "null", ";", "Global", "global", "=", "loadGlobals", "(", ")", ".", "get", "(", "configuredClass", ".", "getName", "(", ")", ")", ";", "if", "(", "!", "isNull", "(", "global", ")", ")", "{", "String", "value", "=", "global", ".", "getValue", "(", ")", ";", "if", "(", "!", "isEmpty", "(", "value", ")", "&&", "value", ".", "equals", "(", "targetField", ".", "getValue", "(", ")", ".", "getName", "(", ")", ")", ")", "{", "String", "get", "=", "global", ".", "getGet", "(", ")", ";", "String", "set", "=", "global", ".", "getSet", "(", ")", ";", "if", "(", "!", "isNull", "(", "get", ")", "||", "!", "isNull", "(", "set", ")", ")", "attribute", "=", "new", "Attribute", "(", "null", ",", "new", "Value", "(", "global", ".", "getValue", "(", ")", ",", "get", ",", "set", ")", ")", ";", "}", "}", "if", "(", "isNull", "(", "attribute", ")", ")", "attribute", "=", "getAttribute", "(", "configuredField", ",", "configuredClass", ")", ";", "if", "(", "!", "isNull", "(", "attribute", ")", ")", "{", "Value", "value", "=", "attribute", ".", "getValue", "(", ")", ";", "// verifies value\r", "if", "(", "!", "isNull", "(", "value", ")", ")", "if", "(", "targetField", ".", "getValue", "(", ")", ".", "getName", "(", ")", ".", "equals", "(", "value", ".", "getName", "(", ")", ")", ")", "{", "if", "(", "isEmpty", "(", "targetField", ".", "getMethod", "(", ")", ")", ")", "targetField", ".", "getMethod", "(", "value", ".", "getGet", "(", ")", ")", ";", "if", "(", "isEmpty", "(", "targetField", ".", "setMethod", "(", ")", ")", ")", "targetField", ".", "setMethod", "(", "value", ".", "getSet", "(", ")", ")", ";", "}", "SimplyAttribute", "[", "]", "attributes", "=", "attribute", ".", "getAttributes", "(", ")", ";", "// verifies attributes\r", "if", "(", "!", "isNull", "(", "attributes", ")", ")", "for", "(", "SimplyAttribute", "targetAttribute", ":", "attributes", ")", "if", "(", "targetField", ".", "getValue", "(", ")", ".", "getName", "(", ")", ".", "equals", "(", "targetAttribute", ".", "getName", "(", ")", ")", ")", "{", "if", "(", "isEmpty", "(", "targetField", ".", "getMethod", "(", ")", ")", ")", "targetField", ".", "getMethod", "(", "targetAttribute", ".", "getGet", "(", ")", ")", ";", "if", "(", "isEmpty", "(", "targetField", ".", "setMethod", "(", ")", ")", ")", "targetField", ".", "setMethod", "(", "targetAttribute", ".", "getSet", "(", ")", ")", ";", "}", "}", "return", "this", ";", "}" ]
Enrich targetField with get and set define in xml configuration. @param configuredClass class of field @param configuredField configured field @param targetField the opposite field to enrich @return this
[ "Enrich", "targetField", "with", "get", "and", "set", "define", "in", "xml", "configuration", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/xml/XML.java#L580-L623
144,137
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/operations/NestedMappingHandler.java
NestedMappingHandler.safeNavigationOperatorDefined
public static boolean safeNavigationOperatorDefined(String nestedFieldName){ if(nestedFieldName.contains(SAFE_NAVIGATION_OPERATOR)) if(!nestedFieldName.startsWith(SAFE_NAVIGATION_OPERATOR)) //TODO standardizzare exception throw new MappingException("Safe navigation operator must be the first symbol after dot notation"); else return true; return false; }
java
public static boolean safeNavigationOperatorDefined(String nestedFieldName){ if(nestedFieldName.contains(SAFE_NAVIGATION_OPERATOR)) if(!nestedFieldName.startsWith(SAFE_NAVIGATION_OPERATOR)) //TODO standardizzare exception throw new MappingException("Safe navigation operator must be the first symbol after dot notation"); else return true; return false; }
[ "public", "static", "boolean", "safeNavigationOperatorDefined", "(", "String", "nestedFieldName", ")", "{", "if", "(", "nestedFieldName", ".", "contains", "(", "SAFE_NAVIGATION_OPERATOR", ")", ")", "if", "(", "!", "nestedFieldName", ".", "startsWith", "(", "SAFE_NAVIGATION_OPERATOR", ")", ")", "//TODO standardizzare exception\r", "throw", "new", "MappingException", "(", "\"Safe navigation operator must be the first symbol after dot notation\"", ")", ";", "else", "return", "true", ";", "return", "false", ";", "}" ]
It checks the presence of the elvis operator and how it is used. @param nestedFieldName field name to check @return true if is used an elvis operator, false otherwise, for all other cases a MappingException will be thrown
[ "It", "checks", "the", "presence", "of", "the", "elvis", "operator", "and", "how", "it", "is", "used", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/NestedMappingHandler.java#L70-L79
144,138
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/operations/NestedMappingHandler.java
NestedMappingHandler.checkGetAccessor
private static MappedField checkGetAccessor(XML xml, Class<?> aClass, Field nestedField){ MappedField field = new MappedField(nestedField); xml.fillMappedField(aClass, field); Annotation.fillMappedField(aClass,field); verifyGetterMethods(aClass,field); return field; }
java
private static MappedField checkGetAccessor(XML xml, Class<?> aClass, Field nestedField){ MappedField field = new MappedField(nestedField); xml.fillMappedField(aClass, field); Annotation.fillMappedField(aClass,field); verifyGetterMethods(aClass,field); return field; }
[ "private", "static", "MappedField", "checkGetAccessor", "(", "XML", "xml", ",", "Class", "<", "?", ">", "aClass", ",", "Field", "nestedField", ")", "{", "MappedField", "field", "=", "new", "MappedField", "(", "nestedField", ")", ";", "xml", ".", "fillMappedField", "(", "aClass", ",", "field", ")", ";", "Annotation", ".", "fillMappedField", "(", "aClass", ",", "field", ")", ";", "verifyGetterMethods", "(", "aClass", ",", "field", ")", ";", "return", "field", ";", "}" ]
Checks only get accessor of this field. @param xml used to check xml configuration @param aClass class where is the field with the nested mapping @param nestedField field with nested mapping
[ "Checks", "only", "get", "accessor", "of", "this", "field", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/NestedMappingHandler.java#L95-L102
144,139
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/operations/NestedMappingHandler.java
NestedMappingHandler.checkAccessors
private static MappedField checkAccessors(XML xml, Class<?> aClass, Field nestedField){ MappedField field = checkGetAccessor(xml, aClass, nestedField); verifySetterMethods(aClass,field); return field; }
java
private static MappedField checkAccessors(XML xml, Class<?> aClass, Field nestedField){ MappedField field = checkGetAccessor(xml, aClass, nestedField); verifySetterMethods(aClass,field); return field; }
[ "private", "static", "MappedField", "checkAccessors", "(", "XML", "xml", ",", "Class", "<", "?", ">", "aClass", ",", "Field", "nestedField", ")", "{", "MappedField", "field", "=", "checkGetAccessor", "(", "xml", ",", "aClass", ",", "nestedField", ")", ";", "verifySetterMethods", "(", "aClass", ",", "field", ")", ";", "return", "field", ";", "}" ]
Checks get and set accessors of this field. @param xml used to check xml configuration @param aClass class where is the field with the nested mapping @param nestedField field with nested mapping @return mapped field
[ "Checks", "get", "and", "set", "accessors", "of", "this", "field", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/NestedMappingHandler.java#L111-L116
144,140
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/operations/NestedMappingHandler.java
NestedMappingHandler.loadNestedMappingInformation
public static NestedMappingInfo loadNestedMappingInformation(XML xml, Class<?> targetClass,String nestedMappingPath, Class<?> sourceClass, Class<?> destinationClass, Field configuredField){ boolean isSourceClass = targetClass == sourceClass; NestedMappingInfo info = new NestedMappingInfo(isSourceClass); info.setConfiguredClass(isSourceClass?destinationClass:sourceClass); info.setConfiguredField(configuredField); try{ Class<?> nestedClass = targetClass; String[] nestedFields = nestedFields(nestedMappingPath); Field field = null; for(int i = 0; i< nestedFields.length;i++){ String nestedFieldName = nestedFields[i]; boolean elvisOperatorDefined = false; // the safe navigation operator is not valid for the last field if(i < nestedFields.length - 1){ String nextNestedFieldName = nestedFields[i+1]; elvisOperatorDefined = safeNavigationOperatorDefined(nextNestedFieldName); } // name filtering nestedFieldName = safeNavigationOperatorFilter(nestedFieldName); field = retrieveField(nestedClass, nestedFieldName); if(isNull(field)) Error.inexistentField(nestedFieldName, nestedClass.getSimpleName()); // verifies if is exists a get method for this nested field // in case of nested mapping relative to source, only get methods will be checked // in case of nested mapping relative to destination, get and set methods will be checked MappedField nestedField = isSourceClass ? checkGetAccessor(xml, nestedClass, field) //TODO Nested Mapping -> in caso di avoidSet qui potremmo avere un problema : checkAccessors(xml, nestedClass, field); // storage information relating to the piece of path info.addNestedField(new NestedMappedField(nestedField, nestedClass, elvisOperatorDefined)); nestedClass = field.getType(); } }catch(MappingException e){ InvalidNestedMappingException exception = new InvalidNestedMappingException(nestedMappingPath); exception.getMessages().put(InvalidNestedMappingException.FIELD, e.getMessage()); throw exception; } return info; }
java
public static NestedMappingInfo loadNestedMappingInformation(XML xml, Class<?> targetClass,String nestedMappingPath, Class<?> sourceClass, Class<?> destinationClass, Field configuredField){ boolean isSourceClass = targetClass == sourceClass; NestedMappingInfo info = new NestedMappingInfo(isSourceClass); info.setConfiguredClass(isSourceClass?destinationClass:sourceClass); info.setConfiguredField(configuredField); try{ Class<?> nestedClass = targetClass; String[] nestedFields = nestedFields(nestedMappingPath); Field field = null; for(int i = 0; i< nestedFields.length;i++){ String nestedFieldName = nestedFields[i]; boolean elvisOperatorDefined = false; // the safe navigation operator is not valid for the last field if(i < nestedFields.length - 1){ String nextNestedFieldName = nestedFields[i+1]; elvisOperatorDefined = safeNavigationOperatorDefined(nextNestedFieldName); } // name filtering nestedFieldName = safeNavigationOperatorFilter(nestedFieldName); field = retrieveField(nestedClass, nestedFieldName); if(isNull(field)) Error.inexistentField(nestedFieldName, nestedClass.getSimpleName()); // verifies if is exists a get method for this nested field // in case of nested mapping relative to source, only get methods will be checked // in case of nested mapping relative to destination, get and set methods will be checked MappedField nestedField = isSourceClass ? checkGetAccessor(xml, nestedClass, field) //TODO Nested Mapping -> in caso di avoidSet qui potremmo avere un problema : checkAccessors(xml, nestedClass, field); // storage information relating to the piece of path info.addNestedField(new NestedMappedField(nestedField, nestedClass, elvisOperatorDefined)); nestedClass = field.getType(); } }catch(MappingException e){ InvalidNestedMappingException exception = new InvalidNestedMappingException(nestedMappingPath); exception.getMessages().put(InvalidNestedMappingException.FIELD, e.getMessage()); throw exception; } return info; }
[ "public", "static", "NestedMappingInfo", "loadNestedMappingInformation", "(", "XML", "xml", ",", "Class", "<", "?", ">", "targetClass", ",", "String", "nestedMappingPath", ",", "Class", "<", "?", ">", "sourceClass", ",", "Class", "<", "?", ">", "destinationClass", ",", "Field", "configuredField", ")", "{", "boolean", "isSourceClass", "=", "targetClass", "==", "sourceClass", ";", "NestedMappingInfo", "info", "=", "new", "NestedMappingInfo", "(", "isSourceClass", ")", ";", "info", ".", "setConfiguredClass", "(", "isSourceClass", "?", "destinationClass", ":", "sourceClass", ")", ";", "info", ".", "setConfiguredField", "(", "configuredField", ")", ";", "try", "{", "Class", "<", "?", ">", "nestedClass", "=", "targetClass", ";", "String", "[", "]", "nestedFields", "=", "nestedFields", "(", "nestedMappingPath", ")", ";", "Field", "field", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nestedFields", ".", "length", ";", "i", "++", ")", "{", "String", "nestedFieldName", "=", "nestedFields", "[", "i", "]", ";", "boolean", "elvisOperatorDefined", "=", "false", ";", "// the safe navigation operator is not valid for the last field\r", "if", "(", "i", "<", "nestedFields", ".", "length", "-", "1", ")", "{", "String", "nextNestedFieldName", "=", "nestedFields", "[", "i", "+", "1", "]", ";", "elvisOperatorDefined", "=", "safeNavigationOperatorDefined", "(", "nextNestedFieldName", ")", ";", "}", "// name filtering\r", "nestedFieldName", "=", "safeNavigationOperatorFilter", "(", "nestedFieldName", ")", ";", "field", "=", "retrieveField", "(", "nestedClass", ",", "nestedFieldName", ")", ";", "if", "(", "isNull", "(", "field", ")", ")", "Error", ".", "inexistentField", "(", "nestedFieldName", ",", "nestedClass", ".", "getSimpleName", "(", ")", ")", ";", "// verifies if is exists a get method for this nested field\r", "// in case of nested mapping relative to source, only get methods will be checked\r", "// in case of nested mapping relative to destination, get and set methods will be checked\r", "MappedField", "nestedField", "=", "isSourceClass", "?", "checkGetAccessor", "(", "xml", ",", "nestedClass", ",", "field", ")", "//TODO Nested Mapping -> in caso di avoidSet qui potremmo avere un problema\r", ":", "checkAccessors", "(", "xml", ",", "nestedClass", ",", "field", ")", ";", "// storage information relating to the piece of path\r", "info", ".", "addNestedField", "(", "new", "NestedMappedField", "(", "nestedField", ",", "nestedClass", ",", "elvisOperatorDefined", ")", ")", ";", "nestedClass", "=", "field", ".", "getType", "(", ")", ";", "}", "}", "catch", "(", "MappingException", "e", ")", "{", "InvalidNestedMappingException", "exception", "=", "new", "InvalidNestedMappingException", "(", "nestedMappingPath", ")", ";", "exception", ".", "getMessages", "(", ")", ".", "put", "(", "InvalidNestedMappingException", ".", "FIELD", ",", "e", ".", "getMessage", "(", ")", ")", ";", "throw", "exception", ";", "}", "return", "info", ";", "}" ]
This method returns a bean with nested mapping information. @param xml xml configuration @param targetClass class to check @param nestedMappingPath path that define nested mapping @param sourceClass sourceClass used to indentify nested mapping @param destinationClass destinationClass used to indentify nested mapping @param configuredField used only for the explanation of the errors @return NestedMappingInfo
[ "This", "method", "returns", "a", "bean", "with", "nested", "mapping", "information", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/NestedMappingHandler.java#L128-L183
144,141
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/operations/OperationFactory.java
OperationFactory.getOperation
public static AGeneralOperation getOperation(OperationType operationType){ switch(operationType){ case BASIC_INSTRUCTION: return new BasicOperation(); case BASIC_CONVERSION: return new BasicConversion(); case OBJECT: return new ObjectOperation(); case ARRAY: return new ArrayOperation(); case ARRAY_LIST: return new ArrayListOperation(); case LIST_ARRAY: return new ListArrayOperation(); case ARRAY_WITH_MAPPED_ITEMS: return new MappedArrayOperation(); case ARRAY_LIST_WITH_MAPPED_ITEMS: return new MappedArrayListOperation(); case LIST_ARRAY_WITH_MAPPED_ITEMS: return new MappedListArrayOperation(); case COLLECTION: return new CollectionOperation(); case COLLECTION_WITH_MAPPED_ITEMS: return new MappedCollectionOperation(); case MAP: return new MapOperation(); case MAP_WITH_MAPPED_ITEMS: return new MappedMapOperation(); case CONVERSION: return new ConversionOperation(); case DATE_CALENDAR: return new DateCalendarOperation(); case STRING_ENUM: return new StringEnumOperation(); case STRING_STRINGBUFFER: return new StringStringBufferOperation(); case STRING_STRINGBUILDER: return new StringStringBuilderOperation(); case CALENDAR_DATE: return new CalendarDateOperation(); case ENUM_STRING: return new EnumStringOperation(); case STRINGBUILDER_STRING: return new StringBuilderStringOperation(); case STRINGBUFFER_STRING: return new StringBufferStringOperation(); case ENUM_ENUM: return new EnumEnumOperation(); default: return null; } }
java
public static AGeneralOperation getOperation(OperationType operationType){ switch(operationType){ case BASIC_INSTRUCTION: return new BasicOperation(); case BASIC_CONVERSION: return new BasicConversion(); case OBJECT: return new ObjectOperation(); case ARRAY: return new ArrayOperation(); case ARRAY_LIST: return new ArrayListOperation(); case LIST_ARRAY: return new ListArrayOperation(); case ARRAY_WITH_MAPPED_ITEMS: return new MappedArrayOperation(); case ARRAY_LIST_WITH_MAPPED_ITEMS: return new MappedArrayListOperation(); case LIST_ARRAY_WITH_MAPPED_ITEMS: return new MappedListArrayOperation(); case COLLECTION: return new CollectionOperation(); case COLLECTION_WITH_MAPPED_ITEMS: return new MappedCollectionOperation(); case MAP: return new MapOperation(); case MAP_WITH_MAPPED_ITEMS: return new MappedMapOperation(); case CONVERSION: return new ConversionOperation(); case DATE_CALENDAR: return new DateCalendarOperation(); case STRING_ENUM: return new StringEnumOperation(); case STRING_STRINGBUFFER: return new StringStringBufferOperation(); case STRING_STRINGBUILDER: return new StringStringBuilderOperation(); case CALENDAR_DATE: return new CalendarDateOperation(); case ENUM_STRING: return new EnumStringOperation(); case STRINGBUILDER_STRING: return new StringBuilderStringOperation(); case STRINGBUFFER_STRING: return new StringBufferStringOperation(); case ENUM_ENUM: return new EnumEnumOperation(); default: return null; } }
[ "public", "static", "AGeneralOperation", "getOperation", "(", "OperationType", "operationType", ")", "{", "switch", "(", "operationType", ")", "{", "case", "BASIC_INSTRUCTION", ":", "return", "new", "BasicOperation", "(", ")", ";", "case", "BASIC_CONVERSION", ":", "return", "new", "BasicConversion", "(", ")", ";", "case", "OBJECT", ":", "return", "new", "ObjectOperation", "(", ")", ";", "case", "ARRAY", ":", "return", "new", "ArrayOperation", "(", ")", ";", "case", "ARRAY_LIST", ":", "return", "new", "ArrayListOperation", "(", ")", ";", "case", "LIST_ARRAY", ":", "return", "new", "ListArrayOperation", "(", ")", ";", "case", "ARRAY_WITH_MAPPED_ITEMS", ":", "return", "new", "MappedArrayOperation", "(", ")", ";", "case", "ARRAY_LIST_WITH_MAPPED_ITEMS", ":", "return", "new", "MappedArrayListOperation", "(", ")", ";", "case", "LIST_ARRAY_WITH_MAPPED_ITEMS", ":", "return", "new", "MappedListArrayOperation", "(", ")", ";", "case", "COLLECTION", ":", "return", "new", "CollectionOperation", "(", ")", ";", "case", "COLLECTION_WITH_MAPPED_ITEMS", ":", "return", "new", "MappedCollectionOperation", "(", ")", ";", "case", "MAP", ":", "return", "new", "MapOperation", "(", ")", ";", "case", "MAP_WITH_MAPPED_ITEMS", ":", "return", "new", "MappedMapOperation", "(", ")", ";", "case", "CONVERSION", ":", "return", "new", "ConversionOperation", "(", ")", ";", "case", "DATE_CALENDAR", ":", "return", "new", "DateCalendarOperation", "(", ")", ";", "case", "STRING_ENUM", ":", "return", "new", "StringEnumOperation", "(", ")", ";", "case", "STRING_STRINGBUFFER", ":", "return", "new", "StringStringBufferOperation", "(", ")", ";", "case", "STRING_STRINGBUILDER", ":", "return", "new", "StringStringBuilderOperation", "(", ")", ";", "case", "CALENDAR_DATE", ":", "return", "new", "CalendarDateOperation", "(", ")", ";", "case", "ENUM_STRING", ":", "return", "new", "EnumStringOperation", "(", ")", ";", "case", "STRINGBUILDER_STRING", ":", "return", "new", "StringBuilderStringOperation", "(", ")", ";", "case", "STRINGBUFFER_STRING", ":", "return", "new", "StringBufferStringOperation", "(", ")", ";", "case", "ENUM_ENUM", ":", "return", "new", "EnumEnumOperation", "(", ")", ";", "default", ":", "return", "null", ";", "}", "}" ]
Operation factory. @param operationType operation type @return the operation instance relative to this operationType
[ "Operation", "factory", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/OperationFactory.java#L55-L83
144,142
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/ResourceLoader.java
ResourceLoader.loadResource
public static InputStream loadResource(String resource) throws MalformedURLException, IOException{ String content = resource.trim(); // if resource is a content and not a path if(!isPath(content)) return new ByteArrayInputStream(content.getBytes("UTF-8")); URL url = Thread.currentThread().getContextClassLoader().getResource(content); // Could not find resource. Try with the classloader that loaded this class. if (isNull(url)) { ClassLoader classLoader = ResourceLoader.class.getClassLoader(); if (classLoader != null) url = classLoader.getResource(content); } // Last ditch attempt searching classpath if (isNull(url)) url = ClassLoader.getSystemResource(content); // one more time if (isNull(url) && content.contains(":")) url = new URL(content); if(isNull(url)) Error.xmlNotFound(content); return url.openStream(); }
java
public static InputStream loadResource(String resource) throws MalformedURLException, IOException{ String content = resource.trim(); // if resource is a content and not a path if(!isPath(content)) return new ByteArrayInputStream(content.getBytes("UTF-8")); URL url = Thread.currentThread().getContextClassLoader().getResource(content); // Could not find resource. Try with the classloader that loaded this class. if (isNull(url)) { ClassLoader classLoader = ResourceLoader.class.getClassLoader(); if (classLoader != null) url = classLoader.getResource(content); } // Last ditch attempt searching classpath if (isNull(url)) url = ClassLoader.getSystemResource(content); // one more time if (isNull(url) && content.contains(":")) url = new URL(content); if(isNull(url)) Error.xmlNotFound(content); return url.openStream(); }
[ "public", "static", "InputStream", "loadResource", "(", "String", "resource", ")", "throws", "MalformedURLException", ",", "IOException", "{", "String", "content", "=", "resource", ".", "trim", "(", ")", ";", "// if resource is a content and not a path\r", "if", "(", "!", "isPath", "(", "content", ")", ")", "return", "new", "ByteArrayInputStream", "(", "content", ".", "getBytes", "(", "\"UTF-8\"", ")", ")", ";", "URL", "url", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ".", "getResource", "(", "content", ")", ";", "// Could not find resource. Try with the classloader that loaded this class.\r", "if", "(", "isNull", "(", "url", ")", ")", "{", "ClassLoader", "classLoader", "=", "ResourceLoader", ".", "class", ".", "getClassLoader", "(", ")", ";", "if", "(", "classLoader", "!=", "null", ")", "url", "=", "classLoader", ".", "getResource", "(", "content", ")", ";", "}", "// Last ditch attempt searching classpath\r", "if", "(", "isNull", "(", "url", ")", ")", "url", "=", "ClassLoader", ".", "getSystemResource", "(", "content", ")", ";", "// one more time\r", "if", "(", "isNull", "(", "url", ")", "&&", "content", ".", "contains", "(", "\":\"", ")", ")", "url", "=", "new", "URL", "(", "content", ")", ";", "if", "(", "isNull", "(", "url", ")", ")", "Error", ".", "xmlNotFound", "(", "content", ")", ";", "return", "url", ".", "openStream", "(", ")", ";", "}" ]
Returns an instance of inputStream if resource exists, null otherwise. @param resource resource to load @return an inputStream of resource if exists, null otherwise @throws MalformedURLException if url is malformed @throws IOException if is impossible to open the stream
[ "Returns", "an", "instance", "of", "inputStream", "if", "resource", "exists", "null", "otherwise", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/ResourceLoader.java#L41-L70
144,143
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionAnalyzer.java
ConversionAnalyzer.fieldsToCheck
public boolean fieldsToCheck(Field destination, Field source){ destinationName = destination.getName(); sourceName = source.getName(); if(!xml.conversionsLoad().isEmpty()){ configurationType = XML; if(config == DESTINATION){ if(existsXmlConversion(destinationClass)) { membership = Membership.DESTINATION; return true;} if(existsXmlConversion(sourceClass)) { membership = Membership.SOURCE; return true;}} else{ if(existsXmlConversion(sourceClass)) { membership = Membership.SOURCE; return true;} if(existsXmlConversion(destinationClass)) { membership = Membership.DESTINATION; return true;}} } configurationType = ANNOTATION; if(config == DESTINATION){ if(existsAnnotatedConversion(destinationClass)) { membership = Membership.DESTINATION; return true;} if(existsAnnotatedConversion(sourceClass)) { membership = Membership.SOURCE; return true;}} else{ if(existsAnnotatedConversion(sourceClass)) { membership = Membership.SOURCE; return true;} if(existsAnnotatedConversion(destinationClass)) { membership = Membership.DESTINATION; return true;}} return false; }
java
public boolean fieldsToCheck(Field destination, Field source){ destinationName = destination.getName(); sourceName = source.getName(); if(!xml.conversionsLoad().isEmpty()){ configurationType = XML; if(config == DESTINATION){ if(existsXmlConversion(destinationClass)) { membership = Membership.DESTINATION; return true;} if(existsXmlConversion(sourceClass)) { membership = Membership.SOURCE; return true;}} else{ if(existsXmlConversion(sourceClass)) { membership = Membership.SOURCE; return true;} if(existsXmlConversion(destinationClass)) { membership = Membership.DESTINATION; return true;}} } configurationType = ANNOTATION; if(config == DESTINATION){ if(existsAnnotatedConversion(destinationClass)) { membership = Membership.DESTINATION; return true;} if(existsAnnotatedConversion(sourceClass)) { membership = Membership.SOURCE; return true;}} else{ if(existsAnnotatedConversion(sourceClass)) { membership = Membership.SOURCE; return true;} if(existsAnnotatedConversion(destinationClass)) { membership = Membership.DESTINATION; return true;}} return false; }
[ "public", "boolean", "fieldsToCheck", "(", "Field", "destination", ",", "Field", "source", ")", "{", "destinationName", "=", "destination", ".", "getName", "(", ")", ";", "sourceName", "=", "source", ".", "getName", "(", ")", ";", "if", "(", "!", "xml", ".", "conversionsLoad", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "configurationType", "=", "XML", ";", "if", "(", "config", "==", "DESTINATION", ")", "{", "if", "(", "existsXmlConversion", "(", "destinationClass", ")", ")", "{", "membership", "=", "Membership", ".", "DESTINATION", ";", "return", "true", ";", "}", "if", "(", "existsXmlConversion", "(", "sourceClass", ")", ")", "{", "membership", "=", "Membership", ".", "SOURCE", ";", "return", "true", ";", "}", "}", "else", "{", "if", "(", "existsXmlConversion", "(", "sourceClass", ")", ")", "{", "membership", "=", "Membership", ".", "SOURCE", ";", "return", "true", ";", "}", "if", "(", "existsXmlConversion", "(", "destinationClass", ")", ")", "{", "membership", "=", "Membership", ".", "DESTINATION", ";", "return", "true", ";", "}", "}", "}", "configurationType", "=", "ANNOTATION", ";", "if", "(", "config", "==", "DESTINATION", ")", "{", "if", "(", "existsAnnotatedConversion", "(", "destinationClass", ")", ")", "{", "membership", "=", "Membership", ".", "DESTINATION", ";", "return", "true", ";", "}", "if", "(", "existsAnnotatedConversion", "(", "sourceClass", ")", ")", "{", "membership", "=", "Membership", ".", "SOURCE", ";", "return", "true", ";", "}", "}", "else", "{", "if", "(", "existsAnnotatedConversion", "(", "sourceClass", ")", ")", "{", "membership", "=", "Membership", ".", "SOURCE", ";", "return", "true", ";", "}", "if", "(", "existsAnnotatedConversion", "(", "destinationClass", ")", ")", "{", "membership", "=", "Membership", ".", "DESTINATION", ";", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks for the existence of a conversion method. @param destination destination field @param source source field @return true if the conversion method exists, false otherwise
[ "Checks", "for", "the", "existence", "of", "a", "conversion", "method", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionAnalyzer.java#L78-L98
144,144
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionAnalyzer.java
ConversionAnalyzer.exists
private boolean exists(List<ConversionMethod> conversions){ if(conversions.isEmpty()) return false; return (method = verifyConversionExistence(conversions))!= null; }
java
private boolean exists(List<ConversionMethod> conversions){ if(conversions.isEmpty()) return false; return (method = verifyConversionExistence(conversions))!= null; }
[ "private", "boolean", "exists", "(", "List", "<", "ConversionMethod", ">", "conversions", ")", "{", "if", "(", "conversions", ".", "isEmpty", "(", ")", ")", "return", "false", ";", "return", "(", "method", "=", "verifyConversionExistence", "(", "conversions", ")", ")", "!=", "null", ";", "}" ]
Verifies the conversion method existence, returns true if exists, false otherwise. @param conversions conversion methods @return true if conversion method exists, false otherwise
[ "Verifies", "the", "conversion", "method", "existence", "returns", "true", "if", "exists", "false", "otherwise", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionAnalyzer.java#L132-L135
144,145
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionAnalyzer.java
ConversionAnalyzer.verifyConversionExistence
private ConversionMethod verifyConversionExistence(List<ConversionMethod> conversions){ for (ConversionMethod method : conversions) if(isPresentIn(method.getFrom(),sourceName) && isPresentIn(method.getTo() ,destinationName)) return method; return null; }
java
private ConversionMethod verifyConversionExistence(List<ConversionMethod> conversions){ for (ConversionMethod method : conversions) if(isPresentIn(method.getFrom(),sourceName) && isPresentIn(method.getTo() ,destinationName)) return method; return null; }
[ "private", "ConversionMethod", "verifyConversionExistence", "(", "List", "<", "ConversionMethod", ">", "conversions", ")", "{", "for", "(", "ConversionMethod", "method", ":", "conversions", ")", "if", "(", "isPresentIn", "(", "method", ".", "getFrom", "(", ")", ",", "sourceName", ")", "&&", "isPresentIn", "(", "method", ".", "getTo", "(", ")", ",", "destinationName", ")", ")", "return", "method", ";", "return", "null", ";", "}" ]
This method finds the conversion method between those loaded. @param conversions conversion methods list @return the conversion method if found, null otherwise
[ "This", "method", "finds", "the", "conversion", "method", "between", "those", "loaded", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionAnalyzer.java#L142-L149
144,146
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionAnalyzer.java
ConversionAnalyzer.isPresentIn
private boolean isPresentIn(String[] values, String field){ for (String value : values) if(value.equalsIgnoreCase(JMapConversion.ALL) || value.equals(field)) return true; return false; }
java
private boolean isPresentIn(String[] values, String field){ for (String value : values) if(value.equalsIgnoreCase(JMapConversion.ALL) || value.equals(field)) return true; return false; }
[ "private", "boolean", "isPresentIn", "(", "String", "[", "]", "values", ",", "String", "field", ")", "{", "for", "(", "String", "value", ":", "values", ")", "if", "(", "value", ".", "equalsIgnoreCase", "(", "JMapConversion", ".", "ALL", ")", "||", "value", ".", "equals", "(", "field", ")", ")", "return", "true", ";", "return", "false", ";", "}" ]
Returns true if the field name is contained in the values array, false otherwise. @param values array of values @param field field name to check @return true if the field name is contained in the values array, false otherwise
[ "Returns", "true", "if", "the", "field", "name", "is", "contained", "in", "the", "values", "array", "false", "otherwise", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionAnalyzer.java#L157-L163
144,147
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.nestedBeanNull
public static void nestedBeanNull(String currentField, String destinationClass, String destinationField, String sourceClass, String sourceField, boolean safeNavigationOperator){ throw new NestedBeanNullException(MSG.INSTANCE.message(nestedBeanNullException,currentField,destinationClass,destinationField,sourceClass,sourceField), safeNavigationOperator); }
java
public static void nestedBeanNull(String currentField, String destinationClass, String destinationField, String sourceClass, String sourceField, boolean safeNavigationOperator){ throw new NestedBeanNullException(MSG.INSTANCE.message(nestedBeanNullException,currentField,destinationClass,destinationField,sourceClass,sourceField), safeNavigationOperator); }
[ "public", "static", "void", "nestedBeanNull", "(", "String", "currentField", ",", "String", "destinationClass", ",", "String", "destinationField", ",", "String", "sourceClass", ",", "String", "sourceField", ",", "boolean", "safeNavigationOperator", ")", "{", "throw", "new", "NestedBeanNullException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "nestedBeanNullException", ",", "currentField", ",", "destinationClass", ",", "destinationField", ",", "sourceClass", ",", "sourceField", ")", ",", "safeNavigationOperator", ")", ";", "}" ]
Thrown when the source field is null in a mapping of nested type. @param currentField current field @param destinationClass destination class @param destinationField destination field @param sourceClass source class @param sourceField source field
[ "Thrown", "when", "the", "source", "field", "is", "null", "in", "a", "mapping", "of", "nested", "type", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L126-L128
144,148
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.bodyContainsIllegalCode
public static void bodyContainsIllegalCode(Method method, Exception additionalInformation){ Class<?> clazz = method.getClazz(); if(isNull(clazz)) clazz = JMapper.class; String originalName = method.getOriginalName(); if(isNull(originalName)) originalName = method.getName(); String message = clazz != JMapper.class ? MSG.INSTANCE.message(conversionBodyIllegalCode,clazz.getSimpleName(),originalName,""+additionalInformation.getMessage()) : MSG.INSTANCE.message(conversionBodyIllegalCode2,""+additionalInformation.getMessage()); throw new ConversionBodyIllegalCodeException(message); }
java
public static void bodyContainsIllegalCode(Method method, Exception additionalInformation){ Class<?> clazz = method.getClazz(); if(isNull(clazz)) clazz = JMapper.class; String originalName = method.getOriginalName(); if(isNull(originalName)) originalName = method.getName(); String message = clazz != JMapper.class ? MSG.INSTANCE.message(conversionBodyIllegalCode,clazz.getSimpleName(),originalName,""+additionalInformation.getMessage()) : MSG.INSTANCE.message(conversionBodyIllegalCode2,""+additionalInformation.getMessage()); throw new ConversionBodyIllegalCodeException(message); }
[ "public", "static", "void", "bodyContainsIllegalCode", "(", "Method", "method", ",", "Exception", "additionalInformation", ")", "{", "Class", "<", "?", ">", "clazz", "=", "method", ".", "getClazz", "(", ")", ";", "if", "(", "isNull", "(", "clazz", ")", ")", "clazz", "=", "JMapper", ".", "class", ";", "String", "originalName", "=", "method", ".", "getOriginalName", "(", ")", ";", "if", "(", "isNull", "(", "originalName", ")", ")", "originalName", "=", "method", ".", "getName", "(", ")", ";", "String", "message", "=", "clazz", "!=", "JMapper", ".", "class", "?", "MSG", ".", "INSTANCE", ".", "message", "(", "conversionBodyIllegalCode", ",", "clazz", ".", "getSimpleName", "(", ")", ",", "originalName", ",", "\"\"", "+", "additionalInformation", ".", "getMessage", "(", ")", ")", ":", "MSG", ".", "INSTANCE", ".", "message", "(", "conversionBodyIllegalCode2", ",", "\"\"", "+", "additionalInformation", ".", "getMessage", "(", ")", ")", ";", "throw", "new", "ConversionBodyIllegalCodeException", "(", "message", ")", ";", "}" ]
Thrown when the code contained in the body method is illegal. @param method method to adjust @param additionalInformation additional information relative to the byteCode library exception
[ "Thrown", "when", "the", "code", "contained", "in", "the", "body", "method", "is", "illegal", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L176-L187
144,149
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.incorrectMethodDefinition
public static void incorrectMethodDefinition(String methodName, String className){ throw new DynamicConversionMethodException(MSG.INSTANCE.message(dynamicConversionMethodException,methodName,className)); }
java
public static void incorrectMethodDefinition(String methodName, String className){ throw new DynamicConversionMethodException(MSG.INSTANCE.message(dynamicConversionMethodException,methodName,className)); }
[ "public", "static", "void", "incorrectMethodDefinition", "(", "String", "methodName", ",", "String", "className", ")", "{", "throw", "new", "DynamicConversionMethodException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "dynamicConversionMethodException", ",", "methodName", ",", "className", ")", ")", ";", "}" ]
Thrown when the method don't respects the convetions beloging to the dynamic conversion implementation. @param methodName method name @param className class name
[ "Thrown", "when", "the", "method", "don", "t", "respects", "the", "convetions", "beloging", "to", "the", "dynamic", "conversion", "implementation", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L222-L224
144,150
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.incorrectBodyDefinition
public static void incorrectBodyDefinition(String methodName,String className){ throw new DynamicConversionBodyException(MSG.INSTANCE.message(dynamicConversionBodyException,methodName,className)); }
java
public static void incorrectBodyDefinition(String methodName,String className){ throw new DynamicConversionBodyException(MSG.INSTANCE.message(dynamicConversionBodyException,methodName,className)); }
[ "public", "static", "void", "incorrectBodyDefinition", "(", "String", "methodName", ",", "String", "className", ")", "{", "throw", "new", "DynamicConversionBodyException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "dynamicConversionBodyException", ",", "methodName", ",", "className", ")", ")", ";", "}" ]
Thrown when the body method don't respects the convetions beloging to the dynamic conversion implementation. @param methodName method name @param className class name
[ "Thrown", "when", "the", "body", "method", "don", "t", "respects", "the", "convetions", "beloging", "to", "the", "dynamic", "conversion", "implementation", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L230-L232
144,151
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.attributeInexistent
public static void attributeInexistent(String attributeName, Class<?> aClass){ throw new IllegalArgumentException(MSG.INSTANCE.message(malformedBeanException2,attributeName,aClass.getSimpleName())); }
java
public static void attributeInexistent(String attributeName, Class<?> aClass){ throw new IllegalArgumentException(MSG.INSTANCE.message(malformedBeanException2,attributeName,aClass.getSimpleName())); }
[ "public", "static", "void", "attributeInexistent", "(", "String", "attributeName", ",", "Class", "<", "?", ">", "aClass", ")", "{", "throw", "new", "IllegalArgumentException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "malformedBeanException2", ",", "attributeName", ",", "aClass", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown if attributes isn't present in the xml file. @param attributeName attribute name @param aClass class analyzed
[ "Thrown", "if", "attributes", "isn", "t", "present", "in", "the", "xml", "file", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L278-L280
144,152
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.xmlWrongMethod
public static void xmlWrongMethod(Class<?> aClass){ throw new WrongMethodException (MSG.INSTANCE.message(wrongMethodException1,aClass.getSimpleName())); }
java
public static void xmlWrongMethod(Class<?> aClass){ throw new WrongMethodException (MSG.INSTANCE.message(wrongMethodException1,aClass.getSimpleName())); }
[ "public", "static", "void", "xmlWrongMethod", "(", "Class", "<", "?", ">", "aClass", ")", "{", "throw", "new", "WrongMethodException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "wrongMethodException1", ",", "aClass", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown when the class has only one attribute. @param aClass class analyzed
[ "Thrown", "when", "the", "class", "has", "only", "one", "attribute", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L285-L287
144,153
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.xmlClassInexistent
public static void xmlClassInexistent(String path, Class<?> aClass){ throw new XmlMappingClassDoesNotExistException (MSG.INSTANCE.message(xmlMappingClassDoesNotExistException1,path,aClass.getSimpleName())); }
java
public static void xmlClassInexistent(String path, Class<?> aClass){ throw new XmlMappingClassDoesNotExistException (MSG.INSTANCE.message(xmlMappingClassDoesNotExistException1,path,aClass.getSimpleName())); }
[ "public", "static", "void", "xmlClassInexistent", "(", "String", "path", ",", "Class", "<", "?", ">", "aClass", ")", "{", "throw", "new", "XmlMappingClassDoesNotExistException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "xmlMappingClassDoesNotExistException1", ",", "path", ",", "aClass", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown if class isn't present in xml file. @param path xml path @param aClass Class analyzed
[ "Thrown", "if", "class", "isn", "t", "present", "in", "xml", "file", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L311-L313
144,154
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.xmlClassExistent
public static void xmlClassExistent(String path, Class<?> aClass){ throw new XmlMappingClassExistException (MSG.INSTANCE.message(xmlMappingClassExistException1,aClass.getSimpleName(),path)); }
java
public static void xmlClassExistent(String path, Class<?> aClass){ throw new XmlMappingClassExistException (MSG.INSTANCE.message(xmlMappingClassExistException1,aClass.getSimpleName(),path)); }
[ "public", "static", "void", "xmlClassExistent", "(", "String", "path", ",", "Class", "<", "?", ">", "aClass", ")", "{", "throw", "new", "XmlMappingClassExistException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "xmlMappingClassExistException1", ",", "aClass", ".", "getSimpleName", "(", ")", ",", "path", ")", ")", ";", "}" ]
Thrown if class is present in xml file. @param path xml path @param aClass Class analyzed
[ "Thrown", "if", "class", "is", "present", "in", "xml", "file", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L319-L321
144,155
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.xmlConversionNameUndefined
public static void xmlConversionNameUndefined(String xmlPath, String className) { throw new XmlConversionNameException(MSG.INSTANCE.message(xmlConversionNameException,xmlPath,className)); }
java
public static void xmlConversionNameUndefined(String xmlPath, String className) { throw new XmlConversionNameException(MSG.INSTANCE.message(xmlConversionNameException,xmlPath,className)); }
[ "public", "static", "void", "xmlConversionNameUndefined", "(", "String", "xmlPath", ",", "String", "className", ")", "{", "throw", "new", "XmlConversionNameException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "xmlConversionNameException", ",", "xmlPath", ",", "className", ")", ")", ";", "}" ]
Thrown when the conversion name is undefined. @param xmlPath xml path @param className class name
[ "Thrown", "when", "the", "conversion", "name", "is", "undefined", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L328-L330
144,156
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.xmlConversionTypeIncorrect
public static void xmlConversionTypeIncorrect(String conversionName,String xmlPath,String className,String type){ throw new XmlConversionTypeException(MSG.INSTANCE.message(xmlConversionTypeException,conversionName,xmlPath,className,type)); }
java
public static void xmlConversionTypeIncorrect(String conversionName,String xmlPath,String className,String type){ throw new XmlConversionTypeException(MSG.INSTANCE.message(xmlConversionTypeException,conversionName,xmlPath,className,type)); }
[ "public", "static", "void", "xmlConversionTypeIncorrect", "(", "String", "conversionName", ",", "String", "xmlPath", ",", "String", "className", ",", "String", "type", ")", "{", "throw", "new", "XmlConversionTypeException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "xmlConversionTypeException", ",", "conversionName", ",", "xmlPath", ",", "className", ",", "type", ")", ")", ";", "}" ]
Thrown if conversion type is wrong. @param conversionName conversion name @param xmlPath xml path @param className class name @param type type
[ "Thrown", "if", "conversion", "type", "is", "wrong", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L338-L340
144,157
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.improperUseOfTheParameter
public static void improperUseOfTheParameter(String conversionName,String xmlPath,String className){ throw new XmlConversionParameterException(MSG.INSTANCE.message(xmlConversionParameterException,conversionName,xmlPath,className)); }
java
public static void improperUseOfTheParameter(String conversionName,String xmlPath,String className){ throw new XmlConversionParameterException(MSG.INSTANCE.message(xmlConversionParameterException,conversionName,xmlPath,className)); }
[ "public", "static", "void", "improperUseOfTheParameter", "(", "String", "conversionName", ",", "String", "xmlPath", ",", "String", "className", ")", "{", "throw", "new", "XmlConversionParameterException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "xmlConversionParameterException", ",", "conversionName", ",", "xmlPath", ",", "className", ")", ")", ";", "}" ]
Thrown if the use of the parameters is incorrect. @param conversionName conversion name @param xmlPath xml path @param className class name
[ "Thrown", "if", "the", "use", "of", "the", "parameters", "is", "incorrect", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L347-L349
144,158
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.undefinedMapping
public static void undefinedMapping(Field destinationField, Class<?> destinationClass, Field sourceField, Class<?> sourceClass){ throw new UndefinedMappingException(MSG.INSTANCE.message(undefinedMappingException,destinationField.getName(),destinationClass.getSimpleName(),sourceField.getName(),sourceClass.getSimpleName())); }
java
public static void undefinedMapping(Field destinationField, Class<?> destinationClass, Field sourceField, Class<?> sourceClass){ throw new UndefinedMappingException(MSG.INSTANCE.message(undefinedMappingException,destinationField.getName(),destinationClass.getSimpleName(),sourceField.getName(),sourceClass.getSimpleName())); }
[ "public", "static", "void", "undefinedMapping", "(", "Field", "destinationField", ",", "Class", "<", "?", ">", "destinationClass", ",", "Field", "sourceField", ",", "Class", "<", "?", ">", "sourceClass", ")", "{", "throw", "new", "UndefinedMappingException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "undefinedMappingException", ",", "destinationField", ".", "getName", "(", ")", ",", "destinationClass", ".", "getSimpleName", "(", ")", ",", "sourceField", ".", "getName", "(", ")", ",", "sourceClass", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown when the instruction isn't defined. @param destinationField destination field @param destinationClass destination class @param sourceField source field @param sourceClass source class
[ "Thrown", "when", "the", "instruction", "isn", "t", "defined", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L396-L398
144,159
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.badConversion
public static void badConversion(Field destinationField, Class<?> destinationClass, Field sourceField, Class<?> sourceClass,String plus){ throw new UndefinedMappingException(MSG.INSTANCE.message(undefinedMappingException,destinationField.getName(),destinationClass.getSimpleName(),sourceField.getName(),sourceClass.getSimpleName()) + ". More information: "+plus); }
java
public static void badConversion(Field destinationField, Class<?> destinationClass, Field sourceField, Class<?> sourceClass,String plus){ throw new UndefinedMappingException(MSG.INSTANCE.message(undefinedMappingException,destinationField.getName(),destinationClass.getSimpleName(),sourceField.getName(),sourceClass.getSimpleName()) + ". More information: "+plus); }
[ "public", "static", "void", "badConversion", "(", "Field", "destinationField", ",", "Class", "<", "?", ">", "destinationClass", ",", "Field", "sourceField", ",", "Class", "<", "?", ">", "sourceClass", ",", "String", "plus", ")", "{", "throw", "new", "UndefinedMappingException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "undefinedMappingException", ",", "destinationField", ".", "getName", "(", ")", ",", "destinationClass", ".", "getSimpleName", "(", ")", ",", "sourceField", ".", "getName", "(", ")", ",", "sourceClass", ".", "getSimpleName", "(", ")", ")", "+", "\". More information: \"", "+", "plus", ")", ";", "}" ]
Thrown when conversions are badly written. @param destinationField destination field @param destinationClass destination class @param sourceField source field @param sourceClass source class @param plus added messages of internal exceptions thrown
[ "Thrown", "when", "conversions", "are", "badly", "written", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L408-L410
144,160
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.mapping
public static void mapping(String mappedFieldName,Class<?> mappedClass, Class<?> targetClass){ throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorException2,mappedFieldName,mappedClass.getSimpleName(),targetClass.getSimpleName())); }
java
public static void mapping(String mappedFieldName,Class<?> mappedClass, Class<?> targetClass){ throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorException2,mappedFieldName,mappedClass.getSimpleName(),targetClass.getSimpleName())); }
[ "public", "static", "void", "mapping", "(", "String", "mappedFieldName", ",", "Class", "<", "?", ">", "mappedClass", ",", "Class", "<", "?", ">", "targetClass", ")", "{", "throw", "new", "MappingErrorException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "mappingErrorException2", ",", "mappedFieldName", ",", "mappedClass", ".", "getSimpleName", "(", ")", ",", "targetClass", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown when there is an error in the configuration. @param mappedFieldName name of the mapped field @param mappedClass mapped field's class @param targetClass target field's class
[ "Thrown", "when", "there", "is", "an", "error", "in", "the", "configuration", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L455-L457
144,161
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.mapping
public static void mapping(String mappedFieldName, String mappedClassName){ throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorException2length,mappedFieldName,mappedClassName)); }
java
public static void mapping(String mappedFieldName, String mappedClassName){ throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorException2length,mappedFieldName,mappedClassName)); }
[ "public", "static", "void", "mapping", "(", "String", "mappedFieldName", ",", "String", "mappedClassName", ")", "{", "throw", "new", "MappingErrorException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "mappingErrorException2length", ",", "mappedFieldName", ",", "mappedClassName", ")", ")", ";", "}" ]
Thrown when the length of classes and attribute parameter isn't the same. @param mappedFieldName name of the mapped field @param mappedClassName name of the mapped field's class
[ "Thrown", "when", "the", "length", "of", "classes", "and", "attribute", "parameter", "isn", "t", "the", "same", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L463-L465
144,162
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.mapping
public static void mapping(String mappedFieldName, String mappedClassName, String targetClassName){ throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorException3,mappedFieldName,mappedClassName,targetClassName)); }
java
public static void mapping(String mappedFieldName, String mappedClassName, String targetClassName){ throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorException3,mappedFieldName,mappedClassName,targetClassName)); }
[ "public", "static", "void", "mapping", "(", "String", "mappedFieldName", ",", "String", "mappedClassName", ",", "String", "targetClassName", ")", "{", "throw", "new", "MappingErrorException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "mappingErrorException3", ",", "mappedFieldName", ",", "mappedClassName", ",", "targetClassName", ")", ")", ";", "}" ]
Thrown when the target class doesn't exist in classes parameter. @param mappedFieldName name of the mapped field @param mappedClassName name of the mapped field's class @param targetClassName name of the target field's class
[ "Thrown", "when", "the", "target", "class", "doesn", "t", "exist", "in", "classes", "parameter", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L472-L474
144,163
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.attributeAbsent
public static void attributeAbsent(Class<?> aClass,Attribute aField){ throw new XmlMappingAttributeDoesNotExistException(MSG.INSTANCE.message(xmlMappingAttributeDoesNotExistException2,aField.getName(),aClass.getSimpleName(),"API")); }
java
public static void attributeAbsent(Class<?> aClass,Attribute aField){ throw new XmlMappingAttributeDoesNotExistException(MSG.INSTANCE.message(xmlMappingAttributeDoesNotExistException2,aField.getName(),aClass.getSimpleName(),"API")); }
[ "public", "static", "void", "attributeAbsent", "(", "Class", "<", "?", ">", "aClass", ",", "Attribute", "aField", ")", "{", "throw", "new", "XmlMappingAttributeDoesNotExistException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "xmlMappingAttributeDoesNotExistException2", ",", "aField", ".", "getName", "(", ")", ",", "aClass", ".", "getSimpleName", "(", ")", ",", "\"API\"", ")", ")", ";", "}" ]
Thrown if the attribute doesn't exist in aClass. @param aClass class that not contains aField @param aField the missing field
[ "Thrown", "if", "the", "attribute", "doesn", "t", "exist", "in", "aClass", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L499-L501
144,164
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.configNotPresent
public static void configNotPresent(Class<?> destination,Class<?> source,XML xml){ throw new MappingNotFoundException(MSG.INSTANCE.message(Constants.mappingNotFoundException2path,destination.getSimpleName(), source.getSimpleName(),xml.getXmlPath())); }
java
public static void configNotPresent(Class<?> destination,Class<?> source,XML xml){ throw new MappingNotFoundException(MSG.INSTANCE.message(Constants.mappingNotFoundException2path,destination.getSimpleName(), source.getSimpleName(),xml.getXmlPath())); }
[ "public", "static", "void", "configNotPresent", "(", "Class", "<", "?", ">", "destination", ",", "Class", "<", "?", ">", "source", ",", "XML", "xml", ")", "{", "throw", "new", "MappingNotFoundException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "Constants", ".", "mappingNotFoundException2path", ",", "destination", ".", "getSimpleName", "(", ")", ",", "source", ".", "getSimpleName", "(", ")", ",", "xml", ".", "getXmlPath", "(", ")", ")", ")", ";", "}" ]
Thrown when the xml configuration doesn't contains the classes configuration. @param destination destination class name @param source source class name @param xml xml path
[ "Thrown", "when", "the", "xml", "configuration", "doesn", "t", "contains", "the", "classes", "configuration", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L514-L516
144,165
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.configNotPresent
public static void configNotPresent(Class<?> clazz,XML xml){ throw new MappingNotFoundException(MSG.INSTANCE.message(Constants.mappingNotFoundException1path, clazz.getSimpleName(),xml.getXmlPath())); }
java
public static void configNotPresent(Class<?> clazz,XML xml){ throw new MappingNotFoundException(MSG.INSTANCE.message(Constants.mappingNotFoundException1path, clazz.getSimpleName(),xml.getXmlPath())); }
[ "public", "static", "void", "configNotPresent", "(", "Class", "<", "?", ">", "clazz", ",", "XML", "xml", ")", "{", "throw", "new", "MappingNotFoundException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "Constants", ".", "mappingNotFoundException1path", ",", "clazz", ".", "getSimpleName", "(", ")", ",", "xml", ".", "getXmlPath", "(", ")", ")", ")", ";", "}" ]
Thrown when missing the configuration belonging to clazz. @param clazz class without configuration @param xml xml path
[ "Thrown", "when", "missing", "the", "configuration", "belonging", "to", "clazz", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L522-L524
144,166
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.classesNotConfigured
public static void classesNotConfigured(Class<?> destination,Class<?> source){ throw new MappingNotFoundException(MSG.INSTANCE.message(Constants.mappingNotFoundException2,destination.getSimpleName(), source.getSimpleName())); }
java
public static void classesNotConfigured(Class<?> destination,Class<?> source){ throw new MappingNotFoundException(MSG.INSTANCE.message(Constants.mappingNotFoundException2,destination.getSimpleName(), source.getSimpleName())); }
[ "public", "static", "void", "classesNotConfigured", "(", "Class", "<", "?", ">", "destination", ",", "Class", "<", "?", ">", "source", ")", "{", "throw", "new", "MappingNotFoundException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "Constants", ".", "mappingNotFoundException2", ",", "destination", ".", "getSimpleName", "(", ")", ",", "source", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown when the xml configuration doesn't exist. @param destination destination class name @param source source class name
[ "Thrown", "when", "the", "xml", "configuration", "doesn", "t", "exist", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L530-L532
144,167
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.classNotConfigured
public static void classNotConfigured(Class<?> clazz){ throw new MappingNotFoundException(MSG.INSTANCE.message(Constants.mappingNotFoundException1, clazz.getSimpleName())); }
java
public static void classNotConfigured(Class<?> clazz){ throw new MappingNotFoundException(MSG.INSTANCE.message(Constants.mappingNotFoundException1, clazz.getSimpleName())); }
[ "public", "static", "void", "classNotConfigured", "(", "Class", "<", "?", ">", "clazz", ")", "{", "throw", "new", "MappingNotFoundException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "Constants", ".", "mappingNotFoundException1", ",", "clazz", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown when the xml configuration of the clazz doesn't exist. @param clazz class to check
[ "Thrown", "when", "the", "xml", "configuration", "of", "the", "clazz", "doesn", "t", "exist", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L537-L539
144,168
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.globalClassesAbsent
public static void globalClassesAbsent(Class<?> aClass){ throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorRelationalException3, aClass.getSimpleName())); }
java
public static void globalClassesAbsent(Class<?> aClass){ throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorRelationalException3, aClass.getSimpleName())); }
[ "public", "static", "void", "globalClassesAbsent", "(", "Class", "<", "?", ">", "aClass", ")", "{", "throw", "new", "MappingErrorException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "mappingErrorRelationalException3", ",", "aClass", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown if the configured class hasn't classes parameter. @param aClass class's field
[ "Thrown", "if", "the", "configured", "class", "hasn", "t", "classes", "parameter", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L550-L552
144,169
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.classesAbsent
public static void classesAbsent(String fieldName,Class<?> aClass){ throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorRelationalException2,fieldName, aClass.getSimpleName())); }
java
public static void classesAbsent(String fieldName,Class<?> aClass){ throw new MappingErrorException(MSG.INSTANCE.message(mappingErrorRelationalException2,fieldName, aClass.getSimpleName())); }
[ "public", "static", "void", "classesAbsent", "(", "String", "fieldName", ",", "Class", "<", "?", ">", "aClass", ")", "{", "throw", "new", "MappingErrorException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "mappingErrorRelationalException2", ",", "fieldName", ",", "aClass", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown if the configured field hasn't classes parameter. @param fieldName name of the field @param aClass class's field
[ "Thrown", "if", "the", "configured", "field", "hasn", "t", "classes", "parameter", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L558-L560
144,170
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.classNotMapped
public static void classNotMapped(Class<?> aClass){ throw new ClassNotMappedException(MSG.INSTANCE.message(classNotMappedException1,aClass.getSimpleName())); }
java
public static void classNotMapped(Class<?> aClass){ throw new ClassNotMappedException(MSG.INSTANCE.message(classNotMappedException1,aClass.getSimpleName())); }
[ "public", "static", "void", "classNotMapped", "(", "Class", "<", "?", ">", "aClass", ")", "{", "throw", "new", "ClassNotMappedException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "classNotMappedException1", ",", "aClass", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown if the class isn't mapped. @param aClass class to analyze
[ "Thrown", "if", "the", "class", "isn", "t", "mapped", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L565-L567
144,171
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.classNotMapped
public static void classNotMapped(Object sourceClass, Class<?> configuredClass){ String sourceName = sourceClass instanceof Class?((Class<?>)sourceClass).getSimpleName():sourceClass.getClass().getSimpleName(); throw new ClassNotMappedException(MSG.INSTANCE.message(classNotMappedException2,sourceName, configuredClass.getSimpleName())); }
java
public static void classNotMapped(Object sourceClass, Class<?> configuredClass){ String sourceName = sourceClass instanceof Class?((Class<?>)sourceClass).getSimpleName():sourceClass.getClass().getSimpleName(); throw new ClassNotMappedException(MSG.INSTANCE.message(classNotMappedException2,sourceName, configuredClass.getSimpleName())); }
[ "public", "static", "void", "classNotMapped", "(", "Object", "sourceClass", ",", "Class", "<", "?", ">", "configuredClass", ")", "{", "String", "sourceName", "=", "sourceClass", "instanceof", "Class", "?", "(", "(", "Class", "<", "?", ">", ")", "sourceClass", ")", ".", "getSimpleName", "(", ")", ":", "sourceClass", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ";", "throw", "new", "ClassNotMappedException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "classNotMappedException2", ",", "sourceName", ",", "configuredClass", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown if the sourceClass isn't mapped in configuredClass. @param sourceClass class absent @param configuredClass class that not contains sourceClass
[ "Thrown", "if", "the", "sourceClass", "isn", "t", "mapped", "in", "configuredClass", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L573-L576
144,172
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.illegalCode
public static void illegalCode(Class<?> destination, Class<?> source, String path, Throwable e){ String additionalInformation = e.getMessage().split(",")[1]; throw new IllegalCodeException(MSG.INSTANCE.message(illegalCodePath,destination.getSimpleName(),source.getSimpleName(),path,additionalInformation)); }
java
public static void illegalCode(Class<?> destination, Class<?> source, String path, Throwable e){ String additionalInformation = e.getMessage().split(",")[1]; throw new IllegalCodeException(MSG.INSTANCE.message(illegalCodePath,destination.getSimpleName(),source.getSimpleName(),path,additionalInformation)); }
[ "public", "static", "void", "illegalCode", "(", "Class", "<", "?", ">", "destination", ",", "Class", "<", "?", ">", "source", ",", "String", "path", ",", "Throwable", "e", ")", "{", "String", "additionalInformation", "=", "e", ".", "getMessage", "(", ")", ".", "split", "(", "\",\"", ")", "[", "1", "]", ";", "throw", "new", "IllegalCodeException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "illegalCodePath", ",", "destination", ".", "getSimpleName", "(", ")", ",", "source", ".", "getSimpleName", "(", ")", ",", "path", ",", "additionalInformation", ")", ")", ";", "}" ]
Thrown when there is an error in mapper generated class. @param destination destination class @param source source class @param path xml path configuration @param e exception captured
[ "Thrown", "when", "there", "is", "an", "error", "in", "mapper", "generated", "class", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L590-L593
144,173
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.absentRelationship
public static void absentRelationship(Class<?> configuredClass, Class<?> targetClass){ throw new AbsentRelationshipException(MSG.INSTANCE.message(noRelationshipException,configuredClass.getSimpleName(),targetClass.getSimpleName())); }
java
public static void absentRelationship(Class<?> configuredClass, Class<?> targetClass){ throw new AbsentRelationshipException(MSG.INSTANCE.message(noRelationshipException,configuredClass.getSimpleName(),targetClass.getSimpleName())); }
[ "public", "static", "void", "absentRelationship", "(", "Class", "<", "?", ">", "configuredClass", ",", "Class", "<", "?", ">", "targetClass", ")", "{", "throw", "new", "AbsentRelationshipException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "noRelationshipException", ",", "configuredClass", ".", "getSimpleName", "(", ")", ",", "targetClass", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown when there isn't correspondence between classes. @param configuredClass configured class @param targetClass target class
[ "Thrown", "when", "there", "isn", "t", "correspondence", "between", "classes", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L609-L611
144,174
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.emptyConstructorAbsent
public static void emptyConstructorAbsent(Class<?> aClass){ throw new MalformedBeanException(MSG.INSTANCE.message(malformedBeanException1,aClass.getSimpleName())); }
java
public static void emptyConstructorAbsent(Class<?> aClass){ throw new MalformedBeanException(MSG.INSTANCE.message(malformedBeanException1,aClass.getSimpleName())); }
[ "public", "static", "void", "emptyConstructorAbsent", "(", "Class", "<", "?", ">", "aClass", ")", "{", "throw", "new", "MalformedBeanException", "(", "MSG", ".", "INSTANCE", ".", "message", "(", "malformedBeanException1", ",", "aClass", ".", "getSimpleName", "(", ")", ")", ")", ";", "}" ]
Thrown if the class haven't an empty constructor. @param aClass class to analyze
[ "Thrown", "if", "the", "class", "haven", "t", "an", "empty", "constructor", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L632-L634
144,175
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructorAccessor.java
MapperConstructorAccessor.searchConfig
protected ChooseConfig searchConfig(ChooseConfig cc, XML xml){ ChooseConfig config = searchXmlConfig(cc, xml); if(isNull(config))config = searchAnnotatedConfig(cc); return config; }
java
protected ChooseConfig searchConfig(ChooseConfig cc, XML xml){ ChooseConfig config = searchXmlConfig(cc, xml); if(isNull(config))config = searchAnnotatedConfig(cc); return config; }
[ "protected", "ChooseConfig", "searchConfig", "(", "ChooseConfig", "cc", ",", "XML", "xml", ")", "{", "ChooseConfig", "config", "=", "searchXmlConfig", "(", "cc", ",", "xml", ")", ";", "if", "(", "isNull", "(", "config", ")", ")", "config", "=", "searchAnnotatedConfig", "(", "cc", ")", ";", "return", "config", ";", "}" ]
This method finds the configuration location, returns null if don't finds it @param cc configuration chosen @param xml xml object @return configuration found
[ "This", "method", "finds", "the", "configuration", "location", "returns", "null", "if", "don", "t", "finds", "it" ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructorAccessor.java#L88-L93
144,176
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructorAccessor.java
MapperConstructorAccessor.searchXmlConfig
private ChooseConfig searchXmlConfig(ChooseConfig cc, XML xml){ if(isNull(xml.getXmlPath())) return null; if((isNull(cc)||cc == ChooseConfig.DESTINATION) && xml.isInheritedMapped(destination)) return ChooseConfig.DESTINATION; if((isNull(cc)||cc == ChooseConfig.SOURCE) && xml.isInheritedMapped(source)) return ChooseConfig.SOURCE; return null; }
java
private ChooseConfig searchXmlConfig(ChooseConfig cc, XML xml){ if(isNull(xml.getXmlPath())) return null; if((isNull(cc)||cc == ChooseConfig.DESTINATION) && xml.isInheritedMapped(destination)) return ChooseConfig.DESTINATION; if((isNull(cc)||cc == ChooseConfig.SOURCE) && xml.isInheritedMapped(source)) return ChooseConfig.SOURCE; return null; }
[ "private", "ChooseConfig", "searchXmlConfig", "(", "ChooseConfig", "cc", ",", "XML", "xml", ")", "{", "if", "(", "isNull", "(", "xml", ".", "getXmlPath", "(", ")", ")", ")", "return", "null", ";", "if", "(", "(", "isNull", "(", "cc", ")", "||", "cc", "==", "ChooseConfig", ".", "DESTINATION", ")", "&&", "xml", ".", "isInheritedMapped", "(", "destination", ")", ")", "return", "ChooseConfig", ".", "DESTINATION", ";", "if", "(", "(", "isNull", "(", "cc", ")", "||", "cc", "==", "ChooseConfig", ".", "SOURCE", ")", "&&", "xml", ".", "isInheritedMapped", "(", "source", ")", ")", "return", "ChooseConfig", ".", "SOURCE", ";", "return", "null", ";", "}" ]
This method finds the xml configuration, returns null if there are no. @param cc Configuration to check @param xml xml object return ChooseConfig configuration found
[ "This", "method", "finds", "the", "xml", "configuration", "returns", "null", "if", "there", "are", "no", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructorAccessor.java#L101-L112
144,177
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructorAccessor.java
MapperConstructorAccessor.searchAnnotatedConfig
private ChooseConfig searchAnnotatedConfig(ChooseConfig cc) { if((isNull(cc)||cc == ChooseConfig.DESTINATION) && Annotation.isInheritedMapped(destination)) return ChooseConfig.DESTINATION; if((isNull(cc)||cc == ChooseConfig.SOURCE) && Annotation.isInheritedMapped(source)) return ChooseConfig.SOURCE; return null; }
java
private ChooseConfig searchAnnotatedConfig(ChooseConfig cc) { if((isNull(cc)||cc == ChooseConfig.DESTINATION) && Annotation.isInheritedMapped(destination)) return ChooseConfig.DESTINATION; if((isNull(cc)||cc == ChooseConfig.SOURCE) && Annotation.isInheritedMapped(source)) return ChooseConfig.SOURCE; return null; }
[ "private", "ChooseConfig", "searchAnnotatedConfig", "(", "ChooseConfig", "cc", ")", "{", "if", "(", "(", "isNull", "(", "cc", ")", "||", "cc", "==", "ChooseConfig", ".", "DESTINATION", ")", "&&", "Annotation", ".", "isInheritedMapped", "(", "destination", ")", ")", "return", "ChooseConfig", ".", "DESTINATION", ";", "if", "(", "(", "isNull", "(", "cc", ")", "||", "cc", "==", "ChooseConfig", ".", "SOURCE", ")", "&&", "Annotation", ".", "isInheritedMapped", "(", "source", ")", ")", "return", "ChooseConfig", ".", "SOURCE", ";", "return", "null", ";", "}" ]
This method finds the annotations, returns null if there are no. @param cc Configuration to check return ChooseConfig configuration found
[ "This", "method", "finds", "the", "annotations", "returns", "null", "if", "there", "are", "no", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructorAccessor.java#L119-L128
144,178
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java
Annotation.getFieldAccessors
public static JMapAccessor getFieldAccessors(Class<?> clazz, Field field){ return getFieldAccessors(clazz,field,false, field.getName(),Constants.DEFAULT_FIELD_VALUE); }
java
public static JMapAccessor getFieldAccessors(Class<?> clazz, Field field){ return getFieldAccessors(clazz,field,false, field.getName(),Constants.DEFAULT_FIELD_VALUE); }
[ "public", "static", "JMapAccessor", "getFieldAccessors", "(", "Class", "<", "?", ">", "clazz", ",", "Field", "field", ")", "{", "return", "getFieldAccessors", "(", "clazz", ",", "field", ",", "false", ",", "field", ".", "getName", "(", ")", ",", "Constants", ".", "DEFAULT_FIELD_VALUE", ")", ";", "}" ]
Returns JMapAccessor relative to this field, null if not present. @param clazz field's class @param field to check @return JMapAccessor if exists, null otherwise
[ "Returns", "JMapAccessor", "relative", "to", "this", "field", "null", "if", "not", "present", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java#L104-L106
144,179
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java
Annotation.getAccessor
private static JMapAccessor getAccessor(Class<?> clazz, java.lang.annotation.Annotation[] annotations, String fieldName, boolean isOpposite){ for (java.lang.annotation.Annotation annotation : annotations) { if(annotation.annotationType() == JMapAccessors.class){ JMapAccessors jmapAccessors = (JMapAccessors)annotation; for (JMapAccessor jmapAccessor : jmapAccessors.value()) if(isValid(jmapAccessor,fieldName,clazz,isOpposite)) return jmapAccessor; } if(annotation.annotationType() == JMapAccessor.class){ JMapAccessor jmapAccessor = (JMapAccessor)annotation; if(isValid(jmapAccessor,fieldName,clazz,isOpposite)) return jmapAccessor; } } return null; }
java
private static JMapAccessor getAccessor(Class<?> clazz, java.lang.annotation.Annotation[] annotations, String fieldName, boolean isOpposite){ for (java.lang.annotation.Annotation annotation : annotations) { if(annotation.annotationType() == JMapAccessors.class){ JMapAccessors jmapAccessors = (JMapAccessors)annotation; for (JMapAccessor jmapAccessor : jmapAccessors.value()) if(isValid(jmapAccessor,fieldName,clazz,isOpposite)) return jmapAccessor; } if(annotation.annotationType() == JMapAccessor.class){ JMapAccessor jmapAccessor = (JMapAccessor)annotation; if(isValid(jmapAccessor,fieldName,clazz,isOpposite)) return jmapAccessor; } } return null; }
[ "private", "static", "JMapAccessor", "getAccessor", "(", "Class", "<", "?", ">", "clazz", ",", "java", ".", "lang", ".", "annotation", ".", "Annotation", "[", "]", "annotations", ",", "String", "fieldName", ",", "boolean", "isOpposite", ")", "{", "for", "(", "java", ".", "lang", ".", "annotation", ".", "Annotation", "annotation", ":", "annotations", ")", "{", "if", "(", "annotation", ".", "annotationType", "(", ")", "==", "JMapAccessors", ".", "class", ")", "{", "JMapAccessors", "jmapAccessors", "=", "(", "JMapAccessors", ")", "annotation", ";", "for", "(", "JMapAccessor", "jmapAccessor", ":", "jmapAccessors", ".", "value", "(", ")", ")", "if", "(", "isValid", "(", "jmapAccessor", ",", "fieldName", ",", "clazz", ",", "isOpposite", ")", ")", "return", "jmapAccessor", ";", "}", "if", "(", "annotation", ".", "annotationType", "(", ")", "==", "JMapAccessor", ".", "class", ")", "{", "JMapAccessor", "jmapAccessor", "=", "(", "JMapAccessor", ")", "annotation", ";", "if", "(", "isValid", "(", "jmapAccessor", ",", "fieldName", ",", "clazz", ",", "isOpposite", ")", ")", "return", "jmapAccessor", ";", "}", "}", "return", "null", ";", "}" ]
It finds between annotations if exists a JMapAccessor relative to the field with this name. @param annotations annotations to check @param fieldName field name @param isOpposite true if accessor methods to check belong to the opposite field, false otherwise @return JMapAccessor if exists, null otherwise
[ "It", "finds", "between", "annotations", "if", "exists", "a", "JMapAccessor", "relative", "to", "the", "field", "with", "this", "name", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java#L142-L156
144,180
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java
Annotation.getConversionMethods
public static List<ConversionMethod> getConversionMethods(Class<?> clazz){ List<ConversionMethod> conversions = new ArrayList<ConversionMethod>(); for(Method method:getAnnotatedMethods(clazz)) try{ conversions.add(Converter.toConversionMethod(method)); }catch (ConversionParameterException e) { Error.wrongParameterNumber(method.getName(),clazz.getSimpleName()); }catch (DynamicConversionParameterException e) { Error.parametersUsageNotAllowed(method.getName(), clazz.getSimpleName()); }catch (DynamicConversionMethodException e) { Error.incorrectMethodDefinition(method.getName(), clazz.getSimpleName()); }catch (DynamicConversionBodyException e) { Error.incorrectBodyDefinition(method.getName(), clazz.getSimpleName()); } return conversions; }
java
public static List<ConversionMethod> getConversionMethods(Class<?> clazz){ List<ConversionMethod> conversions = new ArrayList<ConversionMethod>(); for(Method method:getAnnotatedMethods(clazz)) try{ conversions.add(Converter.toConversionMethod(method)); }catch (ConversionParameterException e) { Error.wrongParameterNumber(method.getName(),clazz.getSimpleName()); }catch (DynamicConversionParameterException e) { Error.parametersUsageNotAllowed(method.getName(), clazz.getSimpleName()); }catch (DynamicConversionMethodException e) { Error.incorrectMethodDefinition(method.getName(), clazz.getSimpleName()); }catch (DynamicConversionBodyException e) { Error.incorrectBodyDefinition(method.getName(), clazz.getSimpleName()); } return conversions; }
[ "public", "static", "List", "<", "ConversionMethod", ">", "getConversionMethods", "(", "Class", "<", "?", ">", "clazz", ")", "{", "List", "<", "ConversionMethod", ">", "conversions", "=", "new", "ArrayList", "<", "ConversionMethod", ">", "(", ")", ";", "for", "(", "Method", "method", ":", "getAnnotatedMethods", "(", "clazz", ")", ")", "try", "{", "conversions", ".", "add", "(", "Converter", ".", "toConversionMethod", "(", "method", ")", ")", ";", "}", "catch", "(", "ConversionParameterException", "e", ")", "{", "Error", ".", "wrongParameterNumber", "(", "method", ".", "getName", "(", ")", ",", "clazz", ".", "getSimpleName", "(", ")", ")", ";", "}", "catch", "(", "DynamicConversionParameterException", "e", ")", "{", "Error", ".", "parametersUsageNotAllowed", "(", "method", ".", "getName", "(", ")", ",", "clazz", ".", "getSimpleName", "(", ")", ")", ";", "}", "catch", "(", "DynamicConversionMethodException", "e", ")", "{", "Error", ".", "incorrectMethodDefinition", "(", "method", ".", "getName", "(", ")", ",", "clazz", ".", "getSimpleName", "(", ")", ")", ";", "}", "catch", "(", "DynamicConversionBodyException", "e", ")", "{", "Error", ".", "incorrectBodyDefinition", "(", "method", ".", "getName", "(", ")", ",", "clazz", ".", "getSimpleName", "(", ")", ")", ";", "}", "return", "conversions", ";", "}" ]
Returns a list of ConversionMethod that belong to the class given as input. @param clazz class to check @return a list of conversionMethod
[ "Returns", "a", "list", "of", "ConversionMethod", "that", "belong", "to", "the", "class", "given", "as", "input", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java#L187-L202
144,181
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java
Annotation.getAnnotatedMethods
private static List<Method> getAnnotatedMethods(Class<?> clazz){ List<Method> methods = new ArrayList<Method>(); for(Method method:getAllMethods(clazz)) if(!isNull(method.getAnnotation(JMapConversion.class))) methods.add(method); return methods; }
java
private static List<Method> getAnnotatedMethods(Class<?> clazz){ List<Method> methods = new ArrayList<Method>(); for(Method method:getAllMethods(clazz)) if(!isNull(method.getAnnotation(JMapConversion.class))) methods.add(method); return methods; }
[ "private", "static", "List", "<", "Method", ">", "getAnnotatedMethods", "(", "Class", "<", "?", ">", "clazz", ")", "{", "List", "<", "Method", ">", "methods", "=", "new", "ArrayList", "<", "Method", ">", "(", ")", ";", "for", "(", "Method", "method", ":", "getAllMethods", "(", "clazz", ")", ")", "if", "(", "!", "isNull", "(", "method", ".", "getAnnotation", "(", "JMapConversion", ".", "class", ")", ")", ")", "methods", ".", "add", "(", "method", ")", ";", "return", "methods", ";", "}" ]
Returns a list with all annotated methods. @param clazz class to check @return a list with all annotated methods
[ "Returns", "a", "list", "with", "all", "annotated", "methods", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java#L209-L217
144,182
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java
Annotation.isInheritedMapped
public static boolean isInheritedMapped(Class<?> classToCheck){ for (Class<?> clazz : getAllsuperClasses(classToCheck)) if(!isNull(clazz.getAnnotation(JGlobalMap.class))) return true; for (Field field : getListOfFields(classToCheck)) if(!isNull(field.getAnnotation(JMap.class))) return true; return false; }
java
public static boolean isInheritedMapped(Class<?> classToCheck){ for (Class<?> clazz : getAllsuperClasses(classToCheck)) if(!isNull(clazz.getAnnotation(JGlobalMap.class))) return true; for (Field field : getListOfFields(classToCheck)) if(!isNull(field.getAnnotation(JMap.class))) return true; return false; }
[ "public", "static", "boolean", "isInheritedMapped", "(", "Class", "<", "?", ">", "classToCheck", ")", "{", "for", "(", "Class", "<", "?", ">", "clazz", ":", "getAllsuperClasses", "(", "classToCheck", ")", ")", "if", "(", "!", "isNull", "(", "clazz", ".", "getAnnotation", "(", "JGlobalMap", ".", "class", ")", ")", ")", "return", "true", ";", "for", "(", "Field", "field", ":", "getListOfFields", "(", "classToCheck", ")", ")", "if", "(", "!", "isNull", "(", "field", ".", "getAnnotation", "(", "JMap", ".", "class", ")", ")", ")", "return", "true", ";", "return", "false", ";", "}" ]
Returns true if the class is configured in annotation, false otherwise. @param classToCheck class to check @return true if the class is configured in annotation, false otherwise
[ "Returns", "true", "if", "the", "class", "is", "configured", "in", "annotation", "false", "otherwise", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/annotations/Annotation.java#L224-L235
144,183
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/implicit/ConversionAnalyzer.java
ConversionAnalyzer.getConversionType
public static ConversionType getConversionType(final Field destination, final Field source){ return getConversionType(destination.getType(),source.getType()); }
java
public static ConversionType getConversionType(final Field destination, final Field source){ return getConversionType(destination.getType(),source.getType()); }
[ "public", "static", "ConversionType", "getConversionType", "(", "final", "Field", "destination", ",", "final", "Field", "source", ")", "{", "return", "getConversionType", "(", "destination", ".", "getType", "(", ")", ",", "source", ".", "getType", "(", ")", ")", ";", "}" ]
Analyzes Fields given as input and returns the type of conversion that has to be done. @param destination Field to analyze @param source Field to analyze @return type of Conversion
[ "Analyzes", "Fields", "given", "as", "input", "and", "returns", "the", "type", "of", "conversion", "that", "has", "to", "be", "done", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/implicit/ConversionAnalyzer.java#L39-L41
144,184
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/implicit/ConversionAnalyzer.java
ConversionAnalyzer.getConversionType
public static ConversionType getConversionType(final Class<?> destination, final Class<?> source){ if(destination == String.class) return toStringConversion(source); if(destination == Byte.class) return toByteConversion(source); if(destination == byte.class) return tobyteConversion(source); if(destination == Short.class) return toShortConversion(source); if(destination == short.class) return toshortConversion(source); if(destination == Integer.class) return toIntegerConversion(source); if(destination == int.class) return tointConversion(source); if(destination == Long.class) return toLongConversion(source); if(destination == long.class) return tolongConversion(source); if(destination == Float.class) return toFloatConversion(source); if(destination == float.class) return tofloatConversion(source); if(destination == Double.class) return toDoubleConversion(source); if(destination == double.class) return todoubleConversion(source); if(destination == Character.class)return toCharacterConversion(source); if(destination == char.class) return tocharConversion(source); if(destination == Boolean.class) return toBooleanConversion(source); if(destination == boolean.class) return tobooleanConversion(source); return UNDEFINED; }
java
public static ConversionType getConversionType(final Class<?> destination, final Class<?> source){ if(destination == String.class) return toStringConversion(source); if(destination == Byte.class) return toByteConversion(source); if(destination == byte.class) return tobyteConversion(source); if(destination == Short.class) return toShortConversion(source); if(destination == short.class) return toshortConversion(source); if(destination == Integer.class) return toIntegerConversion(source); if(destination == int.class) return tointConversion(source); if(destination == Long.class) return toLongConversion(source); if(destination == long.class) return tolongConversion(source); if(destination == Float.class) return toFloatConversion(source); if(destination == float.class) return tofloatConversion(source); if(destination == Double.class) return toDoubleConversion(source); if(destination == double.class) return todoubleConversion(source); if(destination == Character.class)return toCharacterConversion(source); if(destination == char.class) return tocharConversion(source); if(destination == Boolean.class) return toBooleanConversion(source); if(destination == boolean.class) return tobooleanConversion(source); return UNDEFINED; }
[ "public", "static", "ConversionType", "getConversionType", "(", "final", "Class", "<", "?", ">", "destination", ",", "final", "Class", "<", "?", ">", "source", ")", "{", "if", "(", "destination", "==", "String", ".", "class", ")", "return", "toStringConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "Byte", ".", "class", ")", "return", "toByteConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "byte", ".", "class", ")", "return", "tobyteConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "Short", ".", "class", ")", "return", "toShortConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "short", ".", "class", ")", "return", "toshortConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "Integer", ".", "class", ")", "return", "toIntegerConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "int", ".", "class", ")", "return", "tointConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "Long", ".", "class", ")", "return", "toLongConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "long", ".", "class", ")", "return", "tolongConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "Float", ".", "class", ")", "return", "toFloatConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "float", ".", "class", ")", "return", "tofloatConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "Double", ".", "class", ")", "return", "toDoubleConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "double", ".", "class", ")", "return", "todoubleConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "Character", ".", "class", ")", "return", "toCharacterConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "char", ".", "class", ")", "return", "tocharConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "Boolean", ".", "class", ")", "return", "toBooleanConversion", "(", "source", ")", ";", "if", "(", "destination", "==", "boolean", ".", "class", ")", "return", "tobooleanConversion", "(", "source", ")", ";", "return", "UNDEFINED", ";", "}" ]
Analyzes classes given as input and returns the type of conversion that has to be done. @param destination class to analyze @param source class to analyze @return type of Conversion
[ "Analyzes", "classes", "given", "as", "input", "and", "returns", "the", "type", "of", "conversion", "that", "has", "to", "be", "done", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/implicit/ConversionAnalyzer.java#L373-L393
144,185
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/operations/OperationHandler.java
OperationHandler.defineStructure
private Class<?> defineStructure(Field destination, Field source){ Class<?> destinationClass = destination.getType(); Class<?> sourceClass = source.getType(); Class<?> result = null; // if destination is an interface if(destinationClass.isInterface()) // if source is an interface if(sourceClass.isInterface()) // retrieves the implementation of the destination interface result = (Class<?>) implementationClass.get(destinationClass.getName()); // if source is an implementation else{ // retrieves source interface Class<?> sourceInterface = sourceClass.getInterfaces()[0]; // if the destination and source interfaces are equal if(destinationClass.equals(sourceInterface)) // assigns implementation to destination result = sourceClass; // if they are different else // destination gets the implementation of his interface result = (Class<?>) implementationClass.get(destinationClass.getName()); } // if destination is an implementation else result = destinationClass; return result; }
java
private Class<?> defineStructure(Field destination, Field source){ Class<?> destinationClass = destination.getType(); Class<?> sourceClass = source.getType(); Class<?> result = null; // if destination is an interface if(destinationClass.isInterface()) // if source is an interface if(sourceClass.isInterface()) // retrieves the implementation of the destination interface result = (Class<?>) implementationClass.get(destinationClass.getName()); // if source is an implementation else{ // retrieves source interface Class<?> sourceInterface = sourceClass.getInterfaces()[0]; // if the destination and source interfaces are equal if(destinationClass.equals(sourceInterface)) // assigns implementation to destination result = sourceClass; // if they are different else // destination gets the implementation of his interface result = (Class<?>) implementationClass.get(destinationClass.getName()); } // if destination is an implementation else result = destinationClass; return result; }
[ "private", "Class", "<", "?", ">", "defineStructure", "(", "Field", "destination", ",", "Field", "source", ")", "{", "Class", "<", "?", ">", "destinationClass", "=", "destination", ".", "getType", "(", ")", ";", "Class", "<", "?", ">", "sourceClass", "=", "source", ".", "getType", "(", ")", ";", "Class", "<", "?", ">", "result", "=", "null", ";", "// if destination is an interface\r", "if", "(", "destinationClass", ".", "isInterface", "(", ")", ")", "// if source is an interface\r", "if", "(", "sourceClass", ".", "isInterface", "(", ")", ")", "// retrieves the implementation of the destination interface\r", "result", "=", "(", "Class", "<", "?", ">", ")", "implementationClass", ".", "get", "(", "destinationClass", ".", "getName", "(", ")", ")", ";", "// if source is an implementation\t\r", "else", "{", "// retrieves source interface\r", "Class", "<", "?", ">", "sourceInterface", "=", "sourceClass", ".", "getInterfaces", "(", ")", "[", "0", "]", ";", "// if the destination and source interfaces are equal\r", "if", "(", "destinationClass", ".", "equals", "(", "sourceInterface", ")", ")", "// assigns implementation to destination\r", "result", "=", "sourceClass", ";", "// if they are different\r", "else", "// destination gets the implementation of his interface\r", "result", "=", "(", "Class", "<", "?", ">", ")", "implementationClass", ".", "get", "(", "destinationClass", ".", "getName", "(", ")", ")", ";", "}", "// if destination is an implementation\r", "else", "result", "=", "destinationClass", ";", "return", "result", ";", "}" ]
This method defines the destination structure for this operation. If destination class is an interface, a relative implementation will be found. @param destination destination field @param source source field
[ "This", "method", "defines", "the", "destination", "structure", "for", "this", "operation", ".", "If", "destination", "class", "is", "an", "interface", "a", "relative", "implementation", "will", "be", "found", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/OperationHandler.java#L241-L272
144,186
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/cache/JMapperCache.java
JMapperCache.getMapper
public static <D,S> IJMapper<D, S> getMapper(final Class<D> destination, final Class<S> source){ return getMapper(destination,source, undefinedConfig()); }
java
public static <D,S> IJMapper<D, S> getMapper(final Class<D> destination, final Class<S> source){ return getMapper(destination,source, undefinedConfig()); }
[ "public", "static", "<", "D", ",", "S", ">", "IJMapper", "<", "D", ",", "S", ">", "getMapper", "(", "final", "Class", "<", "D", ">", "destination", ",", "final", "Class", "<", "S", ">", "source", ")", "{", "return", "getMapper", "(", "destination", ",", "source", ",", "undefinedConfig", "(", ")", ")", ";", "}" ]
Returns an instance of JMapper from cache if exists, in alternative a new instance. @param destination the Destination Class @param source the Source Class @param <D> Destination class @param <S> Source Class @return the mapper instance
[ "Returns", "an", "instance", "of", "JMapper", "from", "cache", "if", "exists", "in", "alternative", "a", "new", "instance", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/cache/JMapperCache.java#L58-L60
144,187
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/cache/JMapperCache.java
JMapperCache.relationalMapperName
private static String relationalMapperName(Class<?> configuredClass, String resource){ String className = configuredClass.getName().replaceAll("\\.",""); if(isEmpty(resource)) return className; if(!isPath(resource)) return write(className, String.valueOf(resource.hashCode())); String[]dep = resource.split("\\\\"); if(dep.length<=1)dep = resource.split("/"); String xml = dep[dep.length-1]; return write(className, xml.replaceAll("\\.","").replaceAll(" ","")); }
java
private static String relationalMapperName(Class<?> configuredClass, String resource){ String className = configuredClass.getName().replaceAll("\\.",""); if(isEmpty(resource)) return className; if(!isPath(resource)) return write(className, String.valueOf(resource.hashCode())); String[]dep = resource.split("\\\\"); if(dep.length<=1)dep = resource.split("/"); String xml = dep[dep.length-1]; return write(className, xml.replaceAll("\\.","").replaceAll(" ","")); }
[ "private", "static", "String", "relationalMapperName", "(", "Class", "<", "?", ">", "configuredClass", ",", "String", "resource", ")", "{", "String", "className", "=", "configuredClass", ".", "getName", "(", ")", ".", "replaceAll", "(", "\"\\\\.\"", ",", "\"\"", ")", ";", "if", "(", "isEmpty", "(", "resource", ")", ")", "return", "className", ";", "if", "(", "!", "isPath", "(", "resource", ")", ")", "return", "write", "(", "className", ",", "String", ".", "valueOf", "(", "resource", ".", "hashCode", "(", ")", ")", ")", ";", "String", "[", "]", "dep", "=", "resource", ".", "split", "(", "\"\\\\\\\\\"", ")", ";", "if", "(", "dep", ".", "length", "<=", "1", ")", "dep", "=", "resource", ".", "split", "(", "\"/\"", ")", ";", "String", "xml", "=", "dep", "[", "dep", ".", "length", "-", "1", "]", ";", "return", "write", "(", "className", ",", "xml", ".", "replaceAll", "(", "\"\\\\.\"", ",", "\"\"", ")", ".", "replaceAll", "(", "\" \"", ",", "\"\"", ")", ")", ";", "}" ]
Returns a unique name that identify this relationalMapper. @param configuredClass configured class @param resource resource to analyze @return Returns a string that represents the identifier for this relationalMapper instance
[ "Returns", "a", "unique", "name", "that", "identify", "this", "relationalMapper", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/cache/JMapperCache.java#L215-L229
144,188
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/api/JMapperAPI.java
JMapperAPI.attribute
public static Attribute attribute(String name, String customGet, String customSet){ return new Attribute(name, customGet, customSet); }
java
public static Attribute attribute(String name, String customGet, String customSet){ return new Attribute(name, customGet, customSet); }
[ "public", "static", "Attribute", "attribute", "(", "String", "name", ",", "String", "customGet", ",", "String", "customSet", ")", "{", "return", "new", "Attribute", "(", "name", ",", "customGet", ",", "customSet", ")", ";", "}" ]
Permits to define an attribute to map. @param name name of this attribute @param customGet custom get method @param customSet custom set method @return an instance of Attribute
[ "Permits", "to", "define", "an", "attribute", "to", "map", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/api/JMapperAPI.java#L87-L89
144,189
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/api/JMapperAPI.java
JMapperAPI.targetAttribute
public static TargetAttribute targetAttribute(String name, String customGet, String customSet){ return new TargetAttribute(name, customGet, customSet); }
java
public static TargetAttribute targetAttribute(String name, String customGet, String customSet){ return new TargetAttribute(name, customGet, customSet); }
[ "public", "static", "TargetAttribute", "targetAttribute", "(", "String", "name", ",", "String", "customGet", ",", "String", "customSet", ")", "{", "return", "new", "TargetAttribute", "(", "name", ",", "customGet", ",", "customSet", ")", ";", "}" ]
Permits to define a target attribute. @param name target attribute name @param customGet custom get method @param customSet custom set method @return an instance of TargetAttribute
[ "Permits", "to", "define", "a", "target", "attribute", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/api/JMapperAPI.java#L107-L109
144,190
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/api/JMapperAPI.java
JMapperAPI.localAttribute
public static LocalAttribute localAttribute(String name, String customGet, String customSet){ return new LocalAttribute(name, customGet, customSet); }
java
public static LocalAttribute localAttribute(String name, String customGet, String customSet){ return new LocalAttribute(name, customGet, customSet); }
[ "public", "static", "LocalAttribute", "localAttribute", "(", "String", "name", ",", "String", "customGet", ",", "String", "customSet", ")", "{", "return", "new", "LocalAttribute", "(", "name", ",", "customGet", ",", "customSet", ")", ";", "}" ]
Permits to define a local attribute. @param name local attribute name @param customGet custom get method @param customSet custom set method @return an instance of LocalAttribute
[ "Permits", "to", "define", "a", "local", "attribute", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/api/JMapperAPI.java#L127-L129
144,191
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/JmapperLog.java
JmapperLog.error
public static void error(Throwable e) throws JMapperException{ logger.error("{}: {}",e.getClass().getSimpleName(),e.getMessage()); throw new JMapperException(e); }
java
public static void error(Throwable e) throws JMapperException{ logger.error("{}: {}",e.getClass().getSimpleName(),e.getMessage()); throw new JMapperException(e); }
[ "public", "static", "void", "error", "(", "Throwable", "e", ")", "throws", "JMapperException", "{", "logger", ".", "error", "(", "\"{}: {}\"", ",", "e", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ",", "e", ".", "getMessage", "(", ")", ")", ";", "throw", "new", "JMapperException", "(", "e", ")", ";", "}" ]
This method handles error log. @param e exception to handle
[ "This", "method", "handles", "error", "log", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/JmapperLog.java#L44-L47
144,192
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/operations/AGeneralOperationAccessor.java
AGeneralOperationAccessor.write
protected final StringBuilder write(StringBuilder sb,final Object... objects){ for (Object string : objects)sb.append(string); return sb; }
java
protected final StringBuilder write(StringBuilder sb,final Object... objects){ for (Object string : objects)sb.append(string); return sb; }
[ "protected", "final", "StringBuilder", "write", "(", "StringBuilder", "sb", ",", "final", "Object", "...", "objects", ")", "{", "for", "(", "Object", "string", ":", "objects", ")", "sb", ".", "append", "(", "string", ")", ";", "return", "sb", ";", "}" ]
This method adds to the sb the objects. @param sb StringBuilder to be used @param objects objects to be added to sb @return the sb parameter
[ "This", "method", "adds", "to", "the", "sb", "the", "objects", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/operations/AGeneralOperationAccessor.java#L188-L191
144,193
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionHandler.java
ConversionHandler.loadMethod
public Method loadMethod(){ methodToGenerate = new Method(); // the method will be created in the mapper membership = Membership.MAPPER; // class to which it belongs methodToGenerate.setClazz(configClass); Class<?> destinationClass = destinationField.getType(); Class<?> sourceClass = sourceField.getType(); // Return Type definition methodToGenerate.setReturnType(destinationClass); // Parameters type definition switch (methodDefined.getParameterNumber()) { case ZERO:methodToGenerate.setParameters(new Class<?>[]{}); break; case ONE: methodToGenerate.setParameters(new Class<?>[]{sourceClass}); break; case TWO: methodToGenerate.setParameters(new Class<?>[]{destinationClass,sourceClass}); break; } // setting of conversion method name methodToGenerate.setOriginalName(methodDefined.getName()); // Method name definition switch (methodDefined.getType()) { case STATIC: methodToGenerate.setName(definedName());break; case DYNAMIC: methodToGenerate.setName(dynamicName());break; } // adds the generated name in the defined method methodDefined.setName(methodToGenerate.getName()); int count = 1; String body = "{try{"; // Parameters type definition switch (methodDefined.getParameterNumber()) { case TWO: String dType = placeholders.get(destinationTypePattern); String dName = placeholders.get(destinationPattern); body += dType+" "+dName+" = ("+dType+") $"+count+++";"+newLine; case ONE: String sType = placeholders.get(sourceTypePattern); String sName = placeholders.get(sourcePattern); body += sType+" "+sName+" = ("+sType+") $"+count+";"+newLine; default: break; } // Method body definition body += methodDefined.getContent(); for (Entry<String, String> pair : placeholders.entrySet()) // only if the placeholder is used if(!isNull(pair.getValue())) body = body.replaceAll(pair.getKey(), Matcher.quoteReplacement(pair.getValue())); return methodToGenerate.setBody(body+"}catch(java.lang.Exception e){"+error()+"}return "+defaultPrimitiveValue(destinationClass)+";}"); }
java
public Method loadMethod(){ methodToGenerate = new Method(); // the method will be created in the mapper membership = Membership.MAPPER; // class to which it belongs methodToGenerate.setClazz(configClass); Class<?> destinationClass = destinationField.getType(); Class<?> sourceClass = sourceField.getType(); // Return Type definition methodToGenerate.setReturnType(destinationClass); // Parameters type definition switch (methodDefined.getParameterNumber()) { case ZERO:methodToGenerate.setParameters(new Class<?>[]{}); break; case ONE: methodToGenerate.setParameters(new Class<?>[]{sourceClass}); break; case TWO: methodToGenerate.setParameters(new Class<?>[]{destinationClass,sourceClass}); break; } // setting of conversion method name methodToGenerate.setOriginalName(methodDefined.getName()); // Method name definition switch (methodDefined.getType()) { case STATIC: methodToGenerate.setName(definedName());break; case DYNAMIC: methodToGenerate.setName(dynamicName());break; } // adds the generated name in the defined method methodDefined.setName(methodToGenerate.getName()); int count = 1; String body = "{try{"; // Parameters type definition switch (methodDefined.getParameterNumber()) { case TWO: String dType = placeholders.get(destinationTypePattern); String dName = placeholders.get(destinationPattern); body += dType+" "+dName+" = ("+dType+") $"+count+++";"+newLine; case ONE: String sType = placeholders.get(sourceTypePattern); String sName = placeholders.get(sourcePattern); body += sType+" "+sName+" = ("+sType+") $"+count+";"+newLine; default: break; } // Method body definition body += methodDefined.getContent(); for (Entry<String, String> pair : placeholders.entrySet()) // only if the placeholder is used if(!isNull(pair.getValue())) body = body.replaceAll(pair.getKey(), Matcher.quoteReplacement(pair.getValue())); return methodToGenerate.setBody(body+"}catch(java.lang.Exception e){"+error()+"}return "+defaultPrimitiveValue(destinationClass)+";}"); }
[ "public", "Method", "loadMethod", "(", ")", "{", "methodToGenerate", "=", "new", "Method", "(", ")", ";", "// the method will be created in the mapper\r", "membership", "=", "Membership", ".", "MAPPER", ";", "// class to which it belongs\r", "methodToGenerate", ".", "setClazz", "(", "configClass", ")", ";", "Class", "<", "?", ">", "destinationClass", "=", "destinationField", ".", "getType", "(", ")", ";", "Class", "<", "?", ">", "sourceClass", "=", "sourceField", ".", "getType", "(", ")", ";", "// Return Type definition\r", "methodToGenerate", ".", "setReturnType", "(", "destinationClass", ")", ";", "// Parameters type definition\r", "switch", "(", "methodDefined", ".", "getParameterNumber", "(", ")", ")", "{", "case", "ZERO", ":", "methodToGenerate", ".", "setParameters", "(", "new", "Class", "<", "?", ">", "[", "]", "{", "}", ")", ";", "break", ";", "case", "ONE", ":", "methodToGenerate", ".", "setParameters", "(", "new", "Class", "<", "?", ">", "[", "]", "{", "sourceClass", "}", ")", ";", "break", ";", "case", "TWO", ":", "methodToGenerate", ".", "setParameters", "(", "new", "Class", "<", "?", ">", "[", "]", "{", "destinationClass", ",", "sourceClass", "}", ")", ";", "break", ";", "}", "// setting of conversion method name\r", "methodToGenerate", ".", "setOriginalName", "(", "methodDefined", ".", "getName", "(", ")", ")", ";", "// Method name definition\r", "switch", "(", "methodDefined", ".", "getType", "(", ")", ")", "{", "case", "STATIC", ":", "methodToGenerate", ".", "setName", "(", "definedName", "(", ")", ")", ";", "break", ";", "case", "DYNAMIC", ":", "methodToGenerate", ".", "setName", "(", "dynamicName", "(", ")", ")", ";", "break", ";", "}", "// adds the generated name in the defined method\r", "methodDefined", ".", "setName", "(", "methodToGenerate", ".", "getName", "(", ")", ")", ";", "int", "count", "=", "1", ";", "String", "body", "=", "\"{try{\"", ";", "// Parameters type definition\r", "switch", "(", "methodDefined", ".", "getParameterNumber", "(", ")", ")", "{", "case", "TWO", ":", "String", "dType", "=", "placeholders", ".", "get", "(", "destinationTypePattern", ")", ";", "String", "dName", "=", "placeholders", ".", "get", "(", "destinationPattern", ")", ";", "body", "+=", "dType", "+", "\" \"", "+", "dName", "+", "\" = (\"", "+", "dType", "+", "\") $\"", "+", "count", "++", "+", "\";\"", "+", "newLine", ";", "case", "ONE", ":", "String", "sType", "=", "placeholders", ".", "get", "(", "sourceTypePattern", ")", ";", "String", "sName", "=", "placeholders", ".", "get", "(", "sourcePattern", ")", ";", "body", "+=", "sType", "+", "\" \"", "+", "sName", "+", "\" = (\"", "+", "sType", "+", "\") $\"", "+", "count", "+", "\";\"", "+", "newLine", ";", "default", ":", "break", ";", "}", "// Method body definition\r", "body", "+=", "methodDefined", ".", "getContent", "(", ")", ";", "for", "(", "Entry", "<", "String", ",", "String", ">", "pair", ":", "placeholders", ".", "entrySet", "(", ")", ")", "// only if the placeholder is used\r", "if", "(", "!", "isNull", "(", "pair", ".", "getValue", "(", ")", ")", ")", "body", "=", "body", ".", "replaceAll", "(", "pair", ".", "getKey", "(", ")", ",", "Matcher", ".", "quoteReplacement", "(", "pair", ".", "getValue", "(", ")", ")", ")", ";", "return", "methodToGenerate", ".", "setBody", "(", "body", "+", "\"}catch(java.lang.Exception e){\"", "+", "error", "(", ")", "+", "\"}return \"", "+", "defaultPrimitiveValue", "(", "destinationClass", ")", "+", "\";}\"", ")", ";", "}" ]
Loads the method to generate. @return the method to generate
[ "Loads", "the", "method", "to", "generate", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionHandler.java#L77-L130
144,194
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionHandler.java
ConversionHandler.defaultPrimitiveValue
private String defaultPrimitiveValue(Class<?> clazz){ return clazz == byte.class || clazz == short.class || clazz == int.class? "0": clazz == long.class? "0L": clazz == float.class? "0.0f": clazz == double.class? "0.0d": clazz == char.class ? "'\u0000'": clazz == boolean.class ? "false": "null"; }
java
private String defaultPrimitiveValue(Class<?> clazz){ return clazz == byte.class || clazz == short.class || clazz == int.class? "0": clazz == long.class? "0L": clazz == float.class? "0.0f": clazz == double.class? "0.0d": clazz == char.class ? "'\u0000'": clazz == boolean.class ? "false": "null"; }
[ "private", "String", "defaultPrimitiveValue", "(", "Class", "<", "?", ">", "clazz", ")", "{", "return", "clazz", "==", "byte", ".", "class", "||", "clazz", "==", "short", ".", "class", "||", "clazz", "==", "int", ".", "class", "?", "\"0\"", ":", "clazz", "==", "long", ".", "class", "?", "\"0L\"", ":", "clazz", "==", "float", ".", "class", "?", "\"0.0f\"", ":", "clazz", "==", "double", ".", "class", "?", "\"0.0d\"", ":", "clazz", "==", "char", ".", "class", "?", "\"'\\u0000'\"", ":", "clazz", "==", "boolean", ".", "class", "?", "\"false\"", ":", "\"null\"", ";", "}" ]
Returns the default values of primitive types in the form of strings. @param clazz primitive type @return a string that contains default value
[ "Returns", "the", "default", "values", "of", "primitive", "types", "in", "the", "form", "of", "strings", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionHandler.java#L138-L150
144,195
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionHandler.java
ConversionHandler.error
private String error(){ Map<String, List<ConversionMethod>> conversions = xml.conversionsLoad(); String methodName = "illegalCode"; String paramater = ""; String resource = xml.getXmlPath(); if(!isNull(resource)){ boolean isPath = isPath(resource); methodName = !isPath ? "illegalCodeContent":"illegalCode"; if(!conversions.isEmpty() && !isNull(conversions.get(configClass.getName()))){ // if is a content, the double quotes must be handled if(!isPath) resource = doubleQuotesHandling(resource); paramater = write(",\"",resource,"\""); } } return write("com.googlecode.jmapper.config.Error#",methodName,"(e,\"",methodToGenerate.getOriginalName(),"\",\"",configClass.getSimpleName(),"\"",paramater,");"); }
java
private String error(){ Map<String, List<ConversionMethod>> conversions = xml.conversionsLoad(); String methodName = "illegalCode"; String paramater = ""; String resource = xml.getXmlPath(); if(!isNull(resource)){ boolean isPath = isPath(resource); methodName = !isPath ? "illegalCodeContent":"illegalCode"; if(!conversions.isEmpty() && !isNull(conversions.get(configClass.getName()))){ // if is a content, the double quotes must be handled if(!isPath) resource = doubleQuotesHandling(resource); paramater = write(",\"",resource,"\""); } } return write("com.googlecode.jmapper.config.Error#",methodName,"(e,\"",methodToGenerate.getOriginalName(),"\",\"",configClass.getSimpleName(),"\"",paramater,");"); }
[ "private", "String", "error", "(", ")", "{", "Map", "<", "String", ",", "List", "<", "ConversionMethod", ">", ">", "conversions", "=", "xml", ".", "conversionsLoad", "(", ")", ";", "String", "methodName", "=", "\"illegalCode\"", ";", "String", "paramater", "=", "\"\"", ";", "String", "resource", "=", "xml", ".", "getXmlPath", "(", ")", ";", "if", "(", "!", "isNull", "(", "resource", ")", ")", "{", "boolean", "isPath", "=", "isPath", "(", "resource", ")", ";", "methodName", "=", "!", "isPath", "?", "\"illegalCodeContent\"", ":", "\"illegalCode\"", ";", "if", "(", "!", "conversions", ".", "isEmpty", "(", ")", "&&", "!", "isNull", "(", "conversions", ".", "get", "(", "configClass", ".", "getName", "(", ")", ")", ")", ")", "{", "// if is a content, the double quotes must be handled\r", "if", "(", "!", "isPath", ")", "resource", "=", "doubleQuotesHandling", "(", "resource", ")", ";", "paramater", "=", "write", "(", "\",\\\"\"", ",", "resource", ",", "\"\\\"\"", ")", ";", "}", "}", "return", "write", "(", "\"com.googlecode.jmapper.config.Error#\"", ",", "methodName", ",", "\"(e,\\\"\"", ",", "methodToGenerate", ".", "getOriginalName", "(", ")", ",", "\"\\\",\\\"\"", ",", "configClass", ".", "getSimpleName", "(", ")", ",", "\"\\\"\"", ",", "paramater", ",", "\");\"", ")", ";", "}" ]
This method surrounds the explicit conversion defined with a try-catch, to handle null pointers. @return the body wrapped
[ "This", "method", "surrounds", "the", "explicit", "conversion", "defined", "with", "a", "try", "-", "catch", "to", "handle", "null", "pointers", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionHandler.java#L155-L175
144,196
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionHandler.java
ConversionHandler.load
public ConversionHandler load(ConversionAnalyzer analyzer){ this.methodDefined = analyzer.getMethod(); this.membership = analyzer.getMembership(); this.configClass = membership == Membership.DESTINATION?destinationClass:sourceClass; this.configurationType = analyzer.getConfigurationType(); return this; }
java
public ConversionHandler load(ConversionAnalyzer analyzer){ this.methodDefined = analyzer.getMethod(); this.membership = analyzer.getMembership(); this.configClass = membership == Membership.DESTINATION?destinationClass:sourceClass; this.configurationType = analyzer.getConfigurationType(); return this; }
[ "public", "ConversionHandler", "load", "(", "ConversionAnalyzer", "analyzer", ")", "{", "this", ".", "methodDefined", "=", "analyzer", ".", "getMethod", "(", ")", ";", "this", ".", "membership", "=", "analyzer", ".", "getMembership", "(", ")", ";", "this", ".", "configClass", "=", "membership", "==", "Membership", ".", "DESTINATION", "?", "destinationClass", ":", "sourceClass", ";", "this", ".", "configurationType", "=", "analyzer", ".", "getConfigurationType", "(", ")", ";", "return", "this", ";", "}" ]
Loads analyzer configurations @param analyzer conversion analyzer @return this instance of ConversionHandler
[ "Loads", "analyzer", "configurations" ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionHandler.java#L228-L234
144,197
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionHandler.java
ConversionHandler.from
public ConversionHandler from(MappedField sourceMappedField){ this.sourceField = sourceMappedField.getValue(); placeholders.put(sourceTypePattern, sourceField.getType().getName()); placeholders.put(sourceNamePattern, sourceField.getName()); placeholders.put(sourceGetPattern, sourceMappedField.getMethod()); placeholders.put(sourceSetPattern, sourceMappedField.setMethod()); return this; }
java
public ConversionHandler from(MappedField sourceMappedField){ this.sourceField = sourceMappedField.getValue(); placeholders.put(sourceTypePattern, sourceField.getType().getName()); placeholders.put(sourceNamePattern, sourceField.getName()); placeholders.put(sourceGetPattern, sourceMappedField.getMethod()); placeholders.put(sourceSetPattern, sourceMappedField.setMethod()); return this; }
[ "public", "ConversionHandler", "from", "(", "MappedField", "sourceMappedField", ")", "{", "this", ".", "sourceField", "=", "sourceMappedField", ".", "getValue", "(", ")", ";", "placeholders", ".", "put", "(", "sourceTypePattern", ",", "sourceField", ".", "getType", "(", ")", ".", "getName", "(", ")", ")", ";", "placeholders", ".", "put", "(", "sourceNamePattern", ",", "sourceField", ".", "getName", "(", ")", ")", ";", "placeholders", ".", "put", "(", "sourceGetPattern", ",", "sourceMappedField", ".", "getMethod", "(", ")", ")", ";", "placeholders", ".", "put", "(", "sourceSetPattern", ",", "sourceMappedField", ".", "setMethod", "(", ")", ")", ";", "return", "this", ";", "}" ]
Source field definition. @param sourceMappedField source field @return this instance of ConversionHandler
[ "Source", "field", "definition", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionHandler.java#L241-L248
144,198
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionHandler.java
ConversionHandler.to
public ConversionHandler to(MappedField destinationMappedField){ this.destinationField = destinationMappedField.getValue(); placeholders.put(destinationTypePattern, destinationField.getType().getName()); placeholders.put(destinationNamePattern, destinationField.getName()); placeholders.put(destinationGetPattern, destinationMappedField.getMethod()); placeholders.put(destinationSetPattern, destinationMappedField.setMethod()); return this; }
java
public ConversionHandler to(MappedField destinationMappedField){ this.destinationField = destinationMappedField.getValue(); placeholders.put(destinationTypePattern, destinationField.getType().getName()); placeholders.put(destinationNamePattern, destinationField.getName()); placeholders.put(destinationGetPattern, destinationMappedField.getMethod()); placeholders.put(destinationSetPattern, destinationMappedField.setMethod()); return this; }
[ "public", "ConversionHandler", "to", "(", "MappedField", "destinationMappedField", ")", "{", "this", ".", "destinationField", "=", "destinationMappedField", ".", "getValue", "(", ")", ";", "placeholders", ".", "put", "(", "destinationTypePattern", ",", "destinationField", ".", "getType", "(", ")", ".", "getName", "(", ")", ")", ";", "placeholders", ".", "put", "(", "destinationNamePattern", ",", "destinationField", ".", "getName", "(", ")", ")", ";", "placeholders", ".", "put", "(", "destinationGetPattern", ",", "destinationMappedField", ".", "getMethod", "(", ")", ")", ";", "placeholders", ".", "put", "(", "destinationSetPattern", ",", "destinationMappedField", ".", "setMethod", "(", ")", ")", ";", "return", "this", ";", "}" ]
Destination field definition. @param destinationMappedField destination field @return this instance of ConversionHandler
[ "Destination", "field", "definition", "." ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/conversions/explicit/ConversionHandler.java#L255-L262
144,199
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/JMapper.java
JMapper.createMapper
private static synchronized <D,S> IMapper<D,S> createMapper(MapperBuilder mapper) throws Throwable{ Class<Mapper<D,S>> mapperClass = mapper.exist()?mapper.<D,S>get() :mapper.<D,S>generate(); return mapperClass.newInstance(); }
java
private static synchronized <D,S> IMapper<D,S> createMapper(MapperBuilder mapper) throws Throwable{ Class<Mapper<D,S>> mapperClass = mapper.exist()?mapper.<D,S>get() :mapper.<D,S>generate(); return mapperClass.newInstance(); }
[ "private", "static", "synchronized", "<", "D", ",", "S", ">", "IMapper", "<", "D", ",", "S", ">", "createMapper", "(", "MapperBuilder", "mapper", ")", "throws", "Throwable", "{", "Class", "<", "Mapper", "<", "D", ",", "S", ">", ">", "mapperClass", "=", "mapper", ".", "exist", "(", ")", "?", "mapper", ".", "<", "D", ",", "S", ">", "get", "(", ")", ":", "mapper", ".", "<", "D", ",", "S", ">", "generate", "(", ")", ";", "return", "mapperClass", ".", "newInstance", "(", ")", ";", "}" ]
This method is synchornized to avoid creations of the same instance @param mapper mapper generator @return mapper instance @throws Throwable
[ "This", "method", "is", "synchornized", "to", "avoid", "creations", "of", "the", "same", "instance" ]
b48fd3527f35055b8b4a30f53a51136f183acc90
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/JMapper.java#L447-L452