code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
protected ActiveParticipantType addActiveParticipant(String userID, String altUserID, String userName,
Boolean userIsRequestor, List<CodedValueType> roleIdCodes, String networkAccessPointID) {
// Does lookup to see if using IP Address or hostname in Netwo... | java |
protected RFC3881NetworkAccessPointTypeCodes getNetworkAccessPointCodeFromAddress(String address) {
if (EventUtils.isEmptyOrNull(address)) {
return null;
}
if (address.matches("^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$")) {
return RFC3881NetworkAccessPointTypeC... | java |
public static XCPDInitiatingGatewayAuditor getAuditor()
{
AuditorModuleContext ctx = AuditorModuleContext.getContext();
return (XCPDInitiatingGatewayAuditor)ctx.getAuditor(XCPDInitiatingGatewayAuditor.class);
} | java |
public void auditXCPDQueryEvent(RFC3881EventOutcomeCodes eventOutcome, String sourceUserId,
String humanRequestorUserId, CodedValueType humanRequestorRoleIdCode,
String XCPDRGUri, String homeCommunityId, String queryByParameter,
List<CodedValueType> purposesOfUse)
{
if (!isAuditorEnabled()) {
re... | java |
public static SVSConsumerAuditor getAuditor()
{
AuditorModuleContext ctx = AuditorModuleContext.getContext();
return (SVSConsumerAuditor)ctx.getAuditor(SVSConsumerAuditor.class);
} | java |
public void auditRetrieveValueSetEvent(RFC3881EventOutcomeCodes eventOutcome,
String repositoryEndpointUri,
String valueSetUniqueId, String valueSetName,
String valueSetVersion,
List<CodedValueType> purposesOfUse,
List<CodedValueType> userRoles)
{
if (!isAuditorEnabled()) {
return;
}
... | java |
public static void main(String[] args) {
try {
// Parse arguments: homeDir keyCount
File homeDir = new File(args[0]);
int initialCapacity = Integer.parseInt(args[1]);
// Create an instance of Krati DataStore
KratiDataStore store = new Krat... | java |
protected byte[] getTransportPayload(AuditEventMessage msg) throws UnsupportedEncodingException
{
if (msg == null) {
return null;
}
byte[] msgBytes = msg.getSerializedMessage(false);
if (EventUtils.isEmptyOrNull(msgBytes)) {
return null;
}
// Format message with transport-specific headers
Str... | java |
private String getSystemHostName()
{
if (EventUtils.isEmptyOrNull(systemHostName)) {
try {
systemHostName = InetAddress.getLocalHost().getHostName();
} catch (Throwable t) {
systemHostName = "localhost";
}
}
return systemHostName;
} | java |
private long fourByteToLong(byte[] bytes, int offset) {
return (byteToLong(bytes[offset + 0])
+ (byteToLong(bytes[offset + 1]) << 8)
+ (byteToLong(bytes[offset + 2]) << 16)
+ (byteToLong(bytes[offset + 3]) << 24));
} | java |
private void hashMix() {
a = subtract(a, b); a = subtract(a, c); a = xor(a, c >> 13);
b = subtract(b, c); b = subtract(b, a); b = xor(b, leftShift(a, 8));
c = subtract(c, a); c = subtract(c, b); c = xor(c, (b >> 13));
a = subtract(a, b); a = subtract(a, c); a = xor(a, (c >> 12));
b = ... | java |
public long hash(byte[] buffer, long initialValue) {
int len, pos;
// set up the internal state
// the golden ratio; an arbitrary value
a = 0x09e3779b9L;
// the golden ratio; an arbitrary value
b = 0x09e3779b9L;
// the previous hash value
c = init... | java |
public XmlSchemaComplexType createXmlSchemaComplexType(
final XsdDataItem xsdDataItem) {
// All complex types are root complex types
XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType(
getXsd(), true);
XmlSchemaChoice xmlSchemaChoice = null;
... | java |
public XmlSchemaElement createXmlSchemaElement(final XsdDataItem xsdDataItem) {
// Let call add root elements if he needs to so for now pretend this is
// not a root element
XmlSchemaElement element = new XmlSchemaElement(getXsd(), false);
element.setName(xsdDataItem.getXsdElementName()... | java |
protected void addEnumerationFacets(final XsdDataItem xsdDataItem,
final XmlSchemaSimpleTypeRestriction restriction) {
if (getConfig().mapConditionsToFacets()) {
boolean hasValueThru = false;
for (XsdDataItem child : xsdDataItem.getChildren()) {
if (child.getD... | java |
protected XmlSchemaSimpleType createXmlSchemaSimpleType(
final XmlSchemaSimpleTypeRestriction restriction) {
XmlSchemaSimpleType xmlSchemaSimpleType = new XmlSchemaSimpleType(
getXsd(), false);
xmlSchemaSimpleType.setContent(restriction);
return xmlSchemaSimpleType;
... | java |
protected XmlSchemaSimpleTypeRestriction createRestriction(
final String xsdTypeName) {
XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
restriction.setBaseTypeName(new QName(
XMLConstants.W3C_XML_SCHEMA_NS_URI, xsdTypeName));
return ... | java |
protected XmlSchemaMaxLengthFacet createMaxLengthFacet(final int length) {
XmlSchemaMaxLengthFacet xmlSchemaMaxLengthFacet = new XmlSchemaMaxLengthFacet();
xmlSchemaMaxLengthFacet.setValue(length);
return xmlSchemaMaxLengthFacet;
} | java |
protected XmlSchemaPatternFacet createPatternFacet(final String pattern) {
XmlSchemaPatternFacet xmlSchemaPatternFacet = new XmlSchemaPatternFacet();
xmlSchemaPatternFacet.setValue(pattern);
return xmlSchemaPatternFacet;
} | java |
protected XmlSchemaEnumerationFacet createEnumerationFacet(
final String conditionValue) {
XmlSchemaEnumerationFacet xmlSchemaEnumerationFacet = new XmlSchemaEnumerationFacet();
xmlSchemaEnumerationFacet.setValue(conditionValue);
return xmlSchemaEnumerationFacet;
} | java |
protected XmlSchemaTotalDigitsFacet createTotalDigitsFacet(
final int totalDigits) {
XmlSchemaTotalDigitsFacet xmlSchemaTotalDigitsFacet = new XmlSchemaTotalDigitsFacet();
xmlSchemaTotalDigitsFacet.setValue(totalDigits);
return xmlSchemaTotalDigitsFacet;
} | java |
protected XmlSchemaFractionDigitsFacet createFractionDigitsFacet(
final int fractionDigits) {
XmlSchemaFractionDigitsFacet xmlSchemaFractionDigitsFacet = new XmlSchemaFractionDigitsFacet();
xmlSchemaFractionDigitsFacet.setValue(fractionDigits);
return xmlSchemaFractionDigitsFacet;
... | java |
protected XmlSchemaMinInclusiveFacet createMinInclusiveFacet(
final String minInclusive) {
XmlSchemaMinInclusiveFacet xmlSchemaMinInclusiveFacet = new XmlSchemaMinInclusiveFacet();
xmlSchemaMinInclusiveFacet.setValue(minInclusive);
return xmlSchemaMinInclusiveFacet;
} | java |
protected XmlSchemaMaxInclusiveFacet createMaxInclusiveFacet(
final String maxInclusive) {
XmlSchemaMaxInclusiveFacet xmlSchemaMaxInclusiveFacet = new XmlSchemaMaxInclusiveFacet();
xmlSchemaMaxInclusiveFacet.setValue(maxInclusive);
return xmlSchemaMaxInclusiveFacet;
} | java |
@Override
public int read(SegmentIndexBuffer sib, File sibFile) throws IOException {
check(sibFile);
RandomAccessFile raf = new RandomAccessFile(sibFile, "r");
FileChannel channel = raf.getChannel();
readVersion(channel);
int length = sib.read(channel);
... | java |
@Override
public int write(SegmentIndexBuffer sib, File sibFile) throws IOException {
create(sibFile);
RandomAccessFile raf = new RandomAccessFile(sibFile, "rw");
FileChannel channel = raf.getChannel();
writeVersion(channel);
int length = sib.write(channel);... | java |
protected int readVersion(ReadableByteChannel channel) throws IOException {
ByteBuffer version = ByteBuffer.allocate(STORAGE_VERSION_LENGTH);
int len = channel.read(version);
if (len < STORAGE_VERSION_LENGTH) {
throw new IOException("Invalid Version");
}
return versio... | java |
protected void writeVersion(WritableByteChannel channel) throws IOException {
ByteBuffer version = ByteBuffer.allocate(STORAGE_VERSION_LENGTH);
version.putInt(STORAGE_VERSION);
version.flip();
channel.write(version);
} | java |
protected void create(File file) throws IOException {
if(!file.exists()) {
File dir = file.getParentFile();
if(dir.exists()) file.createNewFile();
else if(dir.mkdirs()) file.createNewFile();
else throw new IOException("Failed to create " + file.getAbsolutePath());... | java |
protected void check(File file) throws IOException {
if(!file.exists()) {
throw new FileNotFoundException(file.getAbsolutePath());
}
if(file.isDirectory()) {
throw new IOException("Cannot open directory " + file.getAbsolutePath());
}
} | java |
public static PAMSourceAuditor getAuditor()
{
AuditorModuleContext ctx = AuditorModuleContext.getContext();
return (PAMSourceAuditor)ctx.getAuditor(PAMSourceAuditor.class);
} | java |
public void add(int pos, long val, long scn) {
if (_index < _entryCapacity) {
_valArray.get(_index++).reinit(pos, val, scn);
maintainScn(scn);
} else {
throw new EntryOverflowException();
}
} | java |
public final void save(File file) throws IOException {
_entryFile = file;
Chronos c = new Chronos();
DataWriter out = new FastDataWriter(file);
try {
out.open();
// Save entry head
out.writeLong(STORAGE_VERSION); // write the entry file version
... | java |
public void load(File file) throws IOException {
_entryFile = file;
Chronos c = new Chronos();
ChannelReader in = new ChannelReader(file);
try {
in.open();
// Read entry head
long fileVersion = in.readLong();
if (fileVersion != STORAGE_VE... | java |
public CodedValueType getAuditSourceTypeCode() {
if (EventUtils.isEmptyOrNull(auditSourceTypeCode)) {
return null;
}
AuditSourceType auditSourceType = auditSourceTypeCode.get(0);
CodedValueType codedValueType = new CodedValueType();
codedValueType.setCode(auditSourceT... | java |
public void setAuditSourceTypeCode(CodedValueType auditSourceTypeCode) {
AuditSourceType auditSourceType = new AuditSourceType();
auditSourceType.setCode(auditSourceTypeCode.getCode());
auditSourceType.setCodeSystem(auditSourceTypeCode.getCodeSystem());
auditSourceType.setCodeSystemName(... | java |
public static int getCacheSize(Context ctx) {
final DisplayMetrics displayMetrics = ctx.getResources().
getDisplayMetrics();
final int screenWidth = displayMetrics.widthPixels;
final int screenHeight = displayMetrics.heightPixels;
// 4 bytes per pixel
final int screenBytes = screenWidth * screenHeight * 4... | java |
public static AuditRecordRepositoryAuditor getAuditor()
{
AuditorModuleContext ctx = AuditorModuleContext.getContext();
return (AuditRecordRepositoryAuditor)ctx.getAuditor(AuditRecordRepositoryAuditor.class);
} | java |
public void auditAuditLogUsed(RFC3881EventOutcomeCodes eventOutcome,
String accessingUser, String accessingProcess,
String auditLogUri)
{
if (!isAuditorEnabled()) {
return;
}
AuditLogUsedEvent auditLogUsedEvent = new AuditLogUsedEvent(eventOutcome);
auditLogUsedEvent.setAuditSourceId(getAuditSourceId(... | java |
public static <T extends EntryValue> void sortEntriesById(List<Entry<T>> entryList) {
if (entryList.size() > 0) {
Collections.sort(entryList, new Comparator<Entry<?>>() {
@Override
public int compare(Entry<?> e1, Entry<?> e2) {
long v1 = getEntryId... | java |
public static long getEntryId(String entryFileName) {
int ind1 = entryFileName.indexOf("_") + 1;
if (ind1 > 0) {
int ind2 = entryFileName.indexOf("_", ind1);
if (ind2 > ind1) {
String str = entryFileName.substring(ind1, ind2);
try {
... | java |
private void send(byte[] msg, DatagramSocket socket, InetAddress destination, int port) throws Exception
{
if (EventUtils.isEmptyOrNull(msg)) {
return;
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Auditing to " + destination.getHostAddress() + ":" + port);
}
if (LO... | java |
private void send(AuditEventMessage msg, DatagramSocket socket, InetAddress destination, int port) throws Exception
{
if (EventUtils.isEmptyOrNull(msg)) {
return;
}
// Check to validate port
int portToUse = getTransportPort(port);
// Serialize and format event message for syslog
byte[] msgBytes = get... | java |
protected byte[] getTransportPayload(AuditEventMessage msg)
{
if (msg == null) {
return null;
}
byte[] msgBytes = msg.getSerializedMessage(false);
if (EventUtils.isEmptyOrNull(msgBytes)) {
return null;
}
// Format message with transport-specific headers
StringBuilder sb = new StringBuilder();... | java |
protected void loadWaterMarks() throws IOException {
// Load source water marks from file
if (file != null && file.exists()) {
try {
loadWaterMarks(file);
} catch (IOException e) {
if (fileOriginal != null && fileOriginal.exists()) {
... | java |
protected void loadWaterMarks(File waterMarksFile) throws IOException {
Properties p = new Properties();
FileInputStream fis = new FileInputStream(waterMarksFile);
logger.info("Loading " + waterMarksFile);
try {
p.load(fis);
Enumeration<?> enm = p.propertyNames... | java |
public long getHWMScn(String source) {
WaterMarkEntry e = sourceWaterMarkMap.get(source);
return (e == null) ? 0 : e.getHWMScn();
} | java |
public long getLWMScn(String source) {
WaterMarkEntry e = sourceWaterMarkMap.get(source);
return (e == null) ? 0 : e.getLWMScn();
} | java |
public void setLWMScn(String source, long scn) {
WaterMarkEntry e = sourceWaterMarkMap.get(source);
if (e == null) {
e = new WaterMarkEntry(source);
sourceWaterMarkMap.put(source, e);
}
e.setLWMScn(scn);
} | java |
public void setWaterMarks(String source, long lwmScn, long hwmScn) {
WaterMarkEntry e = sourceWaterMarkMap.get(source);
if (e == null) {
e = new WaterMarkEntry(source);
sourceWaterMarkMap.put(source, e);
}
e.setLWMScn(lwmScn);
e.setHWMScn(hwmScn);
} | java |
public boolean syncWaterMarks(String source, long lwmScn, long hwmScn) {
setWaterMarks(source, lwmScn, hwmScn);
return flush();
} | java |
public boolean syncWaterMarks() {
// Sync up low water marks
for (String source : sourceWaterMarkMap.keySet()) {
WaterMarkEntry wmEntry = sourceWaterMarkMap.get(source);
wmEntry.setLWMScn(wmEntry.getHWMScn());
}
return flush();
} | java |
public boolean flush() {
boolean ret = true;
PrintWriter out = null;
// Save source water marks
try {
// Backup the original file
if (file.exists()) {
if (fileOriginal.exists()) {
fileOriginal.delete();
... | java |
public void clear() {
sourceWaterMarkMap.clear();
flush();
if (fileOriginal != null && fileOriginal.exists()) {
fileOriginal.delete();
}
} | java |
synchronized void loadImageIfNecessary(final boolean isInLayoutPass) {
int width = getWidth();
int height = getHeight();
boolean wrapWidth = false, wrapHeight = false;
if (getLayoutParams() != null) {
wrapWidth = getLayoutParams().width == LayoutParams.WRAP_CONTENT;
... | java |
public static PIXManagerAuditor getAuditor()
{
AuditorModuleContext ctx = AuditorModuleContext.getContext();
return (PIXManagerAuditor)ctx.getAuditor(PIXManagerAuditor.class);
} | java |
private String getAnnotations(final Properties properties,
final String stringFromClient) throws IOException, JDOMException {
BufferedReader breader;
KAFDocument kaf;
String kafString = null;
String lang = properties.getProperty("language");
String outputFormat = properties.getProperty("outpu... | java |
public static <T> Class<?>[] resolveGenerics(Class<T> superType, Class<? extends T> subType) {
checkNotNull(superType, "superType should not be null");
checkNotNull(subType, "subType should not be null");
Class<?> subTypeWithoutProxy = ProxyUtils.cleanProxy(subType);
return TypeResolver.... | java |
@SuppressWarnings("unchecked")
public static <A extends AggregateRoot<I>, I> Class<I> resolveAggregateIdClass(Class<A> aggregateRootClass) {
checkNotNull(aggregateRootClass, "aggregateRootClass should not be null");
return (Class<I>) resolveGenerics(AggregateRoot.class, aggregateRootClass)[0];
} | java |
public static Class<?>[] getAggregateIdClasses(Class<? extends AggregateRoot<?>>[] aggregateRootClasses) {
checkNotNull(aggregateRootClasses, "aggregateRootClasses should not be null");
Class<?>[] result = new Class<?>[aggregateRootClasses.length];
for (int i = 0; i < aggregateRootClasses.length... | java |
@SuppressWarnings("unchecked")
public static <T> Stream<Class<? extends T>> streamClasses(Collection<Class<?>> classes,
Class<? extends T> baseClass) {
return classes
.stream()
.filter(ClassPredicates.classIsDescendantOf(baseClass))
.map(c -> (Clas... | java |
public static Optional<Annotation> getQualifier(AnnotatedElement annotatedElement) {
AnnotatedElement cleanedAnnotatedElement;
if (annotatedElement instanceof Class<?>) {
cleanedAnnotatedElement = ProxyUtils.cleanProxy((Class<?>) annotatedElement);
} else {
cleanedAnnotat... | java |
@SuppressWarnings("unchecked")
public static <T> Optional<Key<T>> resolveDefaultQualifier(Map<Key<?>, Class<?>> bindings,
ClassConfiguration<?> classConfiguration, String property, Class<?> qualifiedClass,
TypeLiteral<T> genericInterface) {
Key<T> key = null;
if (classConfig... | java |
@SuppressWarnings("unchecked")
public static Set<Class<? extends AggregateRoot<?>>> includeSuperClasses(
Collection<Class<? extends AggregateRoot>> aggregateClasses) {
Set<Class<? extends AggregateRoot<?>>> results = new HashSet<>();
for (Class<?> aggregateClass : aggregateClasses) {
... | java |
public void tokenizeToKAF(final KAFDocument kaf) throws IOException {
int noSents = 0;
int noParas = 1;
List<List<Token>> tokens;
if (isNoSeg) {
String[] sentences = text.toArray(new String[text.size()]);
tokens = tokenizer.tokenize(sentences);
} else {
final String[] senten... | java |
public String tokenizeToText() {
final StringBuilder sb = new StringBuilder();
if (isNoSeg) {
String[] sentences = text.toArray(new String[text.size()]);
final List<List<Token>> tokens = tokenizer.tokenize(sentences);
for (final List<Token> tokSentence : tokens) {
for (final Token tok... | java |
void packageArtifacts(final File compileDir, final MavenProject project, final Set<String> bundles)
throws IOException, XCodeException
{
File mainArtifact = createMainArtifactFile(project);
attachBundle(compileDir, project, bundles, mainArtifact);
final File mainArtifactFile = archiveMainArtifa... | java |
Collection<BindingStrategy> collectFromAggregates(Collection<Class<? extends AggregateRoot>> aggregateClasses) {
Collection<BindingStrategy> bindingStrategies = new ArrayList<>();
Map<Type[], Key<?>> allGenerics = new HashMap<>();
for (Class<? extends AggregateRoot<?>> aggregateClass : Business... | java |
@SuppressWarnings("unchecked")
public static <T extends Class<?>> Map<T, Specification<? extends T>> classpathRequestForDescendantTypesOf(
ClasspathScanRequestBuilder classpathScanRequestBuilder, Collection<T> interfaces) {
Map<T, Specification<? extends T>> specsByInterface = new HashMap<>();
... | java |
public final void run(final String[] args) throws IOException, JDOMException {
try {
Parameters parameters = cliArgumentsParser.parse(args);
if (parameters.getStrategy() == Strategy.TOKENIZE) {
annotate(parameters);
} else if (parameters.getStrategy() == Strategy.SERVER) {
server(p... | java |
public SortOption add(String attribute, Direction direction) {
sortedAttributes.add(new SortedAttribute(attribute, direction));
return this;
} | java |
public <T> Comparator<T> buildComparator() {
if (sortedAttributes.isEmpty()) {
return (o1, o2) -> 0;
} else {
Comparator<T> comparator = null;
for (SortedAttribute sortedAttribute : sortedAttributes) {
if (comparator == null) {
comp... | java |
private int findPartnerNodeId( Tree<Row> current, Type type ){
switch( type ) {
case JOIN_FIRST:
case JOIN_ALL:
case WHILE_DO_END:
// The partner is the previous sibling which is the SPLIT or WHILE_DO_BEGIN
return current.getPrevious().getConte... | java |
protected File zipSubfolder(File rootDir, String zipSubFolder, String zipFileName, String archiveFolder)
throws MojoExecutionException
{
int resultCode = 0;
try {
File scriptDirectory = new File(project.getBuild().getDirectory(), "scripts").getCanonicalFile();
scriptDirectory.deleteOnExi... | java |
@RequestMapping(method = RequestMethod.GET, value = "/workflowInstance/search",
produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.TEXT_XML_VALUE})
public ResponseEntity<List<WorkflowInstanceRestModel>> findInstances( @RequestParam(required = false) String label1,
... | java |
public SmiSymbol resolveReference(IdToken idToken, XRefProblemReporter reporter) {
// doesn't work anymore with hardcoded missing symbols
// if (!idToken.getLocation().getSource().equals(getIdToken().getLocation().getSource())) {
// // note this check is not entirely fool-proof in case multiple module... | java |
public SmiOidNode findByOidPrefix(int... oid) {
SmiOidNode parent = getRootNode();
for (int subId : oid) {
SmiOidNode result = parent.findChild(subId);
if (result == null) {
return parent;
}
parent = result;
}
return null;
... | java |
private static void validateReservedVariableNames( Graph graph, List<String> errors ){
for( Node node : graph.getNodes() ){
if( node instanceof BeanAsyncCallActivity ){
validateReservedVariablesFromMapping( ((BeanAsyncCallActivity)node).getResultMapping(), graph, node, errors );
... | java |
public SmiType createIntegerType(IdToken idToken, IntKeywordToken intToken, Token applicationTagToken, List<SmiNamedNumber> namedNumbers, List<SmiRange> rangeConstraints) {
if (idToken == null && intToken.getPrimitiveType() == INTEGER && namedNumbers == null && rangeConstraints == null) {
return Smi... | java |
public static String asString(Boolean flag) {
return flag == null ? null : (flag ? YES_AS_STRING : NO_AS_STRING);
} | java |
public static Boolean asBoolean(String flag) {
return flag == null ? null : flag.equals(YES_AS_STRING);
} | java |
protected PListAccessor getInfoPListAccessor(XCodeContext.SourceCodeLocation location, String configuration,
String sdk)
throws MojoExecutionException, XCodeException
{
File plistFile = getPListFile(location, configuration, sdk);
if (!plistFile.isFile()) {
throw new MojoExecutionExceptio... | java |
public List<WorkUnit> findNewWorkUnits( Date now, String clusterName ){
if( sqlCache == null || !ObjectUtils.equals( cachedSqlClusterName, clusterName ) ){
sqlCache = getSql( clusterName );
cachedSqlClusterName = clusterName;
}
Object[] args = {now};
return getJdb... | java |
@SuppressWarnings("unchecked")
public static <T extends Tuple> T create(Object... objects) {
Class<? extends Tuple> tupleClass = classOfTuple(objects.length);
try {
return (T) tupleClass.getMethod("fromArray", Object[].class)
.invoke(null, new Object[]{objects});
... | java |
public static Class<? extends Tuple> classOfTuple(int cardinality) {
switch (cardinality) {
case 1:
return Unit.class;
case 2:
return Pair.class;
case 3:
return Triplet.class;
case 4:
return Quartet.c... | java |
@SuppressWarnings("unchecked")
public static <T> Class<T>[] itemClasses(Tuple tuple) {
Class<?>[] itemClasses = new Class[tuple.getSize()];
int index = 0;
for (Object o : tuple) {
itemClasses[index++] = o.getClass();
}
return (Class<T>[]) itemClasses;
} | java |
private String buildMessage( String rawMessage ){
StringBuilder msg = new StringBuilder();
if( changeLogName != null ){
msg.append( changeLogName ).append( ": " );
}
if( changeSetName != null ){
msg.append( changeSetName.replace( changeLogName + "::", "" ) ).appen... | java |
public String toSqlString(Object value) {
if (value == null) {
return "null";
}
String val = String.valueOf(value);
if (value instanceof Integer ||
value instanceof Float ||
value instanceof Double ||
value instanceof Long) {
return val;
} else ... | java |
private static void createDirectory(final File directory) throws MojoExecutionException
{
try {
com.sap.prd.mobile.ios.mios.FileUtils.deleteDirectory(directory);
}
catch (IOException ex) {
throw new MojoExecutionException("", ex);
}
if (!directory.mkdirs())
throw new MojoExecut... | java |
private Tree<Row> downRight( Element token ){
return current = current.addChild( Tree.of( new Row( token ) ) );
} | java |
private Tree<Row> downLeft( Element token ){
return current = current.getParent().addSibling( Tree.of( new Row( token ) ) );
} | java |
private Tree<Row> down( Element token ){
return current = current.addSibling( Tree.of( new Row( token ) ) );
} | java |
private Tree<Row> here( Element token ){
current.getContent().addToken( token );
return current;
} | java |
public static <I> Result<I> rangeResult(List<I> result, long offset, long fullRequestSize) {
return new Result<>(result, offset, fullRequestSize);
} | java |
T get(long index) {
checkRange(index);
if (checkSubRange(index)) {
// cannot exceed Integer.MAX_VALUE (checked by checkSubRange)
return subList.get((int) (index - subListOffset));
}
return null;
} | java |
List<T> subList(long from, long to) {
if (fullListSize > 0 && to - from > 0) {
checkRange(from);
// subList takes a [from;to[ range
checkRange(to - 1);
// check if the data of the required sub list are available
assertSubRange(from, to - 1);
... | java |
private void assertSubRange(long from, long to) {
if (!checkSubRange(from) || !checkSubRange(to)) {
throw new IndexOutOfBoundsException("Required data for the sub list [" + from + "," + (to + 1) + "[ have "
+ "not been loaded in the virtual list.");
}
} | java |
public static Object getFieldValue(Object candidate, Field field) {
try {
return ReflectUtils.getValue(ReflectUtils.makeAccessible(field), candidate);
} catch (Exception e) {
throw BusinessException.wrap(e, BusinessErrorCode.ERROR_ACCESSING_FIELD)
.put("classN... | java |
public static Optional<Field> resolveField(Class<?> someClass, String fieldName) {
return fieldCache.get(new FieldReference(someClass, fieldName));
} | java |
public static String removeBrackets( String condition ){
String value = StringUtils.strip( condition );
if( value != null && value.length() >= 3 ){
return value.substring( 2, value.length() - 1 );
}
return value;
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.