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
partition
stringclasses
1 value
weld/core
impl/src/main/java/org/jboss/weld/contexts/beanstore/AttributeBeanStore.java
AttributeBeanStore.fetchUninitializedAttributes
public void fetchUninitializedAttributes() { for (String prefixedId : getPrefixedAttributeNames()) { BeanIdentifier id = getNamingScheme().deprefix(prefixedId); if (!beanStore.contains(id)) { ContextualInstance<?> instance = (ContextualInstance<?>) getAttribute(prefixedId); beanStore.put(id, instance); ContextLogger.LOG.addingDetachedContextualUnderId(instance, id); } } }
java
public void fetchUninitializedAttributes() { for (String prefixedId : getPrefixedAttributeNames()) { BeanIdentifier id = getNamingScheme().deprefix(prefixedId); if (!beanStore.contains(id)) { ContextualInstance<?> instance = (ContextualInstance<?>) getAttribute(prefixedId); beanStore.put(id, instance); ContextLogger.LOG.addingDetachedContextualUnderId(instance, id); } } }
[ "public", "void", "fetchUninitializedAttributes", "(", ")", "{", "for", "(", "String", "prefixedId", ":", "getPrefixedAttributeNames", "(", ")", ")", "{", "BeanIdentifier", "id", "=", "getNamingScheme", "(", ")", ".", "deprefix", "(", "prefixedId", ")", ";", "...
Fetch all relevant attributes from the backing store and copy instances which are not present in the local bean store.
[ "Fetch", "all", "relevant", "attributes", "from", "the", "backing", "store", "and", "copy", "instances", "which", "are", "not", "present", "in", "the", "local", "bean", "store", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/contexts/beanstore/AttributeBeanStore.java#L119-L128
train
weld/core
impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java
WeldConfiguration.merge
static void merge(Map<ConfigurationKey, Object> original, Map<ConfigurationKey, Object> toMerge, String mergedSourceDescription) { for (Entry<ConfigurationKey, Object> entry : toMerge.entrySet()) { Object existing = original.get(entry.getKey()); if (existing != null) { ConfigurationLogger.LOG.configurationKeyAlreadySet(entry.getKey().get(), existing, entry.getValue(), mergedSourceDescription); } else { original.put(entry.getKey(), entry.getValue()); } } }
java
static void merge(Map<ConfigurationKey, Object> original, Map<ConfigurationKey, Object> toMerge, String mergedSourceDescription) { for (Entry<ConfigurationKey, Object> entry : toMerge.entrySet()) { Object existing = original.get(entry.getKey()); if (existing != null) { ConfigurationLogger.LOG.configurationKeyAlreadySet(entry.getKey().get(), existing, entry.getValue(), mergedSourceDescription); } else { original.put(entry.getKey(), entry.getValue()); } } }
[ "static", "void", "merge", "(", "Map", "<", "ConfigurationKey", ",", "Object", ">", "original", ",", "Map", "<", "ConfigurationKey", ",", "Object", ">", "toMerge", ",", "String", "mergedSourceDescription", ")", "{", "for", "(", "Entry", "<", "ConfigurationKey"...
Merge two maps of configuration properties. If the original contains a mapping for the same key, the new mapping is ignored. @param original @param toMerge
[ "Merge", "two", "maps", "of", "configuration", "properties", ".", "If", "the", "original", "contains", "a", "mapping", "for", "the", "same", "key", "the", "new", "mapping", "is", "ignored", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java#L203-L212
train
weld/core
impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java
WeldConfiguration.getObsoleteSystemProperties
private Map<ConfigurationKey, Object> getObsoleteSystemProperties() { Map<ConfigurationKey, Object> found = new EnumMap<ConfigurationKey, Object>(ConfigurationKey.class); String concurrentDeployment = getSystemProperty("org.jboss.weld.bootstrap.properties.concurrentDeployment"); if (concurrentDeployment != null) { processKeyValue(found, ConfigurationKey.CONCURRENT_DEPLOYMENT, concurrentDeployment); found.put(ConfigurationKey.CONCURRENT_DEPLOYMENT, ConfigurationKey.CONCURRENT_DEPLOYMENT.convertValue(concurrentDeployment)); } String preloaderThreadPoolSize = getSystemProperty("org.jboss.weld.bootstrap.properties.preloaderThreadPoolSize"); if (preloaderThreadPoolSize != null) { found.put(ConfigurationKey.PRELOADER_THREAD_POOL_SIZE, ConfigurationKey.PRELOADER_THREAD_POOL_SIZE.convertValue(preloaderThreadPoolSize)); } return found; }
java
private Map<ConfigurationKey, Object> getObsoleteSystemProperties() { Map<ConfigurationKey, Object> found = new EnumMap<ConfigurationKey, Object>(ConfigurationKey.class); String concurrentDeployment = getSystemProperty("org.jboss.weld.bootstrap.properties.concurrentDeployment"); if (concurrentDeployment != null) { processKeyValue(found, ConfigurationKey.CONCURRENT_DEPLOYMENT, concurrentDeployment); found.put(ConfigurationKey.CONCURRENT_DEPLOYMENT, ConfigurationKey.CONCURRENT_DEPLOYMENT.convertValue(concurrentDeployment)); } String preloaderThreadPoolSize = getSystemProperty("org.jboss.weld.bootstrap.properties.preloaderThreadPoolSize"); if (preloaderThreadPoolSize != null) { found.put(ConfigurationKey.PRELOADER_THREAD_POOL_SIZE, ConfigurationKey.PRELOADER_THREAD_POOL_SIZE.convertValue(preloaderThreadPoolSize)); } return found; }
[ "private", "Map", "<", "ConfigurationKey", ",", "Object", ">", "getObsoleteSystemProperties", "(", ")", "{", "Map", "<", "ConfigurationKey", ",", "Object", ">", "found", "=", "new", "EnumMap", "<", "ConfigurationKey", ",", "Object", ">", "(", "ConfigurationKey",...
Try to get a system property for obsolete keys. The value is automatically converted - a runtime exception may be thrown during conversion. @return all the properties whose system property keys were different in previous versions
[ "Try", "to", "get", "a", "system", "property", "for", "obsolete", "keys", ".", "The", "value", "is", "automatically", "converted", "-", "a", "runtime", "exception", "may", "be", "thrown", "during", "conversion", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java#L346-L358
train
weld/core
impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java
WeldConfiguration.readFileProperties
@SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS", justification = "Only local URLs involved") private Map<ConfigurationKey, Object> readFileProperties(Set<URL> files) { Map<ConfigurationKey, Object> found = new EnumMap<ConfigurationKey, Object>(ConfigurationKey.class); for (URL file : files) { ConfigurationLogger.LOG.readingPropertiesFile(file); Properties fileProperties = loadProperties(file); for (String name : fileProperties.stringPropertyNames()) { processKeyValue(found, name, fileProperties.getProperty(name)); } } return found; }
java
@SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS", justification = "Only local URLs involved") private Map<ConfigurationKey, Object> readFileProperties(Set<URL> files) { Map<ConfigurationKey, Object> found = new EnumMap<ConfigurationKey, Object>(ConfigurationKey.class); for (URL file : files) { ConfigurationLogger.LOG.readingPropertiesFile(file); Properties fileProperties = loadProperties(file); for (String name : fileProperties.stringPropertyNames()) { processKeyValue(found, name, fileProperties.getProperty(name)); } } return found; }
[ "@", "SuppressFBWarnings", "(", "value", "=", "\"DMI_COLLECTION_OF_URLS\"", ",", "justification", "=", "\"Only local URLs involved\"", ")", "private", "Map", "<", "ConfigurationKey", ",", "Object", ">", "readFileProperties", "(", "Set", "<", "URL", ">", "files", ")"...
Read the set of property files. Keys and Values are automatically validated and converted. @param resourceLoader @return all the properties from the weld.properties file
[ "Read", "the", "set", "of", "property", "files", ".", "Keys", "and", "Values", "are", "automatically", "validated", "and", "converted", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java#L366-L377
train
weld/core
impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java
WeldConfiguration.processKeyValue
private void processKeyValue(Map<ConfigurationKey, Object> properties, ConfigurationKey key, Object value) { if (value instanceof String) { value = key.convertValue((String) value); } if (key.isValidValue(value)) { Object previous = properties.put(key, value); if (previous != null && !previous.equals(value)) { throw ConfigurationLogger.LOG.configurationKeyHasDifferentValues(key.get(), previous, value); } } else { throw ConfigurationLogger.LOG.invalidConfigurationPropertyValue(value, key.get()); } }
java
private void processKeyValue(Map<ConfigurationKey, Object> properties, ConfigurationKey key, Object value) { if (value instanceof String) { value = key.convertValue((String) value); } if (key.isValidValue(value)) { Object previous = properties.put(key, value); if (previous != null && !previous.equals(value)) { throw ConfigurationLogger.LOG.configurationKeyHasDifferentValues(key.get(), previous, value); } } else { throw ConfigurationLogger.LOG.invalidConfigurationPropertyValue(value, key.get()); } }
[ "private", "void", "processKeyValue", "(", "Map", "<", "ConfigurationKey", ",", "Object", ">", "properties", ",", "ConfigurationKey", "key", ",", "Object", "value", ")", "{", "if", "(", "value", "instanceof", "String", ")", "{", "value", "=", "key", ".", "...
Process the given key and value. First validate the value and check if there's no different value for the same key in the same source - invalid and different values are treated as a deployment problem. @param properties @param key @param value
[ "Process", "the", "given", "key", "and", "value", ".", "First", "validate", "the", "value", "and", "check", "if", "there", "s", "no", "different", "value", "for", "the", "same", "key", "in", "the", "same", "source", "-", "invalid", "and", "different", "v...
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java#L427-L439
train
weld/core
impl/src/main/java/org/jboss/weld/event/ObserverFactory.java
ObserverFactory.create
public static <T, X> ObserverMethodImpl<T, X> create(EnhancedAnnotatedMethod<T, ? super X> method, RIBean<X> declaringBean, BeanManagerImpl manager, boolean isAsync) { if (declaringBean instanceof ExtensionBean) { return new ExtensionObserverMethodImpl<T, X>(method, declaringBean, manager, isAsync); } return new ObserverMethodImpl<T, X>(method, declaringBean, manager, isAsync); }
java
public static <T, X> ObserverMethodImpl<T, X> create(EnhancedAnnotatedMethod<T, ? super X> method, RIBean<X> declaringBean, BeanManagerImpl manager, boolean isAsync) { if (declaringBean instanceof ExtensionBean) { return new ExtensionObserverMethodImpl<T, X>(method, declaringBean, manager, isAsync); } return new ObserverMethodImpl<T, X>(method, declaringBean, manager, isAsync); }
[ "public", "static", "<", "T", ",", "X", ">", "ObserverMethodImpl", "<", "T", ",", "X", ">", "create", "(", "EnhancedAnnotatedMethod", "<", "T", ",", "?", "super", "X", ">", "method", ",", "RIBean", "<", "X", ">", "declaringBean", ",", "BeanManagerImpl", ...
Creates an observer @param method The observer method abstraction @param declaringBean The declaring bean @param manager The Bean manager @return An observer implementation built from the method abstraction
[ "Creates", "an", "observer" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/event/ObserverFactory.java#L46-L51
train
weld/core
impl/src/main/java/org/jboss/weld/event/ObserverFactory.java
ObserverFactory.getTransactionalPhase
public static TransactionPhase getTransactionalPhase(EnhancedAnnotatedMethod<?, ?> observer) { EnhancedAnnotatedParameter<?, ?> parameter = observer.getEnhancedParameters(Observes.class).iterator().next(); return parameter.getAnnotation(Observes.class).during(); }
java
public static TransactionPhase getTransactionalPhase(EnhancedAnnotatedMethod<?, ?> observer) { EnhancedAnnotatedParameter<?, ?> parameter = observer.getEnhancedParameters(Observes.class).iterator().next(); return parameter.getAnnotation(Observes.class).during(); }
[ "public", "static", "TransactionPhase", "getTransactionalPhase", "(", "EnhancedAnnotatedMethod", "<", "?", ",", "?", ">", "observer", ")", "{", "EnhancedAnnotatedParameter", "<", "?", ",", "?", ">", "parameter", "=", "observer", ".", "getEnhancedParameters", "(", ...
Tests an observer method to see if it is transactional. @param observer The observer method @return true if the observer method is annotated as transactional
[ "Tests", "an", "observer", "method", "to", "see", "if", "it", "is", "transactional", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/event/ObserverFactory.java#L59-L62
train
weld/core
environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java
WeldContainer.startInitialization
static WeldContainer startInitialization(String id, Deployment deployment, Bootstrap bootstrap) { if (SINGLETON.isSet(id)) { throw WeldSELogger.LOG.weldContainerAlreadyRunning(id); } WeldContainer weldContainer = new WeldContainer(id, deployment, bootstrap); SINGLETON.set(id, weldContainer); RUNNING_CONTAINER_IDS.add(id); return weldContainer; }
java
static WeldContainer startInitialization(String id, Deployment deployment, Bootstrap bootstrap) { if (SINGLETON.isSet(id)) { throw WeldSELogger.LOG.weldContainerAlreadyRunning(id); } WeldContainer weldContainer = new WeldContainer(id, deployment, bootstrap); SINGLETON.set(id, weldContainer); RUNNING_CONTAINER_IDS.add(id); return weldContainer; }
[ "static", "WeldContainer", "startInitialization", "(", "String", "id", ",", "Deployment", "deployment", ",", "Bootstrap", "bootstrap", ")", "{", "if", "(", "SINGLETON", ".", "isSet", "(", "id", ")", ")", "{", "throw", "WeldSELogger", ".", "LOG", ".", "weldCo...
Start the initialization. @param id @param manager @param bootstrap @return the initialized Weld container
[ "Start", "the", "initialization", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java#L161-L169
train
weld/core
environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java
WeldContainer.endInitialization
static void endInitialization(WeldContainer container, boolean isShutdownHookEnabled) { container.complete(); // If needed, register one shutdown hook for all containers if (shutdownHook == null && isShutdownHookEnabled) { synchronized (LOCK) { if (shutdownHook == null) { shutdownHook = new ShutdownHook(); SecurityActions.addShutdownHook(shutdownHook); } } } container.fireContainerInitializedEvent(); }
java
static void endInitialization(WeldContainer container, boolean isShutdownHookEnabled) { container.complete(); // If needed, register one shutdown hook for all containers if (shutdownHook == null && isShutdownHookEnabled) { synchronized (LOCK) { if (shutdownHook == null) { shutdownHook = new ShutdownHook(); SecurityActions.addShutdownHook(shutdownHook); } } } container.fireContainerInitializedEvent(); }
[ "static", "void", "endInitialization", "(", "WeldContainer", "container", ",", "boolean", "isShutdownHookEnabled", ")", "{", "container", ".", "complete", "(", ")", ";", "// If needed, register one shutdown hook for all containers", "if", "(", "shutdownHook", "==", "null"...
Finish the initialization. @param container @param isShutdownHookEnabled
[ "Finish", "the", "initialization", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java#L177-L189
train
weld/core
environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java
WeldContainer.shutdown
public synchronized void shutdown() { checkIsRunning(); try { beanManager().fireEvent(new ContainerBeforeShutdown(id), BeforeDestroyed.Literal.APPLICATION); } finally { discard(id); // Destroy all the dependent beans correctly creationalContext.release(); beanManager().fireEvent(new ContainerShutdown(id), Destroyed.Literal.APPLICATION); bootstrap.shutdown(); WeldSELogger.LOG.weldContainerShutdown(id); } }
java
public synchronized void shutdown() { checkIsRunning(); try { beanManager().fireEvent(new ContainerBeforeShutdown(id), BeforeDestroyed.Literal.APPLICATION); } finally { discard(id); // Destroy all the dependent beans correctly creationalContext.release(); beanManager().fireEvent(new ContainerShutdown(id), Destroyed.Literal.APPLICATION); bootstrap.shutdown(); WeldSELogger.LOG.weldContainerShutdown(id); } }
[ "public", "synchronized", "void", "shutdown", "(", ")", "{", "checkIsRunning", "(", ")", ";", "try", "{", "beanManager", "(", ")", ".", "fireEvent", "(", "new", "ContainerBeforeShutdown", "(", "id", ")", ",", "BeforeDestroyed", ".", "Literal", ".", "APPLICAT...
Shutdown the container. @see Weld#initialize()
[ "Shutdown", "the", "container", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldContainer.java#L294-L306
train
weld/core
impl/src/main/java/org/jboss/weld/annotated/enhanced/jlr/EnhancedAnnotatedTypeImpl.java
EnhancedAnnotatedTypeImpl.getEnhancedConstructors
@Override public Collection<EnhancedAnnotatedConstructor<T>> getEnhancedConstructors(Class<? extends Annotation> annotationType) { Set<EnhancedAnnotatedConstructor<T>> ret = new HashSet<EnhancedAnnotatedConstructor<T>>(); for (EnhancedAnnotatedConstructor<T> constructor : constructors) { if (constructor.isAnnotationPresent(annotationType)) { ret.add(constructor); } } return ret; }
java
@Override public Collection<EnhancedAnnotatedConstructor<T>> getEnhancedConstructors(Class<? extends Annotation> annotationType) { Set<EnhancedAnnotatedConstructor<T>> ret = new HashSet<EnhancedAnnotatedConstructor<T>>(); for (EnhancedAnnotatedConstructor<T> constructor : constructors) { if (constructor.isAnnotationPresent(annotationType)) { ret.add(constructor); } } return ret; }
[ "@", "Override", "public", "Collection", "<", "EnhancedAnnotatedConstructor", "<", "T", ">", ">", "getEnhancedConstructors", "(", "Class", "<", "?", "extends", "Annotation", ">", "annotationType", ")", "{", "Set", "<", "EnhancedAnnotatedConstructor", "<", "T", ">>...
Gets constructors with given annotation type @param annotationType The annotation type to match @return A set of abstracted constructors with given annotation type. If the constructors set is empty, initialize it first. Returns an empty set if there are no matches. @see org.jboss.weld.annotated.enhanced.EnhancedAnnotatedType#getEnhancedConstructors(Class)
[ "Gets", "constructors", "with", "given", "annotation", "type" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/annotated/enhanced/jlr/EnhancedAnnotatedTypeImpl.java#L504-L513
train
weld/core
impl/src/main/java/org/jboss/weld/contexts/AbstractBoundContext.java
AbstractBoundContext.setBeanStore
protected void setBeanStore(BoundBeanStore beanStore) { if (beanStore == null) { this.beanStore.remove(); } else { this.beanStore.set(beanStore); } }
java
protected void setBeanStore(BoundBeanStore beanStore) { if (beanStore == null) { this.beanStore.remove(); } else { this.beanStore.set(beanStore); } }
[ "protected", "void", "setBeanStore", "(", "BoundBeanStore", "beanStore", ")", "{", "if", "(", "beanStore", "==", "null", ")", "{", "this", ".", "beanStore", ".", "remove", "(", ")", ";", "}", "else", "{", "this", ".", "beanStore", ".", "set", "(", "bea...
Sets the bean store @param beanStore The bean store
[ "Sets", "the", "bean", "store" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/contexts/AbstractBoundContext.java#L59-L65
train
weld/core
environments/se/core/src/main/java/org/jboss/weld/environment/se/beans/ParametersFactory.java
ParametersFactory.setArgs
public void setArgs(String[] args) { if (args == null) { args = new String[]{}; } this.args = args; this.argsList = Collections.unmodifiableList(new ArrayList<String>(Arrays.asList(args))); }
java
public void setArgs(String[] args) { if (args == null) { args = new String[]{}; } this.args = args; this.argsList = Collections.unmodifiableList(new ArrayList<String>(Arrays.asList(args))); }
[ "public", "void", "setArgs", "(", "String", "[", "]", "args", ")", "{", "if", "(", "args", "==", "null", ")", "{", "args", "=", "new", "String", "[", "]", "{", "}", ";", "}", "this", ".", "args", "=", "args", ";", "this", ".", "argsList", "=", ...
StartMain passes in the command line args here. @param args The command line arguments. If null is given then an empty array will be used instead.
[ "StartMain", "passes", "in", "the", "command", "line", "args", "here", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/beans/ParametersFactory.java#L76-L82
train
weld/core
environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java
Weld.addPackages
public Weld addPackages(boolean scanRecursively, Class<?>... packageClasses) { for (Class<?> packageClass : packageClasses) { addPackage(scanRecursively, packageClass); } return this; }
java
public Weld addPackages(boolean scanRecursively, Class<?>... packageClasses) { for (Class<?> packageClass : packageClasses) { addPackage(scanRecursively, packageClass); } return this; }
[ "public", "Weld", "addPackages", "(", "boolean", "scanRecursively", ",", "Class", "<", "?", ">", "...", "packageClasses", ")", "{", "for", "(", "Class", "<", "?", ">", "packageClass", ":", "packageClasses", ")", "{", "addPackage", "(", "scanRecursively", ","...
Packages of the specified classes will be scanned and found classes will be added to the set of bean classes for the synthetic bean archive. @param scanRecursively @param packageClasses @return self
[ "Packages", "of", "the", "specified", "classes", "will", "be", "scanned", "and", "found", "classes", "will", "be", "added", "to", "the", "set", "of", "bean", "classes", "for", "the", "synthetic", "bean", "archive", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L368-L373
train
weld/core
environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java
Weld.addPackage
public Weld addPackage(boolean scanRecursively, Class<?> packageClass) { packages.add(new PackInfo(packageClass, scanRecursively)); return this; }
java
public Weld addPackage(boolean scanRecursively, Class<?> packageClass) { packages.add(new PackInfo(packageClass, scanRecursively)); return this; }
[ "public", "Weld", "addPackage", "(", "boolean", "scanRecursively", ",", "Class", "<", "?", ">", "packageClass", ")", "{", "packages", ".", "add", "(", "new", "PackInfo", "(", "packageClass", ",", "scanRecursively", ")", ")", ";", "return", "this", ";", "}"...
A package of the specified class will be scanned and found classes will be added to the set of bean classes for the synthetic bean archive. @param scanRecursively @param packageClass @return self
[ "A", "package", "of", "the", "specified", "class", "will", "be", "scanned", "and", "found", "classes", "will", "be", "added", "to", "the", "set", "of", "bean", "classes", "for", "the", "synthetic", "bean", "archive", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L402-L405
train
weld/core
environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java
Weld.extensions
public Weld extensions(Extension... extensions) { this.extensions.clear(); for (Extension extension : extensions) { addExtension(extension); } return this; }
java
public Weld extensions(Extension... extensions) { this.extensions.clear(); for (Extension extension : extensions) { addExtension(extension); } return this; }
[ "public", "Weld", "extensions", "(", "Extension", "...", "extensions", ")", "{", "this", ".", "extensions", ".", "clear", "(", ")", ";", "for", "(", "Extension", "extension", ":", "extensions", ")", "{", "addExtension", "(", "extension", ")", ";", "}", "...
Define the set of extensions. @param extensions @return self
[ "Define", "the", "set", "of", "extensions", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L413-L419
train
weld/core
environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java
Weld.addExtension
public Weld addExtension(Extension extension) { extensions.add(new MetadataImpl<Extension>(extension, SYNTHETIC_LOCATION_PREFIX + extension.getClass().getName())); return this; }
java
public Weld addExtension(Extension extension) { extensions.add(new MetadataImpl<Extension>(extension, SYNTHETIC_LOCATION_PREFIX + extension.getClass().getName())); return this; }
[ "public", "Weld", "addExtension", "(", "Extension", "extension", ")", "{", "extensions", ".", "add", "(", "new", "MetadataImpl", "<", "Extension", ">", "(", "extension", ",", "SYNTHETIC_LOCATION_PREFIX", "+", "extension", ".", "getClass", "(", ")", ".", "getNa...
Add an extension to the set of extensions. @param extension an extension
[ "Add", "an", "extension", "to", "the", "set", "of", "extensions", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L426-L429
train
weld/core
environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java
Weld.property
public Weld property(String key, Object value) { properties.put(key, value); return this; }
java
public Weld property(String key, Object value) { properties.put(key, value); return this; }
[ "public", "Weld", "property", "(", "String", "key", ",", "Object", "value", ")", "{", "properties", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Set the configuration property. @param key @param value @return self @see #ARCHIVE_ISOLATION_SYSTEM_PROPERTY @see #SHUTDOWN_HOOK_SYSTEM_PROPERTY @see #DEV_MODE_SYSTEM_PROPERTY @see ConfigurationKey
[ "Set", "the", "configuration", "property", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L626-L629
train
weld/core
environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java
Weld.addBeanDefiningAnnotations
public Weld addBeanDefiningAnnotations(Class<? extends Annotation>... annotations) { for (Class<? extends Annotation> annotation : annotations) { this.extendedBeanDefiningAnnotations.add(annotation); } return this; }
java
public Weld addBeanDefiningAnnotations(Class<? extends Annotation>... annotations) { for (Class<? extends Annotation> annotation : annotations) { this.extendedBeanDefiningAnnotations.add(annotation); } return this; }
[ "public", "Weld", "addBeanDefiningAnnotations", "(", "Class", "<", "?", "extends", "Annotation", ">", "...", "annotations", ")", "{", "for", "(", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ":", "annotations", ")", "{", "this", ".", "exten...
Registers annotations which will be considered as bean defining annotations. NOTE - If used along with {@code <trim/>} bean archives and/or with Weld configuration key {@code org.jboss.weld.bootstrap.vetoTypesWithoutBeanDefiningAnnotation}, these annotations will be ignored. @param annotations annotations which will be considered as Bean Defining Annotations. @return self
[ "Registers", "annotations", "which", "will", "be", "considered", "as", "bean", "defining", "annotations", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/environments/se/core/src/main/java/org/jboss/weld/environment/se/Weld.java#L902-L907
train
weld/core
impl/src/main/java/org/jboss/weld/annotated/AnnotatedTypeValidator.java
AnnotatedTypeValidator.checkSensibility
private static void checkSensibility(AnnotatedType<?> type) { // check if it has a constructor if (type.getConstructors().isEmpty() && !type.getJavaClass().isInterface()) { MetadataLogger.LOG.noConstructor(type); } Set<Class<?>> hierarchy = new HashSet<Class<?>>(); for (Class<?> clazz = type.getJavaClass(); clazz != null; clazz = clazz.getSuperclass()) { hierarchy.add(clazz); hierarchy.addAll(Reflections.getInterfaceClosure(clazz)); } checkMembersBelongToHierarchy(type.getConstructors(), hierarchy, type); checkMembersBelongToHierarchy(type.getMethods(), hierarchy, type); checkMembersBelongToHierarchy(type.getFields(), hierarchy, type); }
java
private static void checkSensibility(AnnotatedType<?> type) { // check if it has a constructor if (type.getConstructors().isEmpty() && !type.getJavaClass().isInterface()) { MetadataLogger.LOG.noConstructor(type); } Set<Class<?>> hierarchy = new HashSet<Class<?>>(); for (Class<?> clazz = type.getJavaClass(); clazz != null; clazz = clazz.getSuperclass()) { hierarchy.add(clazz); hierarchy.addAll(Reflections.getInterfaceClosure(clazz)); } checkMembersBelongToHierarchy(type.getConstructors(), hierarchy, type); checkMembersBelongToHierarchy(type.getMethods(), hierarchy, type); checkMembersBelongToHierarchy(type.getFields(), hierarchy, type); }
[ "private", "static", "void", "checkSensibility", "(", "AnnotatedType", "<", "?", ">", "type", ")", "{", "// check if it has a constructor", "if", "(", "type", ".", "getConstructors", "(", ")", ".", "isEmpty", "(", ")", "&&", "!", "type", ".", "getJavaClass", ...
Checks if the given AnnotatedType is sensible, otherwise provides warnings.
[ "Checks", "if", "the", "given", "AnnotatedType", "is", "sensible", "otherwise", "provides", "warnings", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/annotated/AnnotatedTypeValidator.java#L79-L93
train
weld/core
impl/src/main/java/org/jboss/weld/interceptor/proxy/AbstractInvocationContext.java
AbstractInvocationContext.isWideningPrimitive
private static boolean isWideningPrimitive(Class<?> argumentClass, Class<?> targetClass) { return WIDENING_TABLE.containsKey(argumentClass) && WIDENING_TABLE.get(argumentClass).contains(targetClass); }
java
private static boolean isWideningPrimitive(Class<?> argumentClass, Class<?> targetClass) { return WIDENING_TABLE.containsKey(argumentClass) && WIDENING_TABLE.get(argumentClass).contains(targetClass); }
[ "private", "static", "boolean", "isWideningPrimitive", "(", "Class", "<", "?", ">", "argumentClass", ",", "Class", "<", "?", ">", "targetClass", ")", "{", "return", "WIDENING_TABLE", ".", "containsKey", "(", "argumentClass", ")", "&&", "WIDENING_TABLE", ".", "...
Checks that the targetClass is widening the argument class @param argumentClass @param targetClass @return
[ "Checks", "that", "the", "targetClass", "is", "widening", "the", "argument", "class" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/interceptor/proxy/AbstractInvocationContext.java#L114-L116
train
weld/core
impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java
AnnotatedTypes.createTypeId
public static <X> String createTypeId(AnnotatedType<X> annotatedType) { String id = createTypeId(annotatedType.getJavaClass(), annotatedType.getAnnotations(), annotatedType.getMethods(), annotatedType.getFields(), annotatedType.getConstructors()); String hash = hash(id); MetadataLogger.LOG.tracef("Generated AnnotatedType id hash for %s: %s", id, hash); return hash; }
java
public static <X> String createTypeId(AnnotatedType<X> annotatedType) { String id = createTypeId(annotatedType.getJavaClass(), annotatedType.getAnnotations(), annotatedType.getMethods(), annotatedType.getFields(), annotatedType.getConstructors()); String hash = hash(id); MetadataLogger.LOG.tracef("Generated AnnotatedType id hash for %s: %s", id, hash); return hash; }
[ "public", "static", "<", "X", ">", "String", "createTypeId", "(", "AnnotatedType", "<", "X", ">", "annotatedType", ")", "{", "String", "id", "=", "createTypeId", "(", "annotatedType", ".", "getJavaClass", "(", ")", ",", "annotatedType", ".", "getAnnotations", ...
Generates a unique signature for an annotated type. Members without annotations are omitted to reduce the length of the signature @param <X> @param annotatedType @return hash of a signature for a concrete annotated type
[ "Generates", "a", "unique", "signature", "for", "an", "annotated", "type", ".", "Members", "without", "annotations", "are", "omitted", "to", "reduce", "the", "length", "of", "the", "signature" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java#L218-L223
train
weld/core
impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java
AnnotatedTypes.compareAnnotatedParameters
public static boolean compareAnnotatedParameters(AnnotatedParameter<?> p1, AnnotatedParameter<?> p2) { return compareAnnotatedCallable(p1.getDeclaringCallable(), p2.getDeclaringCallable()) && p1.getPosition() == p2.getPosition() && compareAnnotated(p1, p2); }
java
public static boolean compareAnnotatedParameters(AnnotatedParameter<?> p1, AnnotatedParameter<?> p2) { return compareAnnotatedCallable(p1.getDeclaringCallable(), p2.getDeclaringCallable()) && p1.getPosition() == p2.getPosition() && compareAnnotated(p1, p2); }
[ "public", "static", "boolean", "compareAnnotatedParameters", "(", "AnnotatedParameter", "<", "?", ">", "p1", ",", "AnnotatedParameter", "<", "?", ">", "p2", ")", "{", "return", "compareAnnotatedCallable", "(", "p1", ".", "getDeclaringCallable", "(", ")", ",", "p...
Compares two annotated parameters and returns true if they are equal
[ "Compares", "two", "annotated", "parameters", "and", "returns", "true", "if", "they", "are", "equal" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java#L450-L452
train
weld/core
impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java
AnnotatedTypes.compareAnnotatedTypes
public static boolean compareAnnotatedTypes(AnnotatedType<?> t1, AnnotatedType<?> t2) { if (!t1.getJavaClass().equals(t2.getJavaClass())) { return false; } if (!compareAnnotated(t1, t2)) { return false; } if (t1.getFields().size() != t2.getFields().size()) { return false; } Map<Field, AnnotatedField<?>> fields = new HashMap<Field, AnnotatedField<?>>(); for (AnnotatedField<?> f : t2.getFields()) { fields.put(f.getJavaMember(), f); } for (AnnotatedField<?> f : t1.getFields()) { if (fields.containsKey(f.getJavaMember())) { if (!compareAnnotatedField(f, fields.get(f.getJavaMember()))) { return false; } } else { return false; } } if (t1.getMethods().size() != t2.getMethods().size()) { return false; } Map<Method, AnnotatedMethod<?>> methods = new HashMap<Method, AnnotatedMethod<?>>(); for (AnnotatedMethod<?> f : t2.getMethods()) { methods.put(f.getJavaMember(), f); } for (AnnotatedMethod<?> f : t1.getMethods()) { if (methods.containsKey(f.getJavaMember())) { if (!compareAnnotatedCallable(f, methods.get(f.getJavaMember()))) { return false; } } else { return false; } } if (t1.getConstructors().size() != t2.getConstructors().size()) { return false; } Map<Constructor<?>, AnnotatedConstructor<?>> constructors = new HashMap<Constructor<?>, AnnotatedConstructor<?>>(); for (AnnotatedConstructor<?> f : t2.getConstructors()) { constructors.put(f.getJavaMember(), f); } for (AnnotatedConstructor<?> f : t1.getConstructors()) { if (constructors.containsKey(f.getJavaMember())) { if (!compareAnnotatedCallable(f, constructors.get(f.getJavaMember()))) { return false; } } else { return false; } } return true; }
java
public static boolean compareAnnotatedTypes(AnnotatedType<?> t1, AnnotatedType<?> t2) { if (!t1.getJavaClass().equals(t2.getJavaClass())) { return false; } if (!compareAnnotated(t1, t2)) { return false; } if (t1.getFields().size() != t2.getFields().size()) { return false; } Map<Field, AnnotatedField<?>> fields = new HashMap<Field, AnnotatedField<?>>(); for (AnnotatedField<?> f : t2.getFields()) { fields.put(f.getJavaMember(), f); } for (AnnotatedField<?> f : t1.getFields()) { if (fields.containsKey(f.getJavaMember())) { if (!compareAnnotatedField(f, fields.get(f.getJavaMember()))) { return false; } } else { return false; } } if (t1.getMethods().size() != t2.getMethods().size()) { return false; } Map<Method, AnnotatedMethod<?>> methods = new HashMap<Method, AnnotatedMethod<?>>(); for (AnnotatedMethod<?> f : t2.getMethods()) { methods.put(f.getJavaMember(), f); } for (AnnotatedMethod<?> f : t1.getMethods()) { if (methods.containsKey(f.getJavaMember())) { if (!compareAnnotatedCallable(f, methods.get(f.getJavaMember()))) { return false; } } else { return false; } } if (t1.getConstructors().size() != t2.getConstructors().size()) { return false; } Map<Constructor<?>, AnnotatedConstructor<?>> constructors = new HashMap<Constructor<?>, AnnotatedConstructor<?>>(); for (AnnotatedConstructor<?> f : t2.getConstructors()) { constructors.put(f.getJavaMember(), f); } for (AnnotatedConstructor<?> f : t1.getConstructors()) { if (constructors.containsKey(f.getJavaMember())) { if (!compareAnnotatedCallable(f, constructors.get(f.getJavaMember()))) { return false; } } else { return false; } } return true; }
[ "public", "static", "boolean", "compareAnnotatedTypes", "(", "AnnotatedType", "<", "?", ">", "t1", ",", "AnnotatedType", "<", "?", ">", "t2", ")", "{", "if", "(", "!", "t1", ".", "getJavaClass", "(", ")", ".", "equals", "(", "t2", ".", "getJavaClass", ...
Compares two annotated types and returns true if they are the same
[ "Compares", "two", "annotated", "types", "and", "returns", "true", "if", "they", "are", "the", "same" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java#L474-L533
train
weld/core
impl/src/main/java/org/jboss/weld/util/Beans.java
Beans.isPassivatingScope
public static boolean isPassivatingScope(Bean<?> bean, BeanManagerImpl manager) { if (bean == null) { return false; } else { return manager.getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isPassivating(); } }
java
public static boolean isPassivatingScope(Bean<?> bean, BeanManagerImpl manager) { if (bean == null) { return false; } else { return manager.getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScope()).isPassivating(); } }
[ "public", "static", "boolean", "isPassivatingScope", "(", "Bean", "<", "?", ">", "bean", ",", "BeanManagerImpl", "manager", ")", "{", "if", "(", "bean", "==", "null", ")", "{", "return", "false", ";", "}", "else", "{", "return", "manager", ".", "getServi...
Indicates if a bean's scope type is passivating @param bean The bean to inspect @return True if the scope is passivating, false otherwise
[ "Indicates", "if", "a", "bean", "s", "scope", "type", "is", "passivating" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L115-L121
train
weld/core
impl/src/main/java/org/jboss/weld/util/Beans.java
Beans.isBeanProxyable
public static boolean isBeanProxyable(Bean<?> bean, BeanManagerImpl manager) { if (bean instanceof RIBean<?>) { return ((RIBean<?>) bean).isProxyable(); } else { return Proxies.isTypesProxyable(bean.getTypes(), manager.getServices()); } }
java
public static boolean isBeanProxyable(Bean<?> bean, BeanManagerImpl manager) { if (bean instanceof RIBean<?>) { return ((RIBean<?>) bean).isProxyable(); } else { return Proxies.isTypesProxyable(bean.getTypes(), manager.getServices()); } }
[ "public", "static", "boolean", "isBeanProxyable", "(", "Bean", "<", "?", ">", "bean", ",", "BeanManagerImpl", "manager", ")", "{", "if", "(", "bean", "instanceof", "RIBean", "<", "?", ">", ")", "{", "return", "(", "(", "RIBean", "<", "?", ">", ")", "...
Indicates if a bean is proxyable @param bean The bean to test @return True if proxyable, false otherwise
[ "Indicates", "if", "a", "bean", "is", "proxyable" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L156-L162
train
weld/core
impl/src/main/java/org/jboss/weld/util/Beans.java
Beans.containsAllQualifiers
public static boolean containsAllQualifiers(Set<QualifierInstance> requiredQualifiers, Set<QualifierInstance> qualifiers) { return qualifiers.containsAll(requiredQualifiers); }
java
public static boolean containsAllQualifiers(Set<QualifierInstance> requiredQualifiers, Set<QualifierInstance> qualifiers) { return qualifiers.containsAll(requiredQualifiers); }
[ "public", "static", "boolean", "containsAllQualifiers", "(", "Set", "<", "QualifierInstance", ">", "requiredQualifiers", ",", "Set", "<", "QualifierInstance", ">", "qualifiers", ")", "{", "return", "qualifiers", ".", "containsAll", "(", "requiredQualifiers", ")", ";...
Checks that all the qualifiers in the set requiredQualifiers are in the set of qualifiers. Qualifier equality rules for annotation members are followed. @param requiredQualifiers The required qualifiers @param qualifiers The set of qualifiers to check @return True if all matches, false otherwise
[ "Checks", "that", "all", "the", "qualifiers", "in", "the", "set", "requiredQualifiers", "are", "in", "the", "set", "of", "qualifiers", ".", "Qualifier", "equality", "rules", "for", "annotation", "members", "are", "followed", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L194-L196
train
weld/core
impl/src/main/java/org/jboss/weld/util/Beans.java
Beans.removeDisabledBeans
public static <T extends Bean<?>> Set<T> removeDisabledBeans(Set<T> beans, final BeanManagerImpl beanManager) { if (beans.isEmpty()) { return beans; } else { for (Iterator<T> iterator = beans.iterator(); iterator.hasNext();) { if (!isBeanEnabled(iterator.next(), beanManager.getEnabled())) { iterator.remove(); } } return beans; } }
java
public static <T extends Bean<?>> Set<T> removeDisabledBeans(Set<T> beans, final BeanManagerImpl beanManager) { if (beans.isEmpty()) { return beans; } else { for (Iterator<T> iterator = beans.iterator(); iterator.hasNext();) { if (!isBeanEnabled(iterator.next(), beanManager.getEnabled())) { iterator.remove(); } } return beans; } }
[ "public", "static", "<", "T", "extends", "Bean", "<", "?", ">", ">", "Set", "<", "T", ">", "removeDisabledBeans", "(", "Set", "<", "T", ">", "beans", ",", "final", "BeanManagerImpl", "beanManager", ")", "{", "if", "(", "beans", ".", "isEmpty", "(", "...
Retains only beans which are enabled. @param beans The mutable set of beans to filter @param beanManager The bean manager @return a mutable set of enabled beans
[ "Retains", "only", "beans", "which", "are", "enabled", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L211-L222
train
weld/core
impl/src/main/java/org/jboss/weld/util/Beans.java
Beans.isAlternative
public static boolean isAlternative(EnhancedAnnotated<?, ?> annotated, MergedStereotypes<?, ?> mergedStereotypes) { return annotated.isAnnotationPresent(Alternative.class) || mergedStereotypes.isAlternative(); }
java
public static boolean isAlternative(EnhancedAnnotated<?, ?> annotated, MergedStereotypes<?, ?> mergedStereotypes) { return annotated.isAnnotationPresent(Alternative.class) || mergedStereotypes.isAlternative(); }
[ "public", "static", "boolean", "isAlternative", "(", "EnhancedAnnotated", "<", "?", ",", "?", ">", "annotated", ",", "MergedStereotypes", "<", "?", ",", "?", ">", "mergedStereotypes", ")", "{", "return", "annotated", ".", "isAnnotationPresent", "(", "Alternative...
Is alternative. @param annotated the annotated @param mergedStereotypes merged stereotypes @return true if alternative, false otherwise
[ "Is", "alternative", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L255-L257
train
weld/core
impl/src/main/java/org/jboss/weld/util/Beans.java
Beans.injectEEFields
public static <T> void injectEEFields(Iterable<Set<ResourceInjection<?>>> resourceInjectionsHierarchy, T beanInstance, CreationalContext<T> ctx) { for (Set<ResourceInjection<?>> resourceInjections : resourceInjectionsHierarchy) { for (ResourceInjection<?> resourceInjection : resourceInjections) { resourceInjection.injectResourceReference(beanInstance, ctx); } } }
java
public static <T> void injectEEFields(Iterable<Set<ResourceInjection<?>>> resourceInjectionsHierarchy, T beanInstance, CreationalContext<T> ctx) { for (Set<ResourceInjection<?>> resourceInjections : resourceInjectionsHierarchy) { for (ResourceInjection<?> resourceInjection : resourceInjections) { resourceInjection.injectResourceReference(beanInstance, ctx); } } }
[ "public", "static", "<", "T", ">", "void", "injectEEFields", "(", "Iterable", "<", "Set", "<", "ResourceInjection", "<", "?", ">", ">", ">", "resourceInjectionsHierarchy", ",", "T", "beanInstance", ",", "CreationalContext", "<", "T", ">", "ctx", ")", "{", ...
Injects EJBs and other EE resources. @param resourceInjectionsHierarchy @param beanInstance @param ctx
[ "Injects", "EJBs", "and", "other", "EE", "resources", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L305-L312
train
weld/core
impl/src/main/java/org/jboss/weld/util/Beans.java
Beans.getDeclaredBeanType
public static Type getDeclaredBeanType(Class<?> clazz) { Type[] actualTypeArguments = Reflections.getActualTypeArguments(clazz); if (actualTypeArguments.length == 1) { return actualTypeArguments[0]; } else { return null; } }
java
public static Type getDeclaredBeanType(Class<?> clazz) { Type[] actualTypeArguments = Reflections.getActualTypeArguments(clazz); if (actualTypeArguments.length == 1) { return actualTypeArguments[0]; } else { return null; } }
[ "public", "static", "Type", "getDeclaredBeanType", "(", "Class", "<", "?", ">", "clazz", ")", "{", "Type", "[", "]", "actualTypeArguments", "=", "Reflections", ".", "getActualTypeArguments", "(", "clazz", ")", ";", "if", "(", "actualTypeArguments", ".", "lengt...
Gets the declared bean type @return The bean type
[ "Gets", "the", "declared", "bean", "type" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L319-L326
train
weld/core
impl/src/main/java/org/jboss/weld/util/Beans.java
Beans.injectBoundFields
public static <T> void injectBoundFields(T instance, CreationalContext<T> creationalContext, BeanManagerImpl manager, Iterable<? extends FieldInjectionPoint<?, ?>> injectableFields) { for (FieldInjectionPoint<?, ?> injectableField : injectableFields) { injectableField.inject(instance, manager, creationalContext); } }
java
public static <T> void injectBoundFields(T instance, CreationalContext<T> creationalContext, BeanManagerImpl manager, Iterable<? extends FieldInjectionPoint<?, ?>> injectableFields) { for (FieldInjectionPoint<?, ?> injectableField : injectableFields) { injectableField.inject(instance, manager, creationalContext); } }
[ "public", "static", "<", "T", ">", "void", "injectBoundFields", "(", "T", "instance", ",", "CreationalContext", "<", "T", ">", "creationalContext", ",", "BeanManagerImpl", "manager", ",", "Iterable", "<", "?", "extends", "FieldInjectionPoint", "<", "?", ",", "...
Injects bound fields @param instance The instance to inject into
[ "Injects", "bound", "fields" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L333-L338
train
weld/core
impl/src/main/java/org/jboss/weld/util/Beans.java
Beans.callInitializers
public static <T> void callInitializers(T instance, CreationalContext<T> creationalContext, BeanManagerImpl manager, Iterable<? extends MethodInjectionPoint<?, ?>> initializerMethods) { for (MethodInjectionPoint<?, ?> initializer : initializerMethods) { initializer.invoke(instance, null, manager, creationalContext, CreationException.class); } }
java
public static <T> void callInitializers(T instance, CreationalContext<T> creationalContext, BeanManagerImpl manager, Iterable<? extends MethodInjectionPoint<?, ?>> initializerMethods) { for (MethodInjectionPoint<?, ?> initializer : initializerMethods) { initializer.invoke(instance, null, manager, creationalContext, CreationException.class); } }
[ "public", "static", "<", "T", ">", "void", "callInitializers", "(", "T", "instance", ",", "CreationalContext", "<", "T", ">", "creationalContext", ",", "BeanManagerImpl", "manager", ",", "Iterable", "<", "?", "extends", "MethodInjectionPoint", "<", "?", ",", "...
Calls all initializers of the bean @param instance The bean instance
[ "Calls", "all", "initializers", "of", "the", "bean" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L357-L362
train
weld/core
impl/src/main/java/org/jboss/weld/util/Beans.java
Beans.isTypeManagedBeanOrDecoratorOrInterceptor
public static boolean isTypeManagedBeanOrDecoratorOrInterceptor(AnnotatedType<?> annotatedType) { Class<?> javaClass = annotatedType.getJavaClass(); return !javaClass.isEnum() && !Extension.class.isAssignableFrom(javaClass) && Reflections.isTopLevelOrStaticNestedClass(javaClass) && !Reflections.isParameterizedTypeWithWildcard(javaClass) && hasSimpleCdiConstructor(annotatedType); }
java
public static boolean isTypeManagedBeanOrDecoratorOrInterceptor(AnnotatedType<?> annotatedType) { Class<?> javaClass = annotatedType.getJavaClass(); return !javaClass.isEnum() && !Extension.class.isAssignableFrom(javaClass) && Reflections.isTopLevelOrStaticNestedClass(javaClass) && !Reflections.isParameterizedTypeWithWildcard(javaClass) && hasSimpleCdiConstructor(annotatedType); }
[ "public", "static", "boolean", "isTypeManagedBeanOrDecoratorOrInterceptor", "(", "AnnotatedType", "<", "?", ">", "annotatedType", ")", "{", "Class", "<", "?", ">", "javaClass", "=", "annotatedType", ".", "getJavaClass", "(", ")", ";", "return", "!", "javaClass", ...
Indicates if the type is a simple Web Bean @param clazz The type to inspect @return True if simple Web Bean, false otherwise
[ "Indicates", "if", "the", "type", "is", "a", "simple", "Web", "Bean" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Beans.java#L445-L450
train
weld/core
modules/ejb/src/main/java/org/jboss/weld/module/ejb/NewSessionBean.java
NewSessionBean.of
public static <T> NewSessionBean<T> of(BeanAttributes<T> attributes, InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl beanManager) { EnhancedAnnotatedType<T> type = beanManager.getServices().get(ClassTransformer.class).getEnhancedAnnotatedType(ejbDescriptor.getBeanClass(), beanManager.getId()); return new NewSessionBean<T>(attributes, type, ejbDescriptor, new StringBeanIdentifier(SessionBeans.createIdentifierForNew(ejbDescriptor)), beanManager); }
java
public static <T> NewSessionBean<T> of(BeanAttributes<T> attributes, InternalEjbDescriptor<T> ejbDescriptor, BeanManagerImpl beanManager) { EnhancedAnnotatedType<T> type = beanManager.getServices().get(ClassTransformer.class).getEnhancedAnnotatedType(ejbDescriptor.getBeanClass(), beanManager.getId()); return new NewSessionBean<T>(attributes, type, ejbDescriptor, new StringBeanIdentifier(SessionBeans.createIdentifierForNew(ejbDescriptor)), beanManager); }
[ "public", "static", "<", "T", ">", "NewSessionBean", "<", "T", ">", "of", "(", "BeanAttributes", "<", "T", ">", "attributes", ",", "InternalEjbDescriptor", "<", "T", ">", "ejbDescriptor", ",", "BeanManagerImpl", "beanManager", ")", "{", "EnhancedAnnotatedType", ...
Creates an instance of a NewEnterpriseBean from an annotated class @param clazz The annotated class @param beanManager The Bean manager @return a new NewEnterpriseBean instance
[ "Creates", "an", "instance", "of", "a", "NewEnterpriseBean", "from", "an", "annotated", "class" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/ejb/src/main/java/org/jboss/weld/module/ejb/NewSessionBean.java#L42-L45
train
weld/core
impl/src/main/java/org/jboss/weld/bean/ProducerField.java
ProducerField.of
public static <X, T> ProducerField<X, T> of(BeanAttributes<T> attributes, EnhancedAnnotatedField<T, ? super X> field, AbstractClassBean<X> declaringBean, DisposalMethod<X, ?> disposalMethod, BeanManagerImpl beanManager, ServiceRegistry services) { return new ProducerField<X, T>(attributes, field, declaringBean, disposalMethod, beanManager, services); }
java
public static <X, T> ProducerField<X, T> of(BeanAttributes<T> attributes, EnhancedAnnotatedField<T, ? super X> field, AbstractClassBean<X> declaringBean, DisposalMethod<X, ?> disposalMethod, BeanManagerImpl beanManager, ServiceRegistry services) { return new ProducerField<X, T>(attributes, field, declaringBean, disposalMethod, beanManager, services); }
[ "public", "static", "<", "X", ",", "T", ">", "ProducerField", "<", "X", ",", "T", ">", "of", "(", "BeanAttributes", "<", "T", ">", "attributes", ",", "EnhancedAnnotatedField", "<", "T", ",", "?", "super", "X", ">", "field", ",", "AbstractClassBean", "<...
Creates a producer field @param field The underlying method abstraction @param declaringBean The declaring bean abstraction @param beanManager the current manager @return A producer field
[ "Creates", "a", "producer", "field" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/ProducerField.java#L55-L57
train
weld/core
impl/src/main/java/org/jboss/weld/util/Permissions.java
Permissions.hasPermission
public static boolean hasPermission(Permission permission) { SecurityManager security = System.getSecurityManager(); if (security != null) { try { security.checkPermission(permission); } catch (java.security.AccessControlException e) { return false; } } return true; }
java
public static boolean hasPermission(Permission permission) { SecurityManager security = System.getSecurityManager(); if (security != null) { try { security.checkPermission(permission); } catch (java.security.AccessControlException e) { return false; } } return true; }
[ "public", "static", "boolean", "hasPermission", "(", "Permission", "permission", ")", "{", "SecurityManager", "security", "=", "System", ".", "getSecurityManager", "(", ")", ";", "if", "(", "security", "!=", "null", ")", "{", "try", "{", "security", ".", "ch...
Determines whether the specified permission is permitted. @param permission @return <tt>false<tt> if the specified permission is not permitted, based on the current security policy; <tt>true<tt> otherwise
[ "Determines", "whether", "the", "specified", "permission", "is", "permitted", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Permissions.java#L39-L49
train
weld/core
impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
ManagedBean.of
public static <T> ManagedBean<T> of(BeanAttributes<T> attributes, EnhancedAnnotatedType<T> clazz, BeanManagerImpl beanManager) { return new ManagedBean<T>(attributes, clazz, createId(attributes, clazz), beanManager); }
java
public static <T> ManagedBean<T> of(BeanAttributes<T> attributes, EnhancedAnnotatedType<T> clazz, BeanManagerImpl beanManager) { return new ManagedBean<T>(attributes, clazz, createId(attributes, clazz), beanManager); }
[ "public", "static", "<", "T", ">", "ManagedBean", "<", "T", ">", "of", "(", "BeanAttributes", "<", "T", ">", "attributes", ",", "EnhancedAnnotatedType", "<", "T", ">", "clazz", ",", "BeanManagerImpl", "beanManager", ")", "{", "return", "new", "ManagedBean", ...
Creates a simple, annotation defined Web Bean @param <T> The type @param clazz The class @param beanManager the current manager @return A Web Bean
[ "Creates", "a", "simple", "annotation", "defined", "Web", "Bean" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java#L79-L81
train
weld/core
impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
ManagedBean.destroy
@Override public void destroy(T instance, CreationalContext<T> creationalContext) { super.destroy(instance, creationalContext); try { getProducer().preDestroy(instance); // WELD-1010 hack? if (creationalContext instanceof CreationalContextImpl) { ((CreationalContextImpl<T>) creationalContext).release(this, instance); } else { creationalContext.release(); } } catch (Exception e) { BeanLogger.LOG.errorDestroying(instance, this); BeanLogger.LOG.catchingDebug(e); } }
java
@Override public void destroy(T instance, CreationalContext<T> creationalContext) { super.destroy(instance, creationalContext); try { getProducer().preDestroy(instance); // WELD-1010 hack? if (creationalContext instanceof CreationalContextImpl) { ((CreationalContextImpl<T>) creationalContext).release(this, instance); } else { creationalContext.release(); } } catch (Exception e) { BeanLogger.LOG.errorDestroying(instance, this); BeanLogger.LOG.catchingDebug(e); } }
[ "@", "Override", "public", "void", "destroy", "(", "T", "instance", ",", "CreationalContext", "<", "T", ">", "creationalContext", ")", "{", "super", ".", "destroy", "(", "instance", ",", "creationalContext", ")", ";", "try", "{", "getProducer", "(", ")", "...
Destroys an instance of the bean @param instance The instance
[ "Destroys", "an", "instance", "of", "the", "bean" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java#L188-L203
train
weld/core
impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
ManagedBean.checkType
@Override protected void checkType() { if (!isDependent() && getEnhancedAnnotated().isParameterizedType()) { throw BeanLogger.LOG.managedBeanWithParameterizedBeanClassMustBeDependent(type); } boolean passivating = beanManager.isPassivatingScope(getScope()); if (passivating && !isPassivationCapableBean()) { if (!getEnhancedAnnotated().isSerializable()) { throw BeanLogger.LOG.passivatingBeanNeedsSerializableImpl(this); } else if (hasDecorators() && !allDecoratorsArePassivationCapable()) { throw BeanLogger.LOG.passivatingBeanHasNonPassivationCapableDecorator(this, getFirstNonPassivationCapableDecorator()); } else if (hasInterceptors() && !allInterceptorsArePassivationCapable()) { throw BeanLogger.LOG.passivatingBeanHasNonPassivationCapableInterceptor(this, getFirstNonPassivationCapableInterceptor()); } } }
java
@Override protected void checkType() { if (!isDependent() && getEnhancedAnnotated().isParameterizedType()) { throw BeanLogger.LOG.managedBeanWithParameterizedBeanClassMustBeDependent(type); } boolean passivating = beanManager.isPassivatingScope(getScope()); if (passivating && !isPassivationCapableBean()) { if (!getEnhancedAnnotated().isSerializable()) { throw BeanLogger.LOG.passivatingBeanNeedsSerializableImpl(this); } else if (hasDecorators() && !allDecoratorsArePassivationCapable()) { throw BeanLogger.LOG.passivatingBeanHasNonPassivationCapableDecorator(this, getFirstNonPassivationCapableDecorator()); } else if (hasInterceptors() && !allInterceptorsArePassivationCapable()) { throw BeanLogger.LOG.passivatingBeanHasNonPassivationCapableInterceptor(this, getFirstNonPassivationCapableInterceptor()); } } }
[ "@", "Override", "protected", "void", "checkType", "(", ")", "{", "if", "(", "!", "isDependent", "(", ")", "&&", "getEnhancedAnnotated", "(", ")", ".", "isParameterizedType", "(", ")", ")", "{", "throw", "BeanLogger", ".", "LOG", ".", "managedBeanWithParamet...
Validates the type
[ "Validates", "the", "type" ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java#L208-L223
train
weld/core
impl/src/main/java/org/jboss/weld/util/collections/ImmutableSet.java
ImmutableSet.of
@SafeVarargs public static <T> Set<T> of(T... elements) { Preconditions.checkNotNull(elements); return ImmutableSet.<T> builder().addAll(elements).build(); }
java
@SafeVarargs public static <T> Set<T> of(T... elements) { Preconditions.checkNotNull(elements); return ImmutableSet.<T> builder().addAll(elements).build(); }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "Set", "<", "T", ">", "of", "(", "T", "...", "elements", ")", "{", "Preconditions", ".", "checkNotNull", "(", "elements", ")", ";", "return", "ImmutableSet", ".", "<", "T", ">", "builder", "(", "...
Creates a new immutable set that consists of given elements. @param elements the given elements @return a new immutable set that consists of given elements
[ "Creates", "a", "new", "immutable", "set", "that", "consists", "of", "given", "elements", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/collections/ImmutableSet.java#L81-L85
train
weld/core
impl/src/main/java/org/jboss/weld/bean/proxy/util/SerializableClientProxy.java
SerializableClientProxy.readResolve
Object readResolve() throws ObjectStreamException { Bean<?> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<Object>, Object>getContextual(beanId); if (bean == null) { throw BeanLogger.LOG.proxyDeserializationFailure(beanId); } return Container.instance(contextId).deploymentManager().getClientProxyProvider().getClientProxy(bean); }
java
Object readResolve() throws ObjectStreamException { Bean<?> bean = Container.instance(contextId).services().get(ContextualStore.class).<Bean<Object>, Object>getContextual(beanId); if (bean == null) { throw BeanLogger.LOG.proxyDeserializationFailure(beanId); } return Container.instance(contextId).deploymentManager().getClientProxyProvider().getClientProxy(bean); }
[ "Object", "readResolve", "(", ")", "throws", "ObjectStreamException", "{", "Bean", "<", "?", ">", "bean", "=", "Container", ".", "instance", "(", "contextId", ")", ".", "services", "(", ")", ".", "get", "(", "ContextualStore", ".", "class", ")", ".", "<"...
Always returns the original proxy object that was serialized. @return the proxy object @throws java.io.ObjectStreamException
[ "Always", "returns", "the", "original", "proxy", "object", "that", "was", "serialized", "." ]
567a2eaf95b168597d23a56be89bf05a7834b2aa
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bean/proxy/util/SerializableClientProxy.java#L57-L63
train
GoogleCloudPlatform/appengine-gcs-client
java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/AppIdentityOAuthURLFetchService.java
AppIdentityOAuthURLFetchService.getToken
@Override protected String getToken() { GetAccessTokenResult token = accessToken.get(); if (token == null || isExpired(token) || (isAboutToExpire(token) && refreshInProgress.compareAndSet(false, true))) { lock.lock(); try { token = accessToken.get(); if (token == null || isAboutToExpire(token)) { token = accessTokenProvider.getNewAccessToken(oauthScopes); accessToken.set(token); cacheExpirationHeadroom.set(getNextCacheExpirationHeadroom()); } } finally { refreshInProgress.set(false); lock.unlock(); } } return token.getAccessToken(); }
java
@Override protected String getToken() { GetAccessTokenResult token = accessToken.get(); if (token == null || isExpired(token) || (isAboutToExpire(token) && refreshInProgress.compareAndSet(false, true))) { lock.lock(); try { token = accessToken.get(); if (token == null || isAboutToExpire(token)) { token = accessTokenProvider.getNewAccessToken(oauthScopes); accessToken.set(token); cacheExpirationHeadroom.set(getNextCacheExpirationHeadroom()); } } finally { refreshInProgress.set(false); lock.unlock(); } } return token.getAccessToken(); }
[ "@", "Override", "protected", "String", "getToken", "(", ")", "{", "GetAccessTokenResult", "token", "=", "accessToken", ".", "get", "(", ")", ";", "if", "(", "token", "==", "null", "||", "isExpired", "(", "token", ")", "||", "(", "isAboutToExpire", "(", ...
Attempts to return the token from cache. If this is not possible because it is expired or was never assigned, a new token is requested and parallel requests will block on retrieving a new token. As such no guarantee of maximum latency is provided. To avoid blocking the token is refreshed before it's expiration, while parallel requests continue to use the old token.
[ "Attempts", "to", "return", "the", "token", "from", "cache", ".", "If", "this", "is", "not", "possible", "because", "it", "is", "expired", "or", "was", "never", "assigned", "a", "new", "token", "is", "requested", "and", "parallel", "requests", "will", "blo...
d11078331ecd915d753c886e96a80133599f3f98
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/AppIdentityOAuthURLFetchService.java#L76-L95
train
GoogleCloudPlatform/appengine-gcs-client
java/src/main/java/com/google/appengine/tools/cloudstorage/GcsOutputChannelImpl.java
GcsOutputChannelImpl.waitForOutstandingRequest
private void waitForOutstandingRequest() throws IOException { if (outstandingRequest == null) { return; } try { RetryHelper.runWithRetries(new Callable<Void>() { @Override public Void call() throws IOException, InterruptedException { if (RetryHelper.getContext().getAttemptNumber() > 1) { outstandingRequest.retry(); } token = outstandingRequest.waitForNextToken(); outstandingRequest = null; return null; } }, retryParams, GcsServiceImpl.exceptionHandler); } catch (RetryInterruptedException ex) { token = null; throw new ClosedByInterruptException(); } catch (NonRetriableException e) { Throwables.propagateIfInstanceOf(e.getCause(), IOException.class); throw e; } }
java
private void waitForOutstandingRequest() throws IOException { if (outstandingRequest == null) { return; } try { RetryHelper.runWithRetries(new Callable<Void>() { @Override public Void call() throws IOException, InterruptedException { if (RetryHelper.getContext().getAttemptNumber() > 1) { outstandingRequest.retry(); } token = outstandingRequest.waitForNextToken(); outstandingRequest = null; return null; } }, retryParams, GcsServiceImpl.exceptionHandler); } catch (RetryInterruptedException ex) { token = null; throw new ClosedByInterruptException(); } catch (NonRetriableException e) { Throwables.propagateIfInstanceOf(e.getCause(), IOException.class); throw e; } }
[ "private", "void", "waitForOutstandingRequest", "(", ")", "throws", "IOException", "{", "if", "(", "outstandingRequest", "==", "null", ")", "{", "return", ";", "}", "try", "{", "RetryHelper", ".", "runWithRetries", "(", "new", "Callable", "<", "Void", ">", "...
Waits for the current outstanding request retrying it with exponential backoff if it fails. @throws ClosedByInterruptException if request was interrupted @throws IOException In the event of FileNotFoundException, MalformedURLException @throws RetriesExhaustedException if exceeding the number of retries
[ "Waits", "for", "the", "current", "outstanding", "request", "retrying", "it", "with", "exponential", "backoff", "if", "it", "fails", "." ]
d11078331ecd915d753c886e96a80133599f3f98
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/GcsOutputChannelImpl.java#L224-L247
train
GoogleCloudPlatform/appengine-gcs-client
java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/URLFetchUtils.java
URLFetchUtils.parseDate
static Date parseDate(String dateString) { try { return DATE_FORMAT.parseDateTime(dateString).toDate(); } catch (IllegalArgumentException e) { return null; } }
java
static Date parseDate(String dateString) { try { return DATE_FORMAT.parseDateTime(dateString).toDate(); } catch (IllegalArgumentException e) { return null; } }
[ "static", "Date", "parseDate", "(", "String", "dateString", ")", "{", "try", "{", "return", "DATE_FORMAT", ".", "parseDateTime", "(", "dateString", ")", ".", "toDate", "(", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "return", "...
Parses the date or returns null if it fails to do so.
[ "Parses", "the", "date", "or", "returns", "null", "if", "it", "fails", "to", "do", "so", "." ]
d11078331ecd915d753c886e96a80133599f3f98
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/URLFetchUtils.java#L121-L127
train
GoogleCloudPlatform/appengine-gcs-client
java/src/main/java/com/google/appengine/tools/cloudstorage/dev/LocalRawGcsService.java
LocalRawGcsService.continueObjectCreationAsync
@Override public Future<RawGcsCreationToken> continueObjectCreationAsync(final RawGcsCreationToken token, final ByteBuffer chunk, long timeoutMillis) { try { ensureInitialized(); } catch (IOException e) { throw new RuntimeException(e); } final Environment environment = ApiProxy.getCurrentEnvironment(); return writePool.schedule(new Callable<RawGcsCreationToken>() { @Override public RawGcsCreationToken call() throws Exception { ApiProxy.setEnvironmentForCurrentThread(environment); return append(token, chunk); } }, 50, TimeUnit.MILLISECONDS); }
java
@Override public Future<RawGcsCreationToken> continueObjectCreationAsync(final RawGcsCreationToken token, final ByteBuffer chunk, long timeoutMillis) { try { ensureInitialized(); } catch (IOException e) { throw new RuntimeException(e); } final Environment environment = ApiProxy.getCurrentEnvironment(); return writePool.schedule(new Callable<RawGcsCreationToken>() { @Override public RawGcsCreationToken call() throws Exception { ApiProxy.setEnvironmentForCurrentThread(environment); return append(token, chunk); } }, 50, TimeUnit.MILLISECONDS); }
[ "@", "Override", "public", "Future", "<", "RawGcsCreationToken", ">", "continueObjectCreationAsync", "(", "final", "RawGcsCreationToken", "token", ",", "final", "ByteBuffer", "chunk", ",", "long", "timeoutMillis", ")", "{", "try", "{", "ensureInitialized", "(", ")",...
Runs calls in a background thread so that the results will actually be asynchronous. @see com.google.appengine.tools.cloudstorage.RawGcsService#continueObjectCreationAsync( com.google.appengine.tools.cloudstorage.RawGcsService.RawGcsCreationToken, java.nio.ByteBuffer, long)
[ "Runs", "calls", "in", "a", "background", "thread", "so", "that", "the", "results", "will", "actually", "be", "asynchronous", "." ]
d11078331ecd915d753c886e96a80133599f3f98
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/dev/LocalRawGcsService.java#L286-L302
train
GoogleCloudPlatform/appengine-gcs-client
java/src/main/java/com/google/appengine/tools/cloudstorage/PrefetchingGcsInputChannelImpl.java
PrefetchingGcsInputChannelImpl.requestBlock
private void requestBlock() { next = ByteBuffer.allocate(blockSizeBytes); long requestTimeout = retryParams.getRequestTimeoutMillisForCurrentAttempt(); pendingFetch = raw.readObjectAsync(next, filename, fetchPosition, requestTimeout); }
java
private void requestBlock() { next = ByteBuffer.allocate(blockSizeBytes); long requestTimeout = retryParams.getRequestTimeoutMillisForCurrentAttempt(); pendingFetch = raw.readObjectAsync(next, filename, fetchPosition, requestTimeout); }
[ "private", "void", "requestBlock", "(", ")", "{", "next", "=", "ByteBuffer", ".", "allocate", "(", "blockSizeBytes", ")", ";", "long", "requestTimeout", "=", "retryParams", ".", "getRequestTimeoutMillisForCurrentAttempt", "(", ")", ";", "pendingFetch", "=", "raw",...
Allocates a new next buffer and pending fetch.
[ "Allocates", "a", "new", "next", "buffer", "and", "pending", "fetch", "." ]
d11078331ecd915d753c886e96a80133599f3f98
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/PrefetchingGcsInputChannelImpl.java#L104-L108
train
GoogleCloudPlatform/appengine-gcs-client
java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java
OauthRawGcsService.handlePutResponse
GcsRestCreationToken handlePutResponse(final GcsRestCreationToken token, final boolean isFinalChunk, final int length, final HTTPRequestInfo reqInfo, HTTPResponse resp) throws Error, IOException { switch (resp.getResponseCode()) { case 200: if (!isFinalChunk) { throw new RuntimeException("Unexpected response code 200 on non-final chunk. Request: \n" + URLFetchUtils.describeRequestAndResponse(reqInfo, resp)); } else { return null; } case 308: if (isFinalChunk) { throw new RuntimeException("Unexpected response code 308 on final chunk: " + URLFetchUtils.describeRequestAndResponse(reqInfo, resp)); } else { return new GcsRestCreationToken(token.filename, token.uploadId, token.offset + length); } default: throw HttpErrorHandler.error(resp.getResponseCode(), URLFetchUtils.describeRequestAndResponse(reqInfo, resp)); } }
java
GcsRestCreationToken handlePutResponse(final GcsRestCreationToken token, final boolean isFinalChunk, final int length, final HTTPRequestInfo reqInfo, HTTPResponse resp) throws Error, IOException { switch (resp.getResponseCode()) { case 200: if (!isFinalChunk) { throw new RuntimeException("Unexpected response code 200 on non-final chunk. Request: \n" + URLFetchUtils.describeRequestAndResponse(reqInfo, resp)); } else { return null; } case 308: if (isFinalChunk) { throw new RuntimeException("Unexpected response code 308 on final chunk: " + URLFetchUtils.describeRequestAndResponse(reqInfo, resp)); } else { return new GcsRestCreationToken(token.filename, token.uploadId, token.offset + length); } default: throw HttpErrorHandler.error(resp.getResponseCode(), URLFetchUtils.describeRequestAndResponse(reqInfo, resp)); } }
[ "GcsRestCreationToken", "handlePutResponse", "(", "final", "GcsRestCreationToken", "token", ",", "final", "boolean", "isFinalChunk", ",", "final", "int", "length", ",", "final", "HTTPRequestInfo", "reqInfo", ",", "HTTPResponse", "resp", ")", "throws", "Error", ",", ...
Given a HTTPResponce, process it, throwing an error if needed and return a Token for the next request.
[ "Given", "a", "HTTPResponce", "process", "it", "throwing", "an", "error", "if", "needed", "and", "return", "a", "Token", "for", "the", "next", "request", "." ]
d11078331ecd915d753c886e96a80133599f3f98
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java#L375-L399
train
GoogleCloudPlatform/appengine-gcs-client
java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java
OauthRawGcsService.put
private RawGcsCreationToken put(final GcsRestCreationToken token, ByteBuffer chunk, final boolean isFinalChunk, long timeoutMillis) throws IOException { final int length = chunk.remaining(); HTTPRequest req = createPutRequest(token, chunk, isFinalChunk, timeoutMillis, length); HTTPRequestInfo info = new HTTPRequestInfo(req); HTTPResponse response; try { response = urlfetch.fetch(req); } catch (IOException e) { throw createIOException(info, e); } return handlePutResponse(token, isFinalChunk, length, info, response); }
java
private RawGcsCreationToken put(final GcsRestCreationToken token, ByteBuffer chunk, final boolean isFinalChunk, long timeoutMillis) throws IOException { final int length = chunk.remaining(); HTTPRequest req = createPutRequest(token, chunk, isFinalChunk, timeoutMillis, length); HTTPRequestInfo info = new HTTPRequestInfo(req); HTTPResponse response; try { response = urlfetch.fetch(req); } catch (IOException e) { throw createIOException(info, e); } return handlePutResponse(token, isFinalChunk, length, info, response); }
[ "private", "RawGcsCreationToken", "put", "(", "final", "GcsRestCreationToken", "token", ",", "ByteBuffer", "chunk", ",", "final", "boolean", "isFinalChunk", ",", "long", "timeoutMillis", ")", "throws", "IOException", "{", "final", "int", "length", "=", "chunk", "....
Write the provided chunk at the offset specified in the token. If finalChunk is set, the file will be closed.
[ "Write", "the", "provided", "chunk", "at", "the", "offset", "specified", "in", "the", "token", ".", "If", "finalChunk", "is", "set", "the", "file", "will", "be", "closed", "." ]
d11078331ecd915d753c886e96a80133599f3f98
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java#L405-L417
train
GoogleCloudPlatform/appengine-gcs-client
java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java
OauthRawGcsService.deleteObject
@Override public boolean deleteObject(GcsFilename filename, long timeoutMillis) throws IOException { HTTPRequest req = makeRequest(filename, null, DELETE, timeoutMillis); HTTPResponse resp; try { resp = urlfetch.fetch(req); } catch (IOException e) { throw createIOException(new HTTPRequestInfo(req), e); } switch (resp.getResponseCode()) { case 204: return true; case 404: return false; default: throw HttpErrorHandler.error(new HTTPRequestInfo(req), resp); } }
java
@Override public boolean deleteObject(GcsFilename filename, long timeoutMillis) throws IOException { HTTPRequest req = makeRequest(filename, null, DELETE, timeoutMillis); HTTPResponse resp; try { resp = urlfetch.fetch(req); } catch (IOException e) { throw createIOException(new HTTPRequestInfo(req), e); } switch (resp.getResponseCode()) { case 204: return true; case 404: return false; default: throw HttpErrorHandler.error(new HTTPRequestInfo(req), resp); } }
[ "@", "Override", "public", "boolean", "deleteObject", "(", "GcsFilename", "filename", ",", "long", "timeoutMillis", ")", "throws", "IOException", "{", "HTTPRequest", "req", "=", "makeRequest", "(", "filename", ",", "null", ",", "DELETE", ",", "timeoutMillis", ")...
True if deleted, false if not found.
[ "True", "if", "deleted", "false", "if", "not", "found", "." ]
d11078331ecd915d753c886e96a80133599f3f98
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java#L456-L473
train
GoogleCloudPlatform/appengine-gcs-client
java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java
OauthRawGcsService.readObjectAsync
@Override public Future<GcsFileMetadata> readObjectAsync(final ByteBuffer dst, final GcsFilename filename, long startOffsetBytes, long timeoutMillis) { Preconditions.checkArgument(startOffsetBytes >= 0, "%s: offset must be non-negative: %s", this, startOffsetBytes); final int n = dst.remaining(); Preconditions.checkArgument(n > 0, "%s: dst full: %s", this, dst); final int want = Math.min(READ_LIMIT_BYTES, n); final HTTPRequest req = makeRequest(filename, null, GET, timeoutMillis); req.setHeader( new HTTPHeader(RANGE, "bytes=" + startOffsetBytes + "-" + (startOffsetBytes + want - 1))); final HTTPRequestInfo info = new HTTPRequestInfo(req); return new FutureWrapper<HTTPResponse, GcsFileMetadata>(urlfetch.fetchAsync(req)) { @Override protected GcsFileMetadata wrap(HTTPResponse resp) throws IOException { long totalLength; switch (resp.getResponseCode()) { case 200: totalLength = getLengthFromHeader(resp, X_GOOG_CONTENT_LENGTH); break; case 206: totalLength = getLengthFromContentRange(resp); break; case 404: throw new FileNotFoundException("Could not find: " + filename); case 416: throw new BadRangeException("Requested Range not satisfiable; perhaps read past EOF? " + URLFetchUtils.describeRequestAndResponse(info, resp)); default: throw HttpErrorHandler.error(info, resp); } byte[] content = resp.getContent(); Preconditions.checkState(content.length <= want, "%s: got %s > wanted %s", this, content.length, want); dst.put(content); return getMetadataFromResponse(filename, resp, totalLength); } @Override protected Throwable convertException(Throwable e) { return OauthRawGcsService.convertException(info, e); } }; }
java
@Override public Future<GcsFileMetadata> readObjectAsync(final ByteBuffer dst, final GcsFilename filename, long startOffsetBytes, long timeoutMillis) { Preconditions.checkArgument(startOffsetBytes >= 0, "%s: offset must be non-negative: %s", this, startOffsetBytes); final int n = dst.remaining(); Preconditions.checkArgument(n > 0, "%s: dst full: %s", this, dst); final int want = Math.min(READ_LIMIT_BYTES, n); final HTTPRequest req = makeRequest(filename, null, GET, timeoutMillis); req.setHeader( new HTTPHeader(RANGE, "bytes=" + startOffsetBytes + "-" + (startOffsetBytes + want - 1))); final HTTPRequestInfo info = new HTTPRequestInfo(req); return new FutureWrapper<HTTPResponse, GcsFileMetadata>(urlfetch.fetchAsync(req)) { @Override protected GcsFileMetadata wrap(HTTPResponse resp) throws IOException { long totalLength; switch (resp.getResponseCode()) { case 200: totalLength = getLengthFromHeader(resp, X_GOOG_CONTENT_LENGTH); break; case 206: totalLength = getLengthFromContentRange(resp); break; case 404: throw new FileNotFoundException("Could not find: " + filename); case 416: throw new BadRangeException("Requested Range not satisfiable; perhaps read past EOF? " + URLFetchUtils.describeRequestAndResponse(info, resp)); default: throw HttpErrorHandler.error(info, resp); } byte[] content = resp.getContent(); Preconditions.checkState(content.length <= want, "%s: got %s > wanted %s", this, content.length, want); dst.put(content); return getMetadataFromResponse(filename, resp, totalLength); } @Override protected Throwable convertException(Throwable e) { return OauthRawGcsService.convertException(info, e); } }; }
[ "@", "Override", "public", "Future", "<", "GcsFileMetadata", ">", "readObjectAsync", "(", "final", "ByteBuffer", "dst", ",", "final", "GcsFilename", "filename", ",", "long", "startOffsetBytes", ",", "long", "timeoutMillis", ")", "{", "Preconditions", ".", "checkAr...
Might not fill all of dst.
[ "Might", "not", "fill", "all", "of", "dst", "." ]
d11078331ecd915d753c886e96a80133599f3f98
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/OauthRawGcsService.java#L490-L534
train
GoogleCloudPlatform/appengine-gcs-client
java/example/src/main/java/com/google/appengine/demos/GcsExampleServlet.java
GcsExampleServlet.copy
private void copy(InputStream input, OutputStream output) throws IOException { try { byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead = input.read(buffer); while (bytesRead != -1) { output.write(buffer, 0, bytesRead); bytesRead = input.read(buffer); } } finally { input.close(); output.close(); } }
java
private void copy(InputStream input, OutputStream output) throws IOException { try { byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead = input.read(buffer); while (bytesRead != -1) { output.write(buffer, 0, bytesRead); bytesRead = input.read(buffer); } } finally { input.close(); output.close(); } }
[ "private", "void", "copy", "(", "InputStream", "input", ",", "OutputStream", "output", ")", "throws", "IOException", "{", "try", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "BUFFER_SIZE", "]", ";", "int", "bytesRead", "=", "input", ".", "re...
Transfer the data from the inputStream to the outputStream. Then close both streams.
[ "Transfer", "the", "data", "from", "the", "inputStream", "to", "the", "outputStream", ".", "Then", "close", "both", "streams", "." ]
d11078331ecd915d753c886e96a80133599f3f98
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/example/src/main/java/com/google/appengine/demos/GcsExampleServlet.java#L110-L122
train
JavaMoney/jsr354-api
src/main/java/javax/money/CurrencyQuery.java
CurrencyQuery.getCountries
public Collection<Locale> getCountries() { Collection<Locale> result = get(KEY_QUERY_COUNTRIES, Collection.class); if (result == null) { return Collections.emptySet(); } return result; }
java
public Collection<Locale> getCountries() { Collection<Locale> result = get(KEY_QUERY_COUNTRIES, Collection.class); if (result == null) { return Collections.emptySet(); } return result; }
[ "public", "Collection", "<", "Locale", ">", "getCountries", "(", ")", "{", "Collection", "<", "Locale", ">", "result", "=", "get", "(", "KEY_QUERY_COUNTRIES", ",", "Collection", ".", "class", ")", ";", "if", "(", "result", "==", "null", ")", "{", "return...
Returns the target locales. @return the target locales, never null.
[ "Returns", "the", "target", "locales", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/CurrencyQuery.java#L73-L79
train
JavaMoney/jsr354-api
src/main/java/javax/money/CurrencyQuery.java
CurrencyQuery.getCurrencyCodes
public Collection<String> getCurrencyCodes() { Collection<String> result = get(KEY_QUERY_CURRENCY_CODES, Collection.class); if (result == null) { return Collections.emptySet(); } return result; }
java
public Collection<String> getCurrencyCodes() { Collection<String> result = get(KEY_QUERY_CURRENCY_CODES, Collection.class); if (result == null) { return Collections.emptySet(); } return result; }
[ "public", "Collection", "<", "String", ">", "getCurrencyCodes", "(", ")", "{", "Collection", "<", "String", ">", "result", "=", "get", "(", "KEY_QUERY_CURRENCY_CODES", ",", "Collection", ".", "class", ")", ";", "if", "(", "result", "==", "null", ")", "{", ...
Gets the currency codes, or the regular expression to select codes. @return the query for chaining.
[ "Gets", "the", "currency", "codes", "or", "the", "regular", "expression", "to", "select", "codes", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/CurrencyQuery.java#L86-L92
train
JavaMoney/jsr354-api
src/main/java/javax/money/CurrencyQuery.java
CurrencyQuery.getNumericCodes
public Collection<Integer> getNumericCodes() { Collection<Integer> result = get(KEY_QUERY_NUMERIC_CODES, Collection.class); if (result == null) { return Collections.emptySet(); } return result; }
java
public Collection<Integer> getNumericCodes() { Collection<Integer> result = get(KEY_QUERY_NUMERIC_CODES, Collection.class); if (result == null) { return Collections.emptySet(); } return result; }
[ "public", "Collection", "<", "Integer", ">", "getNumericCodes", "(", ")", "{", "Collection", "<", "Integer", ">", "result", "=", "get", "(", "KEY_QUERY_NUMERIC_CODES", ",", "Collection", ".", "class", ")", ";", "if", "(", "result", "==", "null", ")", "{", ...
Gets the numeric codes. Setting it to -1 search for currencies that have no numeric code. @return the query for chaining.
[ "Gets", "the", "numeric", "codes", ".", "Setting", "it", "to", "-", "1", "search", "for", "currencies", "that", "have", "no", "numeric", "code", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/CurrencyQuery.java#L99-L105
train
JavaMoney/jsr354-api
src/main/java/javax/money/MonetaryContext.java
MonetaryContext.getAmountType
public Class<? extends MonetaryAmount> getAmountType() { Class<?> clazz = get(AMOUNT_TYPE, Class.class); return clazz.asSubclass(MonetaryAmount.class); }
java
public Class<? extends MonetaryAmount> getAmountType() { Class<?> clazz = get(AMOUNT_TYPE, Class.class); return clazz.asSubclass(MonetaryAmount.class); }
[ "public", "Class", "<", "?", "extends", "MonetaryAmount", ">", "getAmountType", "(", ")", "{", "Class", "<", "?", ">", "clazz", "=", "get", "(", "AMOUNT_TYPE", ",", "Class", ".", "class", ")", ";", "return", "clazz", ".", "asSubclass", "(", "MonetaryAmou...
Get the MonetaryAmount implementation class. @return the implementation class of the containing amount instance, never null. @see MonetaryAmount#getContext()
[ "Get", "the", "MonetaryAmount", "implementation", "class", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/MonetaryContext.java#L118-L121
train
JavaMoney/jsr354-api
src/main/java/javax/money/DefaultMonetaryRoundingsSingletonSpi.java
DefaultMonetaryRoundingsSingletonSpi.getProviderNames
@Override public Set<String> getProviderNames() { Set<String> result = new HashSet<>(); for (RoundingProviderSpi prov : Bootstrap.getServices(RoundingProviderSpi.class)) { try { result.add(prov.getProviderName()); } catch (Exception e) { Logger.getLogger(Monetary.class.getName()) .log(Level.SEVERE, "Error loading RoundingProviderSpi from provider: " + prov, e); } } return result; }
java
@Override public Set<String> getProviderNames() { Set<String> result = new HashSet<>(); for (RoundingProviderSpi prov : Bootstrap.getServices(RoundingProviderSpi.class)) { try { result.add(prov.getProviderName()); } catch (Exception e) { Logger.getLogger(Monetary.class.getName()) .log(Level.SEVERE, "Error loading RoundingProviderSpi from provider: " + prov, e); } } return result; }
[ "@", "Override", "public", "Set", "<", "String", ">", "getProviderNames", "(", ")", "{", "Set", "<", "String", ">", "result", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "RoundingProviderSpi", "prov", ":", "Bootstrap", ".", "getServices", "("...
Get the names of all current registered providers. @return the names of all current registered providers, never null.
[ "Get", "the", "names", "of", "all", "current", "registered", "providers", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/DefaultMonetaryRoundingsSingletonSpi.java#L106-L118
train
JavaMoney/jsr354-api
src/main/java/javax/money/DefaultMonetaryRoundingsSingletonSpi.java
DefaultMonetaryRoundingsSingletonSpi.getDefaultProviderChain
@Override public List<String> getDefaultProviderChain() { List<String> result = new ArrayList<>(Monetary.getRoundingProviderNames()); Collections.sort(result); return result; }
java
@Override public List<String> getDefaultProviderChain() { List<String> result = new ArrayList<>(Monetary.getRoundingProviderNames()); Collections.sort(result); return result; }
[ "@", "Override", "public", "List", "<", "String", ">", "getDefaultProviderChain", "(", ")", "{", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<>", "(", "Monetary", ".", "getRoundingProviderNames", "(", ")", ")", ";", "Collections", ".", ...
Get the default providers list to be used. @return the default provider list and ordering, not null.
[ "Get", "the", "default", "providers", "list", "to", "be", "used", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/DefaultMonetaryRoundingsSingletonSpi.java#L125-L130
train
JavaMoney/jsr354-api
src/main/java/javax/money/DefaultMonetaryRoundingsSingletonSpi.java
DefaultMonetaryRoundingsSingletonSpi.getRoundingNames
@Override public Set<String> getRoundingNames(String... providers) { Set<String> result = new HashSet<>(); String[] providerNames = providers; if (providerNames.length == 0) { providerNames = Monetary.getDefaultRoundingProviderChain().toArray(new String[Monetary.getDefaultRoundingProviderChain().size()]); } for (String providerName : providerNames) { for (RoundingProviderSpi prov : Bootstrap.getServices(RoundingProviderSpi.class)) { try { if (prov.getProviderName().equals(providerName) || prov.getProviderName().matches(providerName)) { result.addAll(prov.getRoundingNames()); } } catch (Exception e) { Logger.getLogger(DefaultMonetaryRoundingsSingletonSpi.class.getName()) .log(Level.SEVERE, "Error loading RoundingProviderSpi from provider: " + prov, e); } } } return result; }
java
@Override public Set<String> getRoundingNames(String... providers) { Set<String> result = new HashSet<>(); String[] providerNames = providers; if (providerNames.length == 0) { providerNames = Monetary.getDefaultRoundingProviderChain().toArray(new String[Monetary.getDefaultRoundingProviderChain().size()]); } for (String providerName : providerNames) { for (RoundingProviderSpi prov : Bootstrap.getServices(RoundingProviderSpi.class)) { try { if (prov.getProviderName().equals(providerName) || prov.getProviderName().matches(providerName)) { result.addAll(prov.getRoundingNames()); } } catch (Exception e) { Logger.getLogger(DefaultMonetaryRoundingsSingletonSpi.class.getName()) .log(Level.SEVERE, "Error loading RoundingProviderSpi from provider: " + prov, e); } } } return result; }
[ "@", "Override", "public", "Set", "<", "String", ">", "getRoundingNames", "(", "String", "...", "providers", ")", "{", "Set", "<", "String", ">", "result", "=", "new", "HashSet", "<>", "(", ")", ";", "String", "[", "]", "providerNames", "=", "providers",...
Allows to access the identifiers of the current defined roundings. @param providers the providers and ordering to be used. By default providers and ordering as defined in #getDefaultProviders is used, not null. @return the set of custom rounding ids, never {@code null}.
[ "Allows", "to", "access", "the", "identifiers", "of", "the", "current", "defined", "roundings", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/DefaultMonetaryRoundingsSingletonSpi.java#L139-L159
train
JavaMoney/jsr354-api
src/main/java/javax/money/convert/ConversionQuery.java
ConversionQuery.getRateTypes
@SuppressWarnings("unchecked") public Set<RateType> getRateTypes() { Set<RateType> result = get(KEY_RATE_TYPES, Set.class); if (result == null) { return Collections.emptySet(); } return result; }
java
@SuppressWarnings("unchecked") public Set<RateType> getRateTypes() { Set<RateType> result = get(KEY_RATE_TYPES, Set.class); if (result == null) { return Collections.emptySet(); } return result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "Set", "<", "RateType", ">", "getRateTypes", "(", ")", "{", "Set", "<", "RateType", ">", "result", "=", "get", "(", "KEY_RATE_TYPES", ",", "Set", ".", "class", ")", ";", "if", "(", "result", ...
Get the rate types set. @return the rate types set, or an empty array, but never null.
[ "Get", "the", "rate", "types", "set", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/convert/ConversionQuery.java#L67-L74
train
JavaMoney/jsr354-api
src/main/java/javax/money/CurrencyQueryBuilder.java
CurrencyQueryBuilder.setCountries
public CurrencyQueryBuilder setCountries(Locale... countries) { return set(CurrencyQuery.KEY_QUERY_COUNTRIES, Arrays.asList(countries)); }
java
public CurrencyQueryBuilder setCountries(Locale... countries) { return set(CurrencyQuery.KEY_QUERY_COUNTRIES, Arrays.asList(countries)); }
[ "public", "CurrencyQueryBuilder", "setCountries", "(", "Locale", "...", "countries", ")", "{", "return", "set", "(", "CurrencyQuery", ".", "KEY_QUERY_COUNTRIES", ",", "Arrays", ".", "asList", "(", "countries", ")", ")", ";", "}" ]
Sets the country for which currencies should be requested. @param countries The ISO countries. @return the query for chaining.
[ "Sets", "the", "country", "for", "which", "currencies", "should", "be", "requested", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/CurrencyQueryBuilder.java#L58-L60
train
JavaMoney/jsr354-api
src/main/java/javax/money/CurrencyQueryBuilder.java
CurrencyQueryBuilder.setCurrencyCodes
public CurrencyQueryBuilder setCurrencyCodes(String... codes) { return set(CurrencyQuery.KEY_QUERY_CURRENCY_CODES, Arrays.asList(codes)); }
java
public CurrencyQueryBuilder setCurrencyCodes(String... codes) { return set(CurrencyQuery.KEY_QUERY_CURRENCY_CODES, Arrays.asList(codes)); }
[ "public", "CurrencyQueryBuilder", "setCurrencyCodes", "(", "String", "...", "codes", ")", "{", "return", "set", "(", "CurrencyQuery", ".", "KEY_QUERY_CURRENCY_CODES", ",", "Arrays", ".", "asList", "(", "codes", ")", ")", ";", "}" ]
Sets the currency code, or the regular expression to select codes. @param codes the currency codes or code expressions, not null. @return the query for chaining.
[ "Sets", "the", "currency", "code", "or", "the", "regular", "expression", "to", "select", "codes", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/CurrencyQueryBuilder.java#L68-L70
train
JavaMoney/jsr354-api
src/main/java/javax/money/CurrencyQueryBuilder.java
CurrencyQueryBuilder.setNumericCodes
public CurrencyQueryBuilder setNumericCodes(int... codes) { return set(CurrencyQuery.KEY_QUERY_NUMERIC_CODES, Arrays.stream(codes).boxed().collect(Collectors.toList())); }
java
public CurrencyQueryBuilder setNumericCodes(int... codes) { return set(CurrencyQuery.KEY_QUERY_NUMERIC_CODES, Arrays.stream(codes).boxed().collect(Collectors.toList())); }
[ "public", "CurrencyQueryBuilder", "setNumericCodes", "(", "int", "...", "codes", ")", "{", "return", "set", "(", "CurrencyQuery", ".", "KEY_QUERY_NUMERIC_CODES", ",", "Arrays", ".", "stream", "(", "codes", ")", ".", "boxed", "(", ")", ".", "collect", "(", "C...
Set the numeric code. Setting it to -1 search for currencies that have no numeric code. @param codes the numeric codes. @return the query for chaining.
[ "Set", "the", "numeric", "code", ".", "Setting", "it", "to", "-", "1", "search", "for", "currencies", "that", "have", "no", "numeric", "code", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/CurrencyQueryBuilder.java#L78-L81
train
JavaMoney/jsr354-api
src/main/java/javax/money/convert/MonetaryConversions.java
MonetaryConversions.getDefaultConversionProviderChain
public static List<String> getDefaultConversionProviderChain(){ List<String> defaultChain = getMonetaryConversionsSpi() .getDefaultProviderChain(); Objects.requireNonNull(defaultChain, "No default provider chain provided by SPI: " + getMonetaryConversionsSpi().getClass().getName()); return defaultChain; }
java
public static List<String> getDefaultConversionProviderChain(){ List<String> defaultChain = getMonetaryConversionsSpi() .getDefaultProviderChain(); Objects.requireNonNull(defaultChain, "No default provider chain provided by SPI: " + getMonetaryConversionsSpi().getClass().getName()); return defaultChain; }
[ "public", "static", "List", "<", "String", ">", "getDefaultConversionProviderChain", "(", ")", "{", "List", "<", "String", ">", "defaultChain", "=", "getMonetaryConversionsSpi", "(", ")", ".", "getDefaultProviderChain", "(", ")", ";", "Objects", ".", "requireNonNu...
Get the default provider used. @return the default provider, never {@code null}.
[ "Get", "the", "default", "provider", "used", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/convert/MonetaryConversions.java#L256-L262
train
JavaMoney/jsr354-api
src/main/java/javax/money/AbstractContext.java
AbstractContext.getKeys
public Set<String> getKeys(Class<?> type) { return data.entrySet().stream().filter(val -> type.isAssignableFrom(val.getValue() .getClass())).map(Map.Entry::getKey).collect(Collectors .toSet()); }
java
public Set<String> getKeys(Class<?> type) { return data.entrySet().stream().filter(val -> type.isAssignableFrom(val.getValue() .getClass())).map(Map.Entry::getKey).collect(Collectors .toSet()); }
[ "public", "Set", "<", "String", ">", "getKeys", "(", "Class", "<", "?", ">", "type", ")", "{", "return", "data", ".", "entrySet", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "val", "->", "type", ".", "isAssignableFrom", "(", "val", ".", ...
Get the present keys of all entries with a given type, checking hereby if assignable. @param type The attribute type, not null. @return all present keys of attributes being assignable to the type, never null.
[ "Get", "the", "present", "keys", "of", "all", "entries", "with", "a", "given", "type", "checking", "hereby", "if", "assignable", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/AbstractContext.java#L63-L67
train
JavaMoney/jsr354-api
src/main/java/javax/money/AbstractContext.java
AbstractContext.getType
public Class<?> getType(String key) { Object val = this.data.get(key); return val == null ? null : val.getClass(); }
java
public Class<?> getType(String key) { Object val = this.data.get(key); return val == null ? null : val.getClass(); }
[ "public", "Class", "<", "?", ">", "getType", "(", "String", "key", ")", "{", "Object", "val", "=", "this", ".", "data", ".", "get", "(", "key", ")", ";", "return", "val", "==", "null", "?", "null", ":", "val", ".", "getClass", "(", ")", ";", "}...
Get the current attribute type. @param key the entry's key, not null @return the current attribute type, or null, if no such attribute exists.
[ "Get", "the", "current", "attribute", "type", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/AbstractContext.java#L74-L77
train
JavaMoney/jsr354-api
src/main/java/javax/money/AbstractContext.java
AbstractContext.get
public <T> T get(String key, Class<T> type) { Object value = this.data.get(key); if (value != null && type.isAssignableFrom(value.getClass())) { return (T) value; } return null; }
java
public <T> T get(String key, Class<T> type) { Object value = this.data.get(key); if (value != null && type.isAssignableFrom(value.getClass())) { return (T) value; } return null; }
[ "public", "<", "T", ">", "T", "get", "(", "String", "key", ",", "Class", "<", "T", ">", "type", ")", "{", "Object", "value", "=", "this", ".", "data", ".", "get", "(", "key", ")", ";", "if", "(", "value", "!=", "null", "&&", "type", ".", "isA...
Access an attribute. @param type the attribute's type, not {@code null} @param key the attribute's key, not {@code null} @return the attribute value, or {@code null}.
[ "Access", "an", "attribute", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/AbstractContext.java#L87-L93
train
JavaMoney/jsr354-api
src/main/java/javax/money/AbstractContext.java
AbstractContext.get
public <T> T get(Class<T> type) { return get(type.getName(), type); }
java
public <T> T get(Class<T> type) { return get(type.getName(), type); }
[ "public", "<", "T", ">", "T", "get", "(", "Class", "<", "T", ">", "type", ")", "{", "return", "get", "(", "type", ".", "getName", "(", ")", ",", "type", ")", ";", "}" ]
Access an attribute, hereby using the class name as key. @param type the type, not {@code null} @return the type attribute value, or {@code null}.
[ "Access", "an", "attribute", "hereby", "using", "the", "class", "name", "as", "key", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/AbstractContext.java#L101-L103
train
JavaMoney/jsr354-api
src/main/java/javax/money/AbstractQueryBuilder.java
AbstractQueryBuilder.setTargetType
@SuppressWarnings("unchecked") public B setTargetType(Class<?> type) { Objects.requireNonNull(type); set(AbstractQuery.KEY_QUERY_TARGET_TYPE, type); return (B) this; }
java
@SuppressWarnings("unchecked") public B setTargetType(Class<?> type) { Objects.requireNonNull(type); set(AbstractQuery.KEY_QUERY_TARGET_TYPE, type); return (B) this; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "B", "setTargetType", "(", "Class", "<", "?", ">", "type", ")", "{", "Objects", ".", "requireNonNull", "(", "type", ")", ";", "set", "(", "AbstractQuery", ".", "KEY_QUERY_TARGET_TYPE", ",", "type"...
Sets the target implementation type required. This can be used to explicitly acquire a specific implementation type and use a query to configure the instance or factory to be returned. @param type the target implementation type, not null. @return this query builder for chaining.
[ "Sets", "the", "target", "implementation", "type", "required", ".", "This", "can", "be", "used", "to", "explicitly", "acquire", "a", "specific", "implementation", "type", "and", "use", "a", "query", "to", "configure", "the", "instance", "or", "factory", "to", ...
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/AbstractQueryBuilder.java#L97-L102
train
JavaMoney/jsr354-api
src/main/java/javax/money/convert/ProviderContext.java
ProviderContext.getRateTypes
public Set<RateType> getRateTypes() { @SuppressWarnings("unchecked") Set<RateType> rateSet = get(KEY_RATE_TYPES, Set.class); if (rateSet == null) { return Collections.emptySet(); } return Collections.unmodifiableSet(rateSet); }
java
public Set<RateType> getRateTypes() { @SuppressWarnings("unchecked") Set<RateType> rateSet = get(KEY_RATE_TYPES, Set.class); if (rateSet == null) { return Collections.emptySet(); } return Collections.unmodifiableSet(rateSet); }
[ "public", "Set", "<", "RateType", ">", "getRateTypes", "(", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Set", "<", "RateType", ">", "rateSet", "=", "get", "(", "KEY_RATE_TYPES", ",", "Set", ".", "class", ")", ";", "if", "(", "rateSet",...
Get the deferred flag. Exchange rates can be deferred or real.time. @return the deferred flag, or {code null}.
[ "Get", "the", "deferred", "flag", ".", "Exchange", "rates", "can", "be", "deferred", "or", "real", ".", "time", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/convert/ProviderContext.java#L66-L73
train
JavaMoney/jsr354-api
src/main/java/javax/money/format/MonetaryFormats.java
MonetaryFormats.loadMonetaryFormatsSingletonSpi
private static MonetaryFormatsSingletonSpi loadMonetaryFormatsSingletonSpi() { try { return Optional.ofNullable(Bootstrap.getService(MonetaryFormatsSingletonSpi.class)) .orElseGet(DefaultMonetaryFormatsSingletonSpi::new); } catch (Exception e) { Logger.getLogger(MonetaryFormats.class.getName()) .log(Level.WARNING, "Failed to load MonetaryFormatsSingletonSpi, using default.", e); return new DefaultMonetaryFormatsSingletonSpi(); } }
java
private static MonetaryFormatsSingletonSpi loadMonetaryFormatsSingletonSpi() { try { return Optional.ofNullable(Bootstrap.getService(MonetaryFormatsSingletonSpi.class)) .orElseGet(DefaultMonetaryFormatsSingletonSpi::new); } catch (Exception e) { Logger.getLogger(MonetaryFormats.class.getName()) .log(Level.WARNING, "Failed to load MonetaryFormatsSingletonSpi, using default.", e); return new DefaultMonetaryFormatsSingletonSpi(); } }
[ "private", "static", "MonetaryFormatsSingletonSpi", "loadMonetaryFormatsSingletonSpi", "(", ")", "{", "try", "{", "return", "Optional", ".", "ofNullable", "(", "Bootstrap", ".", "getService", "(", "MonetaryFormatsSingletonSpi", ".", "class", ")", ")", ".", "orElseGet"...
Loads the SPI backing bean. @return the instance of MonetaryFormatsSingletonSpi to be used by this singleton.
[ "Loads", "the", "SPI", "backing", "bean", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/format/MonetaryFormats.java#L54-L63
train
JavaMoney/jsr354-api
src/main/java/javax/money/format/MonetaryFormats.java
MonetaryFormats.getFormatProviderNames
public static Collection<String> getFormatProviderNames() { Collection<String> providers = Optional.ofNullable(getMonetaryFormatsSpi()).orElseThrow( () -> new MonetaryException( "No MonetaryFormatsSingletonSpi loaded, query functionality is not available.")) .getProviderNames(); if (Objects.isNull(providers)) { Logger.getLogger(MonetaryFormats.class.getName()).warning( "No supported rate/conversion providers returned by SPI: " + getMonetaryFormatsSpi().getClass().getName()); return Collections.emptySet(); } return providers; }
java
public static Collection<String> getFormatProviderNames() { Collection<String> providers = Optional.ofNullable(getMonetaryFormatsSpi()).orElseThrow( () -> new MonetaryException( "No MonetaryFormatsSingletonSpi loaded, query functionality is not available.")) .getProviderNames(); if (Objects.isNull(providers)) { Logger.getLogger(MonetaryFormats.class.getName()).warning( "No supported rate/conversion providers returned by SPI: " + getMonetaryFormatsSpi().getClass().getName()); return Collections.emptySet(); } return providers; }
[ "public", "static", "Collection", "<", "String", ">", "getFormatProviderNames", "(", ")", "{", "Collection", "<", "String", ">", "providers", "=", "Optional", ".", "ofNullable", "(", "getMonetaryFormatsSpi", "(", ")", ")", ".", "orElseThrow", "(", "(", ")", ...
Get the names of the currently registered format providers. @return the provider names, never null.
[ "Get", "the", "names", "of", "the", "currently", "registered", "format", "providers", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/format/MonetaryFormats.java#L169-L181
train
JavaMoney/jsr354-api
src/main/java/javax/money/convert/ProviderContextBuilder.java
ProviderContextBuilder.setRateTypes
public ProviderContextBuilder setRateTypes(Collection<RateType> rateTypes) { Objects.requireNonNull(rateTypes); if (rateTypes.isEmpty()) { throw new IllegalArgumentException("At least one RateType is required."); } Set<RateType> rtSet = new HashSet<>(rateTypes); set(ProviderContext.KEY_RATE_TYPES, rtSet); return this; }
java
public ProviderContextBuilder setRateTypes(Collection<RateType> rateTypes) { Objects.requireNonNull(rateTypes); if (rateTypes.isEmpty()) { throw new IllegalArgumentException("At least one RateType is required."); } Set<RateType> rtSet = new HashSet<>(rateTypes); set(ProviderContext.KEY_RATE_TYPES, rtSet); return this; }
[ "public", "ProviderContextBuilder", "setRateTypes", "(", "Collection", "<", "RateType", ">", "rateTypes", ")", "{", "Objects", ".", "requireNonNull", "(", "rateTypes", ")", ";", "if", "(", "rateTypes", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "Ill...
Set the rate types. @param rateTypes the rate types, not null and not empty. @return this, for chaining. @throws IllegalArgumentException when not at least one {@link RateType} is provided.
[ "Set", "the", "rate", "types", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/convert/ProviderContextBuilder.java#L93-L101
train
JavaMoney/jsr354-api
src/main/java/javax/money/AbstractContextBuilder.java
AbstractContextBuilder.importContext
public B importContext(AbstractContext context, boolean overwriteDuplicates){ for (Map.Entry<String, Object> en : context.data.entrySet()) { if (overwriteDuplicates) { this.data.put(en.getKey(), en.getValue()); }else{ this.data.putIfAbsent(en.getKey(), en.getValue()); } } return (B) this; }
java
public B importContext(AbstractContext context, boolean overwriteDuplicates){ for (Map.Entry<String, Object> en : context.data.entrySet()) { if (overwriteDuplicates) { this.data.put(en.getKey(), en.getValue()); }else{ this.data.putIfAbsent(en.getKey(), en.getValue()); } } return (B) this; }
[ "public", "B", "importContext", "(", "AbstractContext", "context", ",", "boolean", "overwriteDuplicates", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "en", ":", "context", ".", "data", ".", "entrySet", "(", ")", ")", "{"...
Apply all attributes on the given context. @param context the context to be applied, not null. @param overwriteDuplicates flag, if existing entries should be overwritten. @return this Builder, for chaining
[ "Apply", "all", "attributes", "on", "the", "given", "context", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/AbstractContextBuilder.java#L48-L57
train
JavaMoney/jsr354-api
src/main/java/javax/money/AbstractContextBuilder.java
AbstractContextBuilder.importContext
public B importContext(AbstractContext context){ Objects.requireNonNull(context); return importContext(context, false); }
java
public B importContext(AbstractContext context){ Objects.requireNonNull(context); return importContext(context, false); }
[ "public", "B", "importContext", "(", "AbstractContext", "context", ")", "{", "Objects", ".", "requireNonNull", "(", "context", ")", ";", "return", "importContext", "(", "context", ",", "false", ")", ";", "}" ]
Apply all attributes on the given context, hereby existing entries are preserved. @param context the context to be applied, not null. @return this Builder, for chaining @see #importContext(AbstractContext, boolean)
[ "Apply", "all", "attributes", "on", "the", "given", "context", "hereby", "existing", "entries", "are", "preserved", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/AbstractContextBuilder.java#L66-L69
train
JavaMoney/jsr354-api
src/main/java/javax/money/AbstractContextBuilder.java
AbstractContextBuilder.set
public B set(String key, int value) { this.data.put(key, value); return (B) this; }
java
public B set(String key, int value) { this.data.put(key, value); return (B) this; }
[ "public", "B", "set", "(", "String", "key", ",", "int", "value", ")", "{", "this", ".", "data", ".", "put", "(", "key", ",", "value", ")", ";", "return", "(", "B", ")", "this", ";", "}" ]
Sets an Integer attribute. @param key the key, non null. @param value the value @return the Builder, for chaining.
[ "Sets", "an", "Integer", "attribute", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/AbstractContextBuilder.java#L78-L81
train
JavaMoney/jsr354-api
src/main/java/javax/money/Monetary.java
Monetary.getRoundingNames
public static Set<String> getRoundingNames(String... providers) { return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow( () -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available.")) .getRoundingNames(providers); }
java
public static Set<String> getRoundingNames(String... providers) { return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow( () -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available.")) .getRoundingNames(providers); }
[ "public", "static", "Set", "<", "String", ">", "getRoundingNames", "(", "String", "...", "providers", ")", "{", "return", "Optional", ".", "ofNullable", "(", "monetaryRoundingsSingletonSpi", "(", ")", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "Mon...
Allows to access the names of the current defined roundings. @param providers the providers and ordering to be used. By default providers and ordering as defined in #getDefaultProviders is used. @return the set of custom rounding ids, never {@code null}.
[ "Allows", "to", "access", "the", "names", "of", "the", "current", "defined", "roundings", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L262-L266
train
JavaMoney/jsr354-api
src/main/java/javax/money/Monetary.java
Monetary.getAmountFactory
@SuppressWarnings("rawtypes") public static MonetaryAmountFactory getAmountFactory(MonetaryAmountFactoryQuery query) { return Optional.ofNullable(monetaryAmountsSingletonQuerySpi()).orElseThrow(() -> new MonetaryException( "No MonetaryAmountsSingletonQuerySpi loaded, query functionality is not available.")) .getAmountFactory(query); }
java
@SuppressWarnings("rawtypes") public static MonetaryAmountFactory getAmountFactory(MonetaryAmountFactoryQuery query) { return Optional.ofNullable(monetaryAmountsSingletonQuerySpi()).orElseThrow(() -> new MonetaryException( "No MonetaryAmountsSingletonQuerySpi loaded, query functionality is not available.")) .getAmountFactory(query); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "static", "MonetaryAmountFactory", "getAmountFactory", "(", "MonetaryAmountFactoryQuery", "query", ")", "{", "return", "Optional", ".", "ofNullable", "(", "monetaryAmountsSingletonQuerySpi", "(", ")", ")", "."...
Executes the query and returns the factory found, if there is only one factory. If multiple factories match the query, one is selected. @param query the factory query, not null. @return the factory found, or null.
[ "Executes", "the", "query", "and", "returns", "the", "factory", "found", "if", "there", "is", "only", "one", "factory", ".", "If", "multiple", "factories", "match", "the", "query", "one", "is", "selected", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L344-L349
train
JavaMoney/jsr354-api
src/main/java/javax/money/Monetary.java
Monetary.getAmountFactories
public static Collection<MonetaryAmountFactory<?>> getAmountFactories(MonetaryAmountFactoryQuery query) { return Optional.ofNullable(monetaryAmountsSingletonQuerySpi()).orElseThrow(() -> new MonetaryException( "No MonetaryAmountsSingletonQuerySpi loaded, query functionality is not available.")) .getAmountFactories(query); }
java
public static Collection<MonetaryAmountFactory<?>> getAmountFactories(MonetaryAmountFactoryQuery query) { return Optional.ofNullable(monetaryAmountsSingletonQuerySpi()).orElseThrow(() -> new MonetaryException( "No MonetaryAmountsSingletonQuerySpi loaded, query functionality is not available.")) .getAmountFactories(query); }
[ "public", "static", "Collection", "<", "MonetaryAmountFactory", "<", "?", ">", ">", "getAmountFactories", "(", "MonetaryAmountFactoryQuery", "query", ")", "{", "return", "Optional", ".", "ofNullable", "(", "monetaryAmountsSingletonQuerySpi", "(", ")", ")", ".", "orE...
Returns all factory instances that match the query. @param query the factory query, not null. @return the instances found, never null.
[ "Returns", "all", "factory", "instances", "that", "match", "the", "query", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L357-L361
train
JavaMoney/jsr354-api
src/main/java/javax/money/Monetary.java
Monetary.getCurrencies
public static Collection<CurrencyUnit> getCurrencies(String... providers) { return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow( () -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup.")) .getCurrencies(providers); }
java
public static Collection<CurrencyUnit> getCurrencies(String... providers) { return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow( () -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup.")) .getCurrencies(providers); }
[ "public", "static", "Collection", "<", "CurrencyUnit", ">", "getCurrencies", "(", "String", "...", "providers", ")", "{", "return", "Optional", ".", "ofNullable", "(", "MONETARY_CURRENCIES_SINGLETON_SPI", "(", ")", ")", ".", "orElseThrow", "(", "(", ")", "->", ...
Access all currencies known. @param providers the (optional) specification of providers to consider. @return the list of known currencies, never null.
[ "Access", "all", "currencies", "known", "." ]
49a7ae436eaf45cac1040879185531ef22de5525
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L458-L462
train
jfrog/artifactory-client-java
httpClient/src/main/java/org/jfrog/artifactory/client/httpClient/http/HttpBuilderBase.java
HttpBuilderBase.createConnectionMgr
private PoolingHttpClientConnectionManager createConnectionMgr() { PoolingHttpClientConnectionManager connectionMgr; // prepare SSLContext SSLContext sslContext = buildSslContext(); ConnectionSocketFactory plainsf = PlainConnectionSocketFactory.getSocketFactory(); // we allow to disable host name verification against CA certificate, // notice: in general this is insecure and should be avoided in production, // (this type of configuration is useful for development purposes) boolean noHostVerification = false; LayeredConnectionSocketFactory sslsf = new SSLConnectionSocketFactory( sslContext, noHostVerification ? NoopHostnameVerifier.INSTANCE : new DefaultHostnameVerifier() ); Registry<ConnectionSocketFactory> r = RegistryBuilder.<ConnectionSocketFactory>create() .register("http", plainsf) .register("https", sslsf) .build(); connectionMgr = new PoolingHttpClientConnectionManager(r, null, null, null, connectionPoolTimeToLive, TimeUnit.SECONDS); connectionMgr.setMaxTotal(maxConnectionsTotal); connectionMgr.setDefaultMaxPerRoute(maxConnectionsPerRoute); HttpHost localhost = new HttpHost("localhost", 80); connectionMgr.setMaxPerRoute(new HttpRoute(localhost), maxConnectionsPerRoute); return connectionMgr; }
java
private PoolingHttpClientConnectionManager createConnectionMgr() { PoolingHttpClientConnectionManager connectionMgr; // prepare SSLContext SSLContext sslContext = buildSslContext(); ConnectionSocketFactory plainsf = PlainConnectionSocketFactory.getSocketFactory(); // we allow to disable host name verification against CA certificate, // notice: in general this is insecure and should be avoided in production, // (this type of configuration is useful for development purposes) boolean noHostVerification = false; LayeredConnectionSocketFactory sslsf = new SSLConnectionSocketFactory( sslContext, noHostVerification ? NoopHostnameVerifier.INSTANCE : new DefaultHostnameVerifier() ); Registry<ConnectionSocketFactory> r = RegistryBuilder.<ConnectionSocketFactory>create() .register("http", plainsf) .register("https", sslsf) .build(); connectionMgr = new PoolingHttpClientConnectionManager(r, null, null, null, connectionPoolTimeToLive, TimeUnit.SECONDS); connectionMgr.setMaxTotal(maxConnectionsTotal); connectionMgr.setDefaultMaxPerRoute(maxConnectionsPerRoute); HttpHost localhost = new HttpHost("localhost", 80); connectionMgr.setMaxPerRoute(new HttpRoute(localhost), maxConnectionsPerRoute); return connectionMgr; }
[ "private", "PoolingHttpClientConnectionManager", "createConnectionMgr", "(", ")", "{", "PoolingHttpClientConnectionManager", "connectionMgr", ";", "// prepare SSLContext", "SSLContext", "sslContext", "=", "buildSslContext", "(", ")", ";", "ConnectionSocketFactory", "plainsf", "...
Creates custom Http Client connection pool to be used by Http Client @return {@link PoolingHttpClientConnectionManager}
[ "Creates", "custom", "Http", "Client", "connection", "pool", "to", "be", "used", "by", "Http", "Client" ]
e7443f4ffa8bf7d3b161f9cdc59bfc3036e9b46e
https://github.com/jfrog/artifactory-client-java/blob/e7443f4ffa8bf7d3b161f9cdc59bfc3036e9b46e/httpClient/src/main/java/org/jfrog/artifactory/client/httpClient/http/HttpBuilderBase.java#L269-L295
train
jfrog/artifactory-client-java
services/src/main/groovy/org/jfrog/artifactory/client/impl/ArtifactoryImpl.java
ArtifactoryImpl.restCall
@Override public ArtifactoryResponse restCall(ArtifactoryRequest artifactoryRequest) throws IOException { HttpRequestBase httpRequest; String requestPath = "/" + artifactoryRequest.getApiUrl(); ContentType contentType = Util.getContentType(artifactoryRequest.getRequestType()); String queryPath = ""; if (!artifactoryRequest.getQueryParams().isEmpty()) { queryPath = Util.getQueryPath("?", artifactoryRequest.getQueryParams()); } switch (artifactoryRequest.getMethod()) { case GET: httpRequest = new HttpGet(); break; case POST: httpRequest = new HttpPost(); setEntity((HttpPost)httpRequest, artifactoryRequest.getBody(), contentType); break; case PUT: httpRequest = new HttpPut(); setEntity((HttpPut)httpRequest, artifactoryRequest.getBody(), contentType); break; case DELETE: httpRequest = new HttpDelete(); break; case PATCH: httpRequest = new HttpPatch(); setEntity((HttpPatch)httpRequest, artifactoryRequest.getBody(), contentType); break; case OPTIONS: httpRequest = new HttpOptions(); break; default: throw new IllegalArgumentException("Unsupported request method."); } httpRequest.setURI(URI.create(url + requestPath + queryPath)); addAccessTokenHeaderIfNeeded(httpRequest); if (contentType != null) { httpRequest.setHeader("Content-type", contentType.getMimeType()); } Map<String, String> headers = artifactoryRequest.getHeaders(); for (String key : headers.keySet()) { httpRequest.setHeader(key, headers.get(key)); } HttpResponse httpResponse = httpClient.execute(httpRequest); return new ArtifactoryResponseImpl(httpResponse); }
java
@Override public ArtifactoryResponse restCall(ArtifactoryRequest artifactoryRequest) throws IOException { HttpRequestBase httpRequest; String requestPath = "/" + artifactoryRequest.getApiUrl(); ContentType contentType = Util.getContentType(artifactoryRequest.getRequestType()); String queryPath = ""; if (!artifactoryRequest.getQueryParams().isEmpty()) { queryPath = Util.getQueryPath("?", artifactoryRequest.getQueryParams()); } switch (artifactoryRequest.getMethod()) { case GET: httpRequest = new HttpGet(); break; case POST: httpRequest = new HttpPost(); setEntity((HttpPost)httpRequest, artifactoryRequest.getBody(), contentType); break; case PUT: httpRequest = new HttpPut(); setEntity((HttpPut)httpRequest, artifactoryRequest.getBody(), contentType); break; case DELETE: httpRequest = new HttpDelete(); break; case PATCH: httpRequest = new HttpPatch(); setEntity((HttpPatch)httpRequest, artifactoryRequest.getBody(), contentType); break; case OPTIONS: httpRequest = new HttpOptions(); break; default: throw new IllegalArgumentException("Unsupported request method."); } httpRequest.setURI(URI.create(url + requestPath + queryPath)); addAccessTokenHeaderIfNeeded(httpRequest); if (contentType != null) { httpRequest.setHeader("Content-type", contentType.getMimeType()); } Map<String, String> headers = artifactoryRequest.getHeaders(); for (String key : headers.keySet()) { httpRequest.setHeader(key, headers.get(key)); } HttpResponse httpResponse = httpClient.execute(httpRequest); return new ArtifactoryResponseImpl(httpResponse); }
[ "@", "Override", "public", "ArtifactoryResponse", "restCall", "(", "ArtifactoryRequest", "artifactoryRequest", ")", "throws", "IOException", "{", "HttpRequestBase", "httpRequest", ";", "String", "requestPath", "=", "\"/\"", "+", "artifactoryRequest", ".", "getApiUrl", "...
Create a REST call to artifactory with a generic request @param artifactoryRequest that should be sent to artifactory @return {@link ArtifactoryResponse} artifactory response as per to the request sent
[ "Create", "a", "REST", "call", "to", "artifactory", "with", "a", "generic", "request" ]
e7443f4ffa8bf7d3b161f9cdc59bfc3036e9b46e
https://github.com/jfrog/artifactory-client-java/blob/e7443f4ffa8bf7d3b161f9cdc59bfc3036e9b46e/services/src/main/groovy/org/jfrog/artifactory/client/impl/ArtifactoryImpl.java#L126-L188
train
radkovo/Pdf2Dom
src/main/java/org/fit/pdfdom/PDFDomTree.java
PDFDomTree.createDocument
protected void createDocument() throws ParserConfigurationException { DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); DocumentType doctype = builder.getDOMImplementation().createDocumentType("html", "-//W3C//DTD XHTML 1.1//EN", "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"); doc = builder.getDOMImplementation().createDocument("http://www.w3.org/1999/xhtml", "html", doctype); head = doc.createElement("head"); Element meta = doc.createElement("meta"); meta.setAttribute("http-equiv", "content-type"); meta.setAttribute("content", "text/html;charset=utf-8"); head.appendChild(meta); title = doc.createElement("title"); title.setTextContent("PDF Document"); head.appendChild(title); globalStyle = doc.createElement("style"); globalStyle.setAttribute("type", "text/css"); //globalStyle.setTextContent(createGlobalStyle()); head.appendChild(globalStyle); body = doc.createElement("body"); Element root = doc.getDocumentElement(); root.appendChild(head); root.appendChild(body); }
java
protected void createDocument() throws ParserConfigurationException { DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); DocumentType doctype = builder.getDOMImplementation().createDocumentType("html", "-//W3C//DTD XHTML 1.1//EN", "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"); doc = builder.getDOMImplementation().createDocument("http://www.w3.org/1999/xhtml", "html", doctype); head = doc.createElement("head"); Element meta = doc.createElement("meta"); meta.setAttribute("http-equiv", "content-type"); meta.setAttribute("content", "text/html;charset=utf-8"); head.appendChild(meta); title = doc.createElement("title"); title.setTextContent("PDF Document"); head.appendChild(title); globalStyle = doc.createElement("style"); globalStyle.setAttribute("type", "text/css"); //globalStyle.setTextContent(createGlobalStyle()); head.appendChild(globalStyle); body = doc.createElement("body"); Element root = doc.getDocumentElement(); root.appendChild(head); root.appendChild(body); }
[ "protected", "void", "createDocument", "(", ")", "throws", "ParserConfigurationException", "{", "DocumentBuilderFactory", "builderFactory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "DocumentBuilder", "builder", "=", "builderFactory", ".", "newDocu...
Creates a new empty HTML document tree. @throws ParserConfigurationException
[ "Creates", "a", "new", "empty", "HTML", "document", "tree", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/pdfdom/PDFDomTree.java#L121-L146
train
radkovo/Pdf2Dom
src/main/java/org/fit/pdfdom/PDFDomTree.java
PDFDomTree.writeText
@Override public void writeText(PDDocument doc, Writer outputStream) throws IOException { try { DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); LSSerializer writer = impl.createLSSerializer(); LSOutput output = impl.createLSOutput(); writer.getDomConfig().setParameter("format-pretty-print", true); output.setCharacterStream(outputStream); createDOM(doc); writer.write(getDocument(), output); } catch (ClassCastException e) { throw new IOException("Error: cannot initialize the DOM serializer", e); } catch (ClassNotFoundException e) { throw new IOException("Error: cannot initialize the DOM serializer", e); } catch (InstantiationException e) { throw new IOException("Error: cannot initialize the DOM serializer", e); } catch (IllegalAccessException e) { throw new IOException("Error: cannot initialize the DOM serializer", e); } }
java
@Override public void writeText(PDDocument doc, Writer outputStream) throws IOException { try { DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); LSSerializer writer = impl.createLSSerializer(); LSOutput output = impl.createLSOutput(); writer.getDomConfig().setParameter("format-pretty-print", true); output.setCharacterStream(outputStream); createDOM(doc); writer.write(getDocument(), output); } catch (ClassCastException e) { throw new IOException("Error: cannot initialize the DOM serializer", e); } catch (ClassNotFoundException e) { throw new IOException("Error: cannot initialize the DOM serializer", e); } catch (InstantiationException e) { throw new IOException("Error: cannot initialize the DOM serializer", e); } catch (IllegalAccessException e) { throw new IOException("Error: cannot initialize the DOM serializer", e); } }
[ "@", "Override", "public", "void", "writeText", "(", "PDDocument", "doc", ",", "Writer", "outputStream", ")", "throws", "IOException", "{", "try", "{", "DOMImplementationRegistry", "registry", "=", "DOMImplementationRegistry", ".", "newInstance", "(", ")", ";", "D...
Parses a PDF document and serializes the resulting DOM tree to an output. This requires a DOM Level 3 capable implementation to be available.
[ "Parses", "a", "PDF", "document", "and", "serializes", "the", "resulting", "DOM", "tree", "to", "an", "output", ".", "This", "requires", "a", "DOM", "Level", "3", "capable", "implementation", "to", "be", "available", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/pdfdom/PDFDomTree.java#L183-L205
train
radkovo/Pdf2Dom
src/main/java/org/fit/pdfdom/PDFDomTree.java
PDFDomTree.createDOM
public Document createDOM(PDDocument doc) throws IOException { /* We call the original PDFTextStripper.writeText but nothing should be printed actually because our processing methods produce no output. They create the DOM structures instead */ super.writeText(doc, new OutputStreamWriter(System.out)); return this.doc; }
java
public Document createDOM(PDDocument doc) throws IOException { /* We call the original PDFTextStripper.writeText but nothing should be printed actually because our processing methods produce no output. They create the DOM structures instead */ super.writeText(doc, new OutputStreamWriter(System.out)); return this.doc; }
[ "public", "Document", "createDOM", "(", "PDDocument", "doc", ")", "throws", "IOException", "{", "/* We call the original PDFTextStripper.writeText but nothing should\n be printed actually because our processing methods produce no output.\n They create the DOM structures inste...
Loads a PDF document and creates a DOM tree from it. @param doc the source document @return a DOM Document representing the DOM tree @throws IOException
[ "Loads", "a", "PDF", "document", "and", "creates", "a", "DOM", "tree", "from", "it", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/pdfdom/PDFDomTree.java#L213-L220
train
radkovo/Pdf2Dom
src/main/java/org/fit/pdfdom/PDFDomTree.java
PDFDomTree.createPageElement
protected Element createPageElement() { String pstyle = ""; PDRectangle layout = getCurrentMediaBox(); if (layout != null) { /*System.out.println("x1 " + layout.getLowerLeftX()); System.out.println("y1 " + layout.getLowerLeftY()); System.out.println("x2 " + layout.getUpperRightX()); System.out.println("y2 " + layout.getUpperRightY()); System.out.println("rot " + pdpage.findRotation());*/ float w = layout.getWidth(); float h = layout.getHeight(); final int rot = pdpage.getRotation(); if (rot == 90 || rot == 270) { float x = w; w = h; h = x; } pstyle = "width:" + w + UNIT + ";" + "height:" + h + UNIT + ";"; pstyle += "overflow:hidden;"; } else log.warn("No media box found"); Element el = doc.createElement("div"); el.setAttribute("id", "page_" + (pagecnt++)); el.setAttribute("class", "page"); el.setAttribute("style", pstyle); return el; }
java
protected Element createPageElement() { String pstyle = ""; PDRectangle layout = getCurrentMediaBox(); if (layout != null) { /*System.out.println("x1 " + layout.getLowerLeftX()); System.out.println("y1 " + layout.getLowerLeftY()); System.out.println("x2 " + layout.getUpperRightX()); System.out.println("y2 " + layout.getUpperRightY()); System.out.println("rot " + pdpage.findRotation());*/ float w = layout.getWidth(); float h = layout.getHeight(); final int rot = pdpage.getRotation(); if (rot == 90 || rot == 270) { float x = w; w = h; h = x; } pstyle = "width:" + w + UNIT + ";" + "height:" + h + UNIT + ";"; pstyle += "overflow:hidden;"; } else log.warn("No media box found"); Element el = doc.createElement("div"); el.setAttribute("id", "page_" + (pagecnt++)); el.setAttribute("class", "page"); el.setAttribute("style", pstyle); return el; }
[ "protected", "Element", "createPageElement", "(", ")", "{", "String", "pstyle", "=", "\"\"", ";", "PDRectangle", "layout", "=", "getCurrentMediaBox", "(", ")", ";", "if", "(", "layout", "!=", "null", ")", "{", "/*System.out.println(\"x1 \" + layout.getLowerLeftX());...
Creates an element that represents a single page. @return the resulting DOM element
[ "Creates", "an", "element", "that", "represents", "a", "single", "page", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/pdfdom/PDFDomTree.java#L267-L298
train
radkovo/Pdf2Dom
src/main/java/org/fit/pdfdom/PDFDomTree.java
PDFDomTree.createTextElement
protected Element createTextElement(float width) { Element el = doc.createElement("div"); el.setAttribute("id", "p" + (textcnt++)); el.setAttribute("class", "p"); String style = curstyle.toString(); style += "width:" + width + UNIT + ";"; el.setAttribute("style", style); return el; }
java
protected Element createTextElement(float width) { Element el = doc.createElement("div"); el.setAttribute("id", "p" + (textcnt++)); el.setAttribute("class", "p"); String style = curstyle.toString(); style += "width:" + width + UNIT + ";"; el.setAttribute("style", style); return el; }
[ "protected", "Element", "createTextElement", "(", "float", "width", ")", "{", "Element", "el", "=", "doc", ".", "createElement", "(", "\"div\"", ")", ";", "el", ".", "setAttribute", "(", "\"id\"", ",", "\"p\"", "+", "(", "textcnt", "++", ")", ")", ";", ...
Creates an element that represents a single positioned box with no content. @return the resulting DOM element
[ "Creates", "an", "element", "that", "represents", "a", "single", "positioned", "box", "with", "no", "content", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/pdfdom/PDFDomTree.java#L304-L313
train
radkovo/Pdf2Dom
src/main/java/org/fit/pdfdom/PDFDomTree.java
PDFDomTree.createTextElement
protected Element createTextElement(String data, float width) { Element el = createTextElement(width); Text text = doc.createTextNode(data); el.appendChild(text); return el; }
java
protected Element createTextElement(String data, float width) { Element el = createTextElement(width); Text text = doc.createTextNode(data); el.appendChild(text); return el; }
[ "protected", "Element", "createTextElement", "(", "String", "data", ",", "float", "width", ")", "{", "Element", "el", "=", "createTextElement", "(", "width", ")", ";", "Text", "text", "=", "doc", ".", "createTextNode", "(", "data", ")", ";", "el", ".", "...
Creates an element that represents a single positioned box containing the specified text string. @param data the text string to be contained in the created box. @return the resulting DOM element
[ "Creates", "an", "element", "that", "represents", "a", "single", "positioned", "box", "containing", "the", "specified", "text", "string", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/pdfdom/PDFDomTree.java#L320-L326
train
radkovo/Pdf2Dom
src/main/java/org/fit/pdfdom/PDFDomTree.java
PDFDomTree.createRectangleElement
protected Element createRectangleElement(float x, float y, float width, float height, boolean stroke, boolean fill) { float lineWidth = transformWidth(getGraphicsState().getLineWidth()); float wcor = stroke ? lineWidth : 0.0f; float strokeOffset = wcor == 0 ? 0 : wcor / 2; width = width - wcor < 0 ? 1 : width - wcor; height = height - wcor < 0 ? 1 : height - wcor; StringBuilder pstyle = new StringBuilder(50); pstyle.append("left:").append(style.formatLength(x - strokeOffset)).append(';'); pstyle.append("top:").append(style.formatLength(y - strokeOffset)).append(';'); pstyle.append("width:").append(style.formatLength(width)).append(';'); pstyle.append("height:").append(style.formatLength(height)).append(';'); if (stroke) { String color = colorString(getGraphicsState().getStrokingColor()); pstyle.append("border:").append(style.formatLength(lineWidth)).append(" solid ").append(color).append(';'); } if (fill) { String fcolor = colorString(getGraphicsState().getNonStrokingColor()); pstyle.append("background-color:").append(fcolor).append(';'); } Element el = doc.createElement("div"); el.setAttribute("class", "r"); el.setAttribute("style", pstyle.toString()); el.appendChild(doc.createEntityReference("nbsp")); return el; }
java
protected Element createRectangleElement(float x, float y, float width, float height, boolean stroke, boolean fill) { float lineWidth = transformWidth(getGraphicsState().getLineWidth()); float wcor = stroke ? lineWidth : 0.0f; float strokeOffset = wcor == 0 ? 0 : wcor / 2; width = width - wcor < 0 ? 1 : width - wcor; height = height - wcor < 0 ? 1 : height - wcor; StringBuilder pstyle = new StringBuilder(50); pstyle.append("left:").append(style.formatLength(x - strokeOffset)).append(';'); pstyle.append("top:").append(style.formatLength(y - strokeOffset)).append(';'); pstyle.append("width:").append(style.formatLength(width)).append(';'); pstyle.append("height:").append(style.formatLength(height)).append(';'); if (stroke) { String color = colorString(getGraphicsState().getStrokingColor()); pstyle.append("border:").append(style.formatLength(lineWidth)).append(" solid ").append(color).append(';'); } if (fill) { String fcolor = colorString(getGraphicsState().getNonStrokingColor()); pstyle.append("background-color:").append(fcolor).append(';'); } Element el = doc.createElement("div"); el.setAttribute("class", "r"); el.setAttribute("style", pstyle.toString()); el.appendChild(doc.createEntityReference("nbsp")); return el; }
[ "protected", "Element", "createRectangleElement", "(", "float", "x", ",", "float", "y", ",", "float", "width", ",", "float", "height", ",", "boolean", "stroke", ",", "boolean", "fill", ")", "{", "float", "lineWidth", "=", "transformWidth", "(", "getGraphicsSta...
Creates an element that represents a rectangle drawn at the specified coordinates in the page. @param x the X coordinate of the rectangle @param y the Y coordinate of the rectangle @param width the width of the rectangle @param height the height of the rectangle @param stroke should there be a stroke around? @param fill should the rectangle be filled? @return the resulting DOM element
[ "Creates", "an", "element", "that", "represents", "a", "rectangle", "drawn", "at", "the", "specified", "coordinates", "in", "the", "page", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/pdfdom/PDFDomTree.java#L338-L369
train
radkovo/Pdf2Dom
src/main/java/org/fit/pdfdom/PDFDomTree.java
PDFDomTree.createLineElement
protected Element createLineElement(float x1, float y1, float x2, float y2) { HtmlDivLine line = new HtmlDivLine(x1, y1, x2, y2); String color = colorString(getGraphicsState().getStrokingColor()); StringBuilder pstyle = new StringBuilder(50); pstyle.append("left:").append(style.formatLength(line.getLeft())).append(';'); pstyle.append("top:").append(style.formatLength(line.getTop())).append(';'); pstyle.append("width:").append(style.formatLength(line.getWidth())).append(';'); pstyle.append("height:").append(style.formatLength(line.getHeight())).append(';'); pstyle.append(line.getBorderSide()).append(':').append(style.formatLength(line.getLineStrokeWidth())).append(" solid ").append(color).append(';'); if (line.getAngleDegrees() != 0) pstyle.append("transform:").append("rotate(").append(line.getAngleDegrees()).append("deg);"); Element el = doc.createElement("div"); el.setAttribute("class", "r"); el.setAttribute("style", pstyle.toString()); el.appendChild(doc.createEntityReference("nbsp")); return el; }
java
protected Element createLineElement(float x1, float y1, float x2, float y2) { HtmlDivLine line = new HtmlDivLine(x1, y1, x2, y2); String color = colorString(getGraphicsState().getStrokingColor()); StringBuilder pstyle = new StringBuilder(50); pstyle.append("left:").append(style.formatLength(line.getLeft())).append(';'); pstyle.append("top:").append(style.formatLength(line.getTop())).append(';'); pstyle.append("width:").append(style.formatLength(line.getWidth())).append(';'); pstyle.append("height:").append(style.formatLength(line.getHeight())).append(';'); pstyle.append(line.getBorderSide()).append(':').append(style.formatLength(line.getLineStrokeWidth())).append(" solid ").append(color).append(';'); if (line.getAngleDegrees() != 0) pstyle.append("transform:").append("rotate(").append(line.getAngleDegrees()).append("deg);"); Element el = doc.createElement("div"); el.setAttribute("class", "r"); el.setAttribute("style", pstyle.toString()); el.appendChild(doc.createEntityReference("nbsp")); return el; }
[ "protected", "Element", "createLineElement", "(", "float", "x1", ",", "float", "y1", ",", "float", "x2", ",", "float", "y2", ")", "{", "HtmlDivLine", "line", "=", "new", "HtmlDivLine", "(", "x1", ",", "y1", ",", "x2", ",", "y2", ")", ";", "String", "...
Create an element that represents a horizntal or vertical line. @param x1 @param y1 @param x2 @param y2 @return the created DOM element
[ "Create", "an", "element", "that", "represents", "a", "horizntal", "or", "vertical", "line", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/pdfdom/PDFDomTree.java#L379-L398
train
radkovo/Pdf2Dom
src/main/java/org/fit/pdfdom/PDFDomTree.java
PDFDomTree.createImageElement
protected Element createImageElement(float x, float y, float width, float height, ImageResource resource) throws IOException { StringBuilder pstyle = new StringBuilder("position:absolute;"); pstyle.append("left:").append(x).append(UNIT).append(';'); pstyle.append("top:").append(y).append(UNIT).append(';'); pstyle.append("width:").append(width).append(UNIT).append(';'); pstyle.append("height:").append(height).append(UNIT).append(';'); //pstyle.append("border:1px solid red;"); Element el = doc.createElement("img"); el.setAttribute("style", pstyle.toString()); String imgSrc = config.getImageHandler().handleResource(resource); if (!disableImageData && !imgSrc.isEmpty()) el.setAttribute("src", imgSrc); else el.setAttribute("src", ""); return el; }
java
protected Element createImageElement(float x, float y, float width, float height, ImageResource resource) throws IOException { StringBuilder pstyle = new StringBuilder("position:absolute;"); pstyle.append("left:").append(x).append(UNIT).append(';'); pstyle.append("top:").append(y).append(UNIT).append(';'); pstyle.append("width:").append(width).append(UNIT).append(';'); pstyle.append("height:").append(height).append(UNIT).append(';'); //pstyle.append("border:1px solid red;"); Element el = doc.createElement("img"); el.setAttribute("style", pstyle.toString()); String imgSrc = config.getImageHandler().handleResource(resource); if (!disableImageData && !imgSrc.isEmpty()) el.setAttribute("src", imgSrc); else el.setAttribute("src", ""); return el; }
[ "protected", "Element", "createImageElement", "(", "float", "x", ",", "float", "y", ",", "float", "width", ",", "float", "height", ",", "ImageResource", "resource", ")", "throws", "IOException", "{", "StringBuilder", "pstyle", "=", "new", "StringBuilder", "(", ...
Creates an element that represents an image drawn at the specified coordinates in the page. @param x the X coordinate of the image @param y the Y coordinate of the image @param width the width coordinate of the image @param height the height coordinate of the image @param type the image type: <code>"png"</code> or <code>"jpeg"</code> @param resource the image data depending on the specified type @return
[ "Creates", "an", "element", "that", "represents", "an", "image", "drawn", "at", "the", "specified", "coordinates", "in", "the", "page", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/pdfdom/PDFDomTree.java#L419-L439
train
radkovo/Pdf2Dom
src/main/java/org/fit/pdfdom/PDFDomTree.java
PDFDomTree.createGlobalStyle
protected String createGlobalStyle() { StringBuilder ret = new StringBuilder(); ret.append(createFontFaces()); ret.append("\n"); ret.append(defaultStyle); return ret.toString(); }
java
protected String createGlobalStyle() { StringBuilder ret = new StringBuilder(); ret.append(createFontFaces()); ret.append("\n"); ret.append(defaultStyle); return ret.toString(); }
[ "protected", "String", "createGlobalStyle", "(", ")", "{", "StringBuilder", "ret", "=", "new", "StringBuilder", "(", ")", ";", "ret", ".", "append", "(", "createFontFaces", "(", ")", ")", ";", "ret", ".", "append", "(", "\"\\n\"", ")", ";", "ret", ".", ...
Generate the global CSS style for the whole document. @return the CSS code used in the generated document header
[ "Generate", "the", "global", "CSS", "style", "for", "the", "whole", "document", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/pdfdom/PDFDomTree.java#L530-L537
train
radkovo/Pdf2Dom
src/main/java/org/fit/cssbox/pdf/PdfBrowserCanvas.java
PdfBrowserCanvas.createPdfLayout
public void createPdfLayout(Dimension dim) { if (pdfdocument != null) //processing a PDF document { try { if (createImage) img = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_RGB); Graphics2D ig = img.createGraphics(); log.info("Creating PDF boxes"); VisualContext ctx = new VisualContext(null, null); boxtree = new CSSBoxTree(ig, ctx, dim, baseurl); boxtree.setConfig(config); boxtree.processDocument(pdfdocument, startPage, endPage); viewport = boxtree.getViewport(); root = boxtree.getDocument().getDocumentElement(); log.info("We have " + boxtree.getLastId() + " boxes"); viewport.initSubtree(); log.info("Layout for "+dim.width+"px"); viewport.doLayout(dim.width, true, true); log.info("Resulting size: " + viewport.getWidth() + "x" + viewport.getHeight() + " (" + viewport + ")"); log.info("Updating viewport size"); viewport.updateBounds(dim); log.info("Resulting size: " + viewport.getWidth() + "x" + viewport.getHeight() + " (" + viewport + ")"); if (createImage && (viewport.getWidth() > dim.width || viewport.getHeight() > dim.height)) { img = new BufferedImage(Math.max(viewport.getWidth(), dim.width), Math.max(viewport.getHeight(), dim.height), BufferedImage.TYPE_INT_RGB); ig = img.createGraphics(); } log.info("Positioning for "+img.getWidth()+"x"+img.getHeight()+"px"); viewport.absolutePositions(); clearCanvas(); viewport.draw(new GraphicsRenderer(ig)); setPreferredSize(new Dimension(img.getWidth(), img.getHeight())); revalidate(); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } else if (root != null) //processing a DOM tree { super.createLayout(dim); } }
java
public void createPdfLayout(Dimension dim) { if (pdfdocument != null) //processing a PDF document { try { if (createImage) img = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_RGB); Graphics2D ig = img.createGraphics(); log.info("Creating PDF boxes"); VisualContext ctx = new VisualContext(null, null); boxtree = new CSSBoxTree(ig, ctx, dim, baseurl); boxtree.setConfig(config); boxtree.processDocument(pdfdocument, startPage, endPage); viewport = boxtree.getViewport(); root = boxtree.getDocument().getDocumentElement(); log.info("We have " + boxtree.getLastId() + " boxes"); viewport.initSubtree(); log.info("Layout for "+dim.width+"px"); viewport.doLayout(dim.width, true, true); log.info("Resulting size: " + viewport.getWidth() + "x" + viewport.getHeight() + " (" + viewport + ")"); log.info("Updating viewport size"); viewport.updateBounds(dim); log.info("Resulting size: " + viewport.getWidth() + "x" + viewport.getHeight() + " (" + viewport + ")"); if (createImage && (viewport.getWidth() > dim.width || viewport.getHeight() > dim.height)) { img = new BufferedImage(Math.max(viewport.getWidth(), dim.width), Math.max(viewport.getHeight(), dim.height), BufferedImage.TYPE_INT_RGB); ig = img.createGraphics(); } log.info("Positioning for "+img.getWidth()+"x"+img.getHeight()+"px"); viewport.absolutePositions(); clearCanvas(); viewport.draw(new GraphicsRenderer(ig)); setPreferredSize(new Dimension(img.getWidth(), img.getHeight())); revalidate(); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } else if (root != null) //processing a DOM tree { super.createLayout(dim); } }
[ "public", "void", "createPdfLayout", "(", "Dimension", "dim", ")", "{", "if", "(", "pdfdocument", "!=", "null", ")", "//processing a PDF document", "{", "try", "{", "if", "(", "createImage", ")", "img", "=", "new", "BufferedImage", "(", "dim", ".", "width", ...
Creates the box tree for the PDF file. @param dim
[ "Creates", "the", "box", "tree", "for", "the", "PDF", "file", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/cssbox/pdf/PdfBrowserCanvas.java#L154-L207
train
radkovo/Pdf2Dom
src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java
CSSBoxTree.createBlock
protected BlockBox createBlock(BlockBox parent, Element n, boolean replaced) { BlockBox root; if (replaced) { BlockReplacedBox rbox = new BlockReplacedBox((Element) n, (Graphics2D) parent.getGraphics().create(), parent.getVisualContext().create()); rbox.setViewport(viewport); rbox.setContentObj(new ReplacedImage(rbox, rbox.getVisualContext(), baseurl, n.getAttribute("src"))); root = rbox; } else { root = new BlockBox((Element) n, (Graphics2D) parent.getGraphics().create(), parent.getVisualContext().create()); root.setViewport(viewport); } root.setBase(baseurl); root.setParent(parent); root.setContainingBlockBox(parent); root.setClipBlock(viewport); root.setOrder(next_order++); return root; }
java
protected BlockBox createBlock(BlockBox parent, Element n, boolean replaced) { BlockBox root; if (replaced) { BlockReplacedBox rbox = new BlockReplacedBox((Element) n, (Graphics2D) parent.getGraphics().create(), parent.getVisualContext().create()); rbox.setViewport(viewport); rbox.setContentObj(new ReplacedImage(rbox, rbox.getVisualContext(), baseurl, n.getAttribute("src"))); root = rbox; } else { root = new BlockBox((Element) n, (Graphics2D) parent.getGraphics().create(), parent.getVisualContext().create()); root.setViewport(viewport); } root.setBase(baseurl); root.setParent(parent); root.setContainingBlockBox(parent); root.setClipBlock(viewport); root.setOrder(next_order++); return root; }
[ "protected", "BlockBox", "createBlock", "(", "BlockBox", "parent", ",", "Element", "n", ",", "boolean", "replaced", ")", "{", "BlockBox", "root", ";", "if", "(", "replaced", ")", "{", "BlockReplacedBox", "rbox", "=", "new", "BlockReplacedBox", "(", "(", "Ele...
Creates a new block box from the given element with the given parent. No style is assigned to the resulting box. @param parent The parent box in the tree of boxes. @param n The element that this box belongs to. @param replaced When set to <code>true</code>, a replaced block box will be created. Otherwise, a normal non-replaced block will be created. @return The new block box.
[ "Creates", "a", "new", "block", "box", "from", "the", "given", "element", "with", "the", "given", "parent", ".", "No", "style", "is", "assigned", "to", "the", "resulting", "box", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java#L286-L307
train
radkovo/Pdf2Dom
src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java
CSSBoxTree.createTextBox
protected TextBox createTextBox(BlockBox contblock, Text n) { TextBox text = new TextBox(n, (Graphics2D) contblock.getGraphics().create(), contblock.getVisualContext().create()); text.setOrder(next_order++); text.setContainingBlockBox(contblock); text.setClipBlock(contblock); text.setViewport(viewport); text.setBase(baseurl); return text; }
java
protected TextBox createTextBox(BlockBox contblock, Text n) { TextBox text = new TextBox(n, (Graphics2D) contblock.getGraphics().create(), contblock.getVisualContext().create()); text.setOrder(next_order++); text.setContainingBlockBox(contblock); text.setClipBlock(contblock); text.setViewport(viewport); text.setBase(baseurl); return text; }
[ "protected", "TextBox", "createTextBox", "(", "BlockBox", "contblock", ",", "Text", "n", ")", "{", "TextBox", "text", "=", "new", "TextBox", "(", "n", ",", "(", "Graphics2D", ")", "contblock", ".", "getGraphics", "(", ")", ".", "create", "(", ")", ",", ...
Creates a text box with the given parent and text node assigned. @param contblock The parent node (and the containing block in the same time) @param n The corresponding text node in the DOM tree. @return The new text box.
[ "Creates", "a", "text", "box", "with", "the", "given", "parent", "and", "text", "node", "assigned", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java#L315-L324
train
radkovo/Pdf2Dom
src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java
CSSBoxTree.createBlockStyle
protected NodeData createBlockStyle() { NodeData ret = CSSFactory.createNodeData(); TermFactory tf = CSSFactory.getTermFactory(); ret.push(createDeclaration("display", tf.createIdent("block"))); return ret; }
java
protected NodeData createBlockStyle() { NodeData ret = CSSFactory.createNodeData(); TermFactory tf = CSSFactory.getTermFactory(); ret.push(createDeclaration("display", tf.createIdent("block"))); return ret; }
[ "protected", "NodeData", "createBlockStyle", "(", ")", "{", "NodeData", "ret", "=", "CSSFactory", ".", "createNodeData", "(", ")", ";", "TermFactory", "tf", "=", "CSSFactory", ".", "getTermFactory", "(", ")", ";", "ret", ".", "push", "(", "createDeclaration", ...
Creates an empty block style definition. @return
[ "Creates", "an", "empty", "block", "style", "definition", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java#L400-L406
train
radkovo/Pdf2Dom
src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java
CSSBoxTree.createBodyStyle
protected NodeData createBodyStyle() { NodeData ret = createBlockStyle(); TermFactory tf = CSSFactory.getTermFactory(); ret.push(createDeclaration("background-color", tf.createColor(255, 255, 255))); return ret; }
java
protected NodeData createBodyStyle() { NodeData ret = createBlockStyle(); TermFactory tf = CSSFactory.getTermFactory(); ret.push(createDeclaration("background-color", tf.createColor(255, 255, 255))); return ret; }
[ "protected", "NodeData", "createBodyStyle", "(", ")", "{", "NodeData", "ret", "=", "createBlockStyle", "(", ")", ";", "TermFactory", "tf", "=", "CSSFactory", ".", "getTermFactory", "(", ")", ";", "ret", ".", "push", "(", "createDeclaration", "(", "\"background...
Creates a style definition used for the body element. @return The body style definition.
[ "Creates", "a", "style", "definition", "used", "for", "the", "body", "element", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java#L412-L418
train
radkovo/Pdf2Dom
src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java
CSSBoxTree.createPageStyle
protected NodeData createPageStyle() { NodeData ret = createBlockStyle(); TermFactory tf = CSSFactory.getTermFactory(); ret.push(createDeclaration("position", tf.createIdent("relative"))); ret.push(createDeclaration("border-width", tf.createLength(1f, Unit.px))); ret.push(createDeclaration("border-style", tf.createIdent("solid"))); ret.push(createDeclaration("border-color", tf.createColor(0, 0, 255))); ret.push(createDeclaration("margin", tf.createLength(0.5f, Unit.em))); PDRectangle layout = getCurrentMediaBox(); if (layout != null) { float w = layout.getWidth(); float h = layout.getHeight(); final int rot = pdpage.getRotation(); if (rot == 90 || rot == 270) { float x = w; w = h; h = x; } ret.push(createDeclaration("width", tf.createLength(w, unit))); ret.push(createDeclaration("height", tf.createLength(h, unit))); } else log.warn("No media box found"); return ret; }
java
protected NodeData createPageStyle() { NodeData ret = createBlockStyle(); TermFactory tf = CSSFactory.getTermFactory(); ret.push(createDeclaration("position", tf.createIdent("relative"))); ret.push(createDeclaration("border-width", tf.createLength(1f, Unit.px))); ret.push(createDeclaration("border-style", tf.createIdent("solid"))); ret.push(createDeclaration("border-color", tf.createColor(0, 0, 255))); ret.push(createDeclaration("margin", tf.createLength(0.5f, Unit.em))); PDRectangle layout = getCurrentMediaBox(); if (layout != null) { float w = layout.getWidth(); float h = layout.getHeight(); final int rot = pdpage.getRotation(); if (rot == 90 || rot == 270) { float x = w; w = h; h = x; } ret.push(createDeclaration("width", tf.createLength(w, unit))); ret.push(createDeclaration("height", tf.createLength(h, unit))); } else log.warn("No media box found"); return ret; }
[ "protected", "NodeData", "createPageStyle", "(", ")", "{", "NodeData", "ret", "=", "createBlockStyle", "(", ")", ";", "TermFactory", "tf", "=", "CSSFactory", ".", "getTermFactory", "(", ")", ";", "ret", ".", "push", "(", "createDeclaration", "(", "\"position\"...
Creates a style definition used for pages. @return The page style definition.
[ "Creates", "a", "style", "definition", "used", "for", "pages", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java#L424-L452
train
radkovo/Pdf2Dom
src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java
CSSBoxTree.createRectangleStyle
protected NodeData createRectangleStyle(float x, float y, float width, float height, boolean stroke, boolean fill) { float lineWidth = transformLength((float) getGraphicsState().getLineWidth()); float lw = (lineWidth < 1f) ? 1f : lineWidth; float wcor = stroke ? lw : 0.0f; NodeData ret = CSSFactory.createNodeData(); TermFactory tf = CSSFactory.getTermFactory(); ret.push(createDeclaration("position", tf.createIdent("absolute"))); ret.push(createDeclaration("left", tf.createLength(x, unit))); ret.push(createDeclaration("top", tf.createLength(y, unit))); ret.push(createDeclaration("width", tf.createLength(width - wcor, unit))); ret.push(createDeclaration("height", tf.createLength(height - wcor, unit))); if (stroke) { ret.push(createDeclaration("border-width", tf.createLength(lw, unit))); ret.push(createDeclaration("border-style", tf.createIdent("solid"))); String color = colorString(getGraphicsState().getStrokingColor()); ret.push(createDeclaration("border-color", tf.createColor(color))); } if (fill) { String color = colorString(getGraphicsState().getNonStrokingColor()); if (color != null) ret.push(createDeclaration("background-color", tf.createColor(color))); } return ret; }
java
protected NodeData createRectangleStyle(float x, float y, float width, float height, boolean stroke, boolean fill) { float lineWidth = transformLength((float) getGraphicsState().getLineWidth()); float lw = (lineWidth < 1f) ? 1f : lineWidth; float wcor = stroke ? lw : 0.0f; NodeData ret = CSSFactory.createNodeData(); TermFactory tf = CSSFactory.getTermFactory(); ret.push(createDeclaration("position", tf.createIdent("absolute"))); ret.push(createDeclaration("left", tf.createLength(x, unit))); ret.push(createDeclaration("top", tf.createLength(y, unit))); ret.push(createDeclaration("width", tf.createLength(width - wcor, unit))); ret.push(createDeclaration("height", tf.createLength(height - wcor, unit))); if (stroke) { ret.push(createDeclaration("border-width", tf.createLength(lw, unit))); ret.push(createDeclaration("border-style", tf.createIdent("solid"))); String color = colorString(getGraphicsState().getStrokingColor()); ret.push(createDeclaration("border-color", tf.createColor(color))); } if (fill) { String color = colorString(getGraphicsState().getNonStrokingColor()); if (color != null) ret.push(createDeclaration("background-color", tf.createColor(color))); } return ret; }
[ "protected", "NodeData", "createRectangleStyle", "(", "float", "x", ",", "float", "y", ",", "float", "width", ",", "float", "height", ",", "boolean", "stroke", ",", "boolean", "fill", ")", "{", "float", "lineWidth", "=", "transformLength", "(", "(", "float",...
Creates the style definition used for a rectangle element based on the given properties of the rectangle @param x The X coordinate of the rectangle. @param y The Y coordinate of the rectangle. @param width The width of the rectangle. @param height The height of the rectangle. @param stroke Should there be a stroke around? @param fill Should the rectangle be filled? @return The resulting element style definition.
[ "Creates", "the", "style", "definition", "used", "for", "a", "rectangle", "element", "based", "on", "the", "given", "properties", "of", "the", "rectangle" ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java#L464-L494
train
radkovo/Pdf2Dom
src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java
CSSBoxTree.createDeclaration
protected Declaration createDeclaration(String property, Term<?> term) { Declaration d = CSSFactory.getRuleFactory().createDeclaration(); d.unlock(); d.setProperty(property); d.add(term); return d; }
java
protected Declaration createDeclaration(String property, Term<?> term) { Declaration d = CSSFactory.getRuleFactory().createDeclaration(); d.unlock(); d.setProperty(property); d.add(term); return d; }
[ "protected", "Declaration", "createDeclaration", "(", "String", "property", ",", "Term", "<", "?", ">", "term", ")", "{", "Declaration", "d", "=", "CSSFactory", ".", "getRuleFactory", "(", ")", ".", "createDeclaration", "(", ")", ";", "d", ".", "unlock", "...
Creates a single property declaration. @param property Property name. @param term Property value. @return The resulting declaration.
[ "Creates", "a", "single", "property", "declaration", "." ]
12e52b80eca7f57fc41e6ed895bf1db72c38da53
https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/cssbox/pdf/CSSBoxTree.java#L531-L538
train