本文整理汇总了Java中net.meisen.general.genmisc.types.Objects.empty方法的典型用法代码示例。如果您正苦于以下问题:Java Objects.empty方法的具体用法?Java Objects.empty怎么用?Java Objects.empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.meisen.general.genmisc.types.Objects
的用法示例。
在下文中一共展示了Objects.empty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMember
import net.meisen.general.genmisc.types.Objects; //导入方法依赖的package包/类
/**
* Gets the member defined within the {@code SelectorMemberContext}.
*
* @param selMember
* the context to read the member from
*
* @return the {@code DimensionSelector} defined by the context
*/
protected DimensionSelector getMember(final SelectorMemberContext selMember) {
final int childrenSize = selMember.getChildCount();
if (childrenSize != 5) {
throw new ForwardedRuntimeException(QueryParsingException.class,
1022, selMember.getText());
}
final String dimId = selMember.getChild(TerminalNode.class, 0)
.getText();
final String hierarchyId = selMember.getChild(TerminalNode.class, 2)
.getText();
final String levelId = selMember.getChild(TerminalNode.class, 4)
.getText();
// make sure none is empty
if (Objects.empty(dimId) || Objects.empty(hierarchyId)
|| Objects.empty(levelId)) {
throw new ForwardedRuntimeException(QueryParsingException.class,
1022, selMember.getText());
}
return new DimensionSelector(dimId, hierarchyId, levelId);
}
示例2: setXsltTransformer
import net.meisen.general.genmisc.types.Objects; //导入方法依赖的package包/类
/**
* This method is used to set the transformer to be used for the
* transformation. It reads the transformer from the passed
* <code>xsltClassPath</code>.
*
* @param xsltClassPath
* the <code>String</code> pointing to the XSLT on the classpath
*
* @throws InvalidXsltException
* if the XSLT cannot be found on the classpath, the XSLT is
* invalid, ...
*/
public void setXsltTransformer(final String xsltClassPath)
throws InvalidXsltException {
if (Objects.empty(xsltClassPath)) {
setXsltTransformer((InputStream) null);
} else {
try {
setXsltTransformer(new ClassPathResource(xsltClassPath)
.getInputStream());
} catch (final IOException e) {
throw new InvalidXsltException(
"The xslt could not be read from the classpath '"
+ xsltClassPath + "'", e);
}
}
}
示例3: setXsltTransformer
import net.meisen.general.genmisc.types.Objects; //导入方法依赖的package包/类
/**
* This method is used to set the transformer to be used for the
* transformation. It reads the transformer from the passed
* <code>xsltClassPath</code>.
*
* @param xsltClassPath
* the <code>String</code> pointing to the XSLT on the classpath
*
* @throws InvalidXsltException
* if the XSLT cannot be found on the classpath, the XSLT is
* invalid, ...
*/
public void setXsltTransformer(final String xsltClassPath)
throws InvalidXsltException {
if (Objects.empty(xsltClassPath)) {
setXsltTransformer((InputStream) null);
} else {
try {
setXsltTransformer(new ClassPathResource(xsltClassPath)
.getInputStream());
} catch (final IOException e) {
throw new InvalidXsltException(
"The xslt stream could not be read.", e);
}
}
}
示例4: registerModuleBeanDefinition
import net.meisen.general.genmisc.types.Objects; //导入方法依赖的package包/类
/**
* Registers a single <code>beanDefinition</code> to be loaded for the
* <code>Configuration</code>.
*
* @param id
* the <code>beanDefinition</code>'s identifier
* @param beanDefinition
* the <code>BeanDefinition</code> instance to be registered
* @param loaderId
* the loader's identifier for logging purposes
*/
protected void registerModuleBeanDefinition(final String id,
final BeanDefinition beanDefinition, final String loaderId) {
// register the module
if (Objects.empty(beanDefinition) || Objects.empty(id)) {
throw new IllegalArgumentException("The id ('" + id
+ "') or the beanDefinition cannot be null.");
}
// in the case of an anonymous id we should never override
if (isAnonymousId(id) && moduleDefinitions.containsKey(id)) {
moduleDefinitions.put(UUID.randomUUID().toString() + "_" + id,
beanDefinition);
} else if (moduleDefinitions.put(id, beanDefinition) != null) {
if (LOG.isWarnEnabled()) {
LOG.warn("Overloading the moduleDefinition '" + id
+ "' with the one from the loaderDefinition '"
+ loaderId + "'");
}
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Added the moduleDefinition '" + id
+ "' from loaderDefinition '" + loaderId + "'");
}
}
}
示例5: setLocationSelectors
import net.meisen.general.genmisc.types.Objects; //导入方法依赖的package包/类
/**
* Defines several selectors for <code>this</code> instance. All other
* pre-defined selectors are removed.
*
* @param locationSelectors
* the array of selectors to use
*/
public void setLocationSelectors(final String[] locationSelectors) {
// nothing to do if we don't have anything defined
if (locationSelectors == null || locationSelectors.length < 1) {
return;
}
// create a list of all the locations
final Set<Resource> locations = new LinkedHashSet<Resource>();
// get through each locationSelector
for (final String locationSelector : locationSelectors) {
// check the locationSelector
if (Objects.empty(locationSelector)) {
if (LOG.isWarnEnabled()) {
LOG.warn("The specified locationSelector is empty and therefore cannot be resolved");
}
continue;
}
// resolve the selector
final Collection<ResourceInfo> resInfos = net.meisen.general.genmisc.resources.Resource
.getResources(locationSelector, true, false);
if (LOG.isTraceEnabled()) {
LOG.trace("Found '" + resInfos.size()
+ "' properties to be loaded by the selector: '"
+ locationSelector + "'"
+ (resInfos.size() > 0 ? " (" + resInfos + ")" : ""));
}
// get all the found resource infos
for (final ResourceInfo resInfo : resInfos) {
// make sure we have a file
if (!resInfo.isFile()) {
if (LOG.isInfoEnabled()) {
LOG.info("Skipping resource '"
+ resInfo
+ "', it was selected by the propertySelector, but isn't a file.");
}
continue;
}
// get the InputStream
final InputStream resIo = net.meisen.general.genmisc.resources.Resource
.getResourceAsStream(resInfo);
// transform the stream to a byte-array
try {
final byte[] byteArray = Streams
.copyStreamToByteArray(resIo);
locations.add(new ByteArrayResource(byteArray));
} catch (final IOException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Skipping resource '" + resInfo
+ "', unable to access the resource.", e);
}
}
}
}
// set the loaded locations
setLocations(locations.toArray(new Resource[] {}));
}