code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public int read(byte b[], int off, int len) throws IOException {
return IOUtils.read(inStream, b, off, len);
} | java |
public void addNamedParam(final String name, final ParamInfo paramInfo) {
check(!named.containsKey(name),
"Duplicate parameter %s declaration at position %s", name, paramInfo.position);
named.put(name, paramInfo);
} | java |
public void addStaticElVarValue(final String name, final String value) {
check(!staticElValues.containsKey(name),
"Duplicate el variable %s value declaration: %s (original: %s)", name, value,
staticElValues.get(name));
check(!dynamicElValues.contains(name),
... | java |
public void addDynamicElVarValue(final String name) {
check(!dynamicElValues.contains(name),
"Duplicate dynamic el variable %s declaration", name);
check(!staticElValues.containsKey(name),
"El variable %s can't be registered as dynamic, because static declaration already ... | java |
private String generateXmlSchema(Reader cobolReader,
String targetNamespace, String targetXmlSchemaName,
final String xsltFileName) {
log.debug("XML schema {} generation started", targetXmlSchemaName
+ XSD_FILE_EXTENSION);
String xmlSchemaSource = cob2xsd.transla... | java |
private Map < String, String > generateConverterClasses(
String xmlSchemaSource, String targetPackageName) {
log.debug("Converter support classes generation started");
Map < String, String > codeMap = xsd2CobolTypes.generate(
new StringReader(xmlSchemaSource), targetPackageN... | java |
private String generateAvroSchema(String xmlSchemaSource,
String targetPackageName, String targetAvroSchemaName)
throws IOException {
log.debug("Avro schema {} generation started", targetAvroSchemaName
+ AVSC_FILE_EXTENSION);
String avroSchemaSource = cob2AvroTra... | java |
private void avroCompile(String avroSchemaSource, File avroSchemaFile,
File javaTargetFolder) throws IOException {
log.debug("Avro compiler started for: {}", avroSchemaFile);
Schema.Parser parser = new Schema.Parser();
Schema schema = parser.parse(avroSchemaSource);
Specifi... | java |
public static TxConfig buildConfig(final Class<?> type, final Method method, final boolean useDefaults) {
final Transactional transactional = findAnnotation(type, method, Transactional.class, useDefaults);
TxConfig res = null;
if (transactional != null) {
final TxType txType = findAn... | java |
private static List<Class<? extends Exception>> wrapExceptions(final Class<? extends Exception>... list) {
return list.length == 0 ? null : Arrays.asList(list);
} | java |
public void setTitleGaps(int gapBetweenIconAndTitle,
int gapBetweenTitleAndComponents, int gapBetweenComponents) {
gapBetweenIconAndTitle = Math.max(gapBetweenIconAndTitle, 0);
gapBetweenTitleAndComponents = Math.max(gapBetweenTitleAndComponents, 0);
gapBetweenComponents = Math.max(gapBetweenComponents,... | java |
public static void checkExec(final boolean condition, final String message, final Object... args) {
if (!condition) {
throw new MethodExecutionException(String.format(message, args));
}
} | java |
public static List<String> findVars(final String str) {
final List<String> vars = new ArrayList<String>();
final char[] strArray = str.toCharArray();
int i = 0;
while (i < strArray.length - 1) {
if (strArray[i] == VAR_START && strArray[i + 1] == VAR_LEFT_BOUND) {
... | java |
public static String replace(final String str, final Map<String, String> params) {
final StringBuilder sb = new StringBuilder(str.length());
final char[] strArray = str.toCharArray();
int i = 0;
while (i < strArray.length - 1) {
if (strArray[i] == VAR_START && strArray[i + 1]... | java |
public static void validate(final String string, final List<String> params) {
final List<String> vars = findVars(string);
for (String param : params) {
Preconditions.checkState(vars.contains(param),
"Variable '%s' not found in target string '%s'", param, string);
... | java |
private void expand(boolean immediately) {
if (locked == false && inAction == false && collapsed) {
inAction = true;
CollapsiblePanelListener[] array =
listeners.getListeners(CollapsiblePanelListener.class);
for (CollapsiblePanelListener cpl : array) {
cpl.panelWillExpand(new CollapsiblePanelEvent(this)... | java |
public void setReverseLayout(boolean reverseLayout) {
if (mPendingSavedState != null && mPendingSavedState.mReverseLayout != reverseLayout) {
// override pending state
mPendingSavedState.mReverseLayout = reverseLayout;
}
if (reverseLayout == mReverseLayout) {
... | java |
public static void command(final ODatabaseObject db, final String command, final Object... args) {
db.command(new OCommandSQL(String.format(command, args))).execute();
} | java |
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT")
public static void dropIndex(final ODatabaseObject db, final String indexName) {
// Separated to overcome findbugs false positive "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT" for dropIndex method.
db.getMetadata().getIndexManager().dropIndex(... | java |
private void configureCustomTypes() {
// empty binding is required in any case
final Multibinder<OObjectSerializer> typesBinder =
Multibinder.newSetBinder(binder(), OObjectSerializer.class);
if (!customTypes.isEmpty()) {
for (Class<? extends OObjectSerializer> type : ... | java |
protected void loadOptionalPool(final String poolBinder) {
try {
final Method bindPool = OrientModule.class.getDeclaredMethod("bindPool", Class.class, Class.class);
bindPool.setAccessible(true);
try {
Class.forName(poolBinder)
.getConst... | java |
@SuppressWarnings("unchecked")
private static boolean isParametersCompatible(final List<Class<?>> params,
final List<ParamInfo> ordinalParamInfos) {
boolean resolution = params.size() == ordinalParamInfos.size();
if (resolution && !params.isEmpty()) ... | java |
public static ElDescriptor analyzeQuery(final GenericsContext genericsContext, final String query) {
final List<String> vars = ElUtils.findVars(query);
ElDescriptor descriptor = null;
if (!vars.isEmpty()) {
descriptor = new ElDescriptor(vars);
checkGenericVars(descriptor,... | java |
public static void check(final boolean condition, final String message, final Object... args) {
if (!condition) {
throw new MethodDefinitionException(String.format(message, args));
}
} | java |
private static Object jdk8(final Class<?> type, final Object object) {
try {
// a bit faster than resolving it each time
if (jdk8OptionalFactory == null) {
lookupOptionalFactoryMethod(type);
}
return jdk8OptionalFactory.invoke(null, object);
... | java |
public void setEngineConfigMap(Map<String, Object> engineConfigMap) {
if (engineConfigMap != null) {
this.engineConfig.putAll(engineConfigMap);
}
} | java |
public RythmEngine createRythmEngine() throws IOException, RythmException {
Map<String, Object> p = new HashMap<String, Object>();
p.put(RythmConfigurationKey.ENGINE_PLUGIN_VERSION.getKey(), Version.VALUE);
// Load config file if set.
if (this.configLocation != null) {
logger.info("Loading Ryth... | java |
private static int getRecordLen(byte[] hostData, int start, int length) {
int len = getRawRdw(hostData, start, length);
if (len < RDW_LEN || len > hostData.length) {
throw new IllegalArgumentException(
"Record does not start with a Record Descriptor Word");
}
... | java |
public String translate(XmlSchema xmlSchema, String avroNamespace,
String avroSchemaName) throws Xsd2AvroTranslatorException {
log.debug("XML Schema to Avro Schema translator started");
final Map < QName, XmlSchemaElement > items = xmlSchema.getElements();
ObjectNode rootAvroSchema... | java |
private void visit(XmlSchema xmlSchema, final XmlSchemaElement xsdElement,
final int level, final ArrayNode avroFields)
throws Xsd2AvroTranslatorException {
/*
* If this element is referencing another, it might not be useful to
* process it.
*/
if (xsd... | java |
private void visit(XmlSchema xmlSchema, XmlSchemaComplexType xsdType,
final int level, final ArrayNode avroFields) {
visit(xmlSchema, xsdType.getParticle(), level, avroFields);
} | java |
private void visit(XmlSchemaSimpleType xsdType, final int level,
final String avroFieldName, long minOccurs, long maxOccurs,
ArrayNode avroFields) throws Xsd2AvroTranslatorException {
Object avroType = getAvroPrimitiveType(avroFieldName, xsdType,
maxOccurs > 1, minOccurs... | java |
public static boolean isBigDecimal(Schema schema) {
if (Type.BYTES == schema.getType()) {
JsonNode logicalTypeNode = schema.getJsonProp("logicalType");
if (logicalTypeNode != null
&& "decimal".equals(logicalTypeNode.asText())) {
return true;
... | java |
protected void configureAop() {
final RepositoryMethodInterceptor proxy = new RepositoryMethodInterceptor();
requestInjection(proxy);
// repository specific method annotations (query, function, delegate, etc.)
bindInterceptor(Matchers.any(), new AbstractMatcher<Method>() {
@O... | java |
protected void bindExecutor(final Class<? extends RepositoryExecutor> executor) {
bind(executor).in(Singleton.class);
executorsMultibinder.addBinding().to(executor);
} | java |
protected void loadOptionalExecutor(final String executorBinder) {
try {
final Method bindExecutor = RepositoryModule.class.getDeclaredMethod("bindExecutor", Class.class);
bindExecutor.setAccessible(true);
try {
Class.forName(executorBinder)
... | java |
public void setAdapter(Adapter adapter) {
if (mAdapter != null) {
mAdapter.unregisterAdapterDataObserver(mObserver);
}
// end all running animations
if (mItemAnimator != null) {
mItemAnimator.endAnimations();
}
// Since animations are ended, mLayou... | java |
private void addAnimatingView(View view) {
boolean alreadyAdded = false;
if (mNumAnimatingViews > 0) {
for (int i = mAnimatingViewIndex; i < getChildCount(); ++i) {
if (getChildAt(i) == view) {
alreadyAdded = true;
break;
... | java |
private void removeAnimatingView(View view) {
if (mNumAnimatingViews > 0) {
for (int i = mAnimatingViewIndex; i < getChildCount(); ++i) {
if (getChildAt(i) == view) {
removeViewAt(i);
--mNumAnimatingViews;
if (mNumAnimatingV... | java |
void scrollByInternal(int x, int y) {
int overscrollX = 0, overscrollY = 0;
consumePendingUpdateOperations();
if (mAdapter != null) {
eatRequestLayout();
if (x != 0) {
final int hresult = mLayout.scrollHorizontallyBy(x, mRecycler, mState);
... | java |
public boolean fling(int velocityX, int velocityY) {
if (Math.abs(velocityX) < mMinFlingVelocity) {
velocityX = 0;
}
if (Math.abs(velocityY) < mMinFlingVelocity) {
velocityY = 0;
}
velocityX = Math.max(-mMaxFlingVelocity, Math.min(velocityX, mMaxFlingVeloc... | java |
private void pullGlows(int overscrollX, int overscrollY) {
if (overscrollX < 0) {
if (mLeftGlow == null) {
mLeftGlow = new EdgeEffectCompat(getContext());
mLeftGlow.setSize(getMeasuredHeight() - getPaddingTop() - getPaddingBottom(),
getMeasured... | java |
void viewRangeUpdate(int positionStart, int itemCount) {
final int childCount = getChildCount();
final int positionEnd = positionStart + itemCount;
for (int i = 0; i < childCount; i++) {
final ViewHolder holder = getChildViewHolderInt(getChildAt(i));
if (holder == null) ... | java |
void markKnownViewsInvalid() {
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
final ViewHolder holder = getChildViewHolderInt(getChildAt(i));
if (holder != null) {
holder.addFlags(ViewHolder.FLAG_UPDATE | ViewHolder.FLAG_INVALID);
... | java |
void postAdapterUpdate(UpdateOp op) {
mPendingUpdates.add(op);
if (mPendingUpdates.size() == 1) {
if (mPostUpdatesOnAnimation && mHasFixedSize && mIsAttached) {
ViewCompat.postOnAnimation(this, mUpdateChildViewsRunnable);
} else {
mAdapterUpdateDur... | java |
public int getChildPosition(View child) {
final ViewHolder holder = getChildViewHolderInt(child);
return holder != null ? holder.getPosition() : NO_POSITION;
} | java |
public long getChildItemId(View child) {
if (mAdapter == null || !mAdapter.hasStableIds()) {
return NO_ID;
}
final ViewHolder holder = getChildViewHolderInt(child);
return holder != null ? holder.getItemId() : NO_ID;
} | java |
public View findChildViewUnder(float x, float y) {
final int count = getChildCount();
for (int i = count - 1; i >= 0; i--) {
final View child = getChildAt(i);
final float translationX = ViewCompat.getTranslationX(child);
final float translationY = ViewCompat.getTransl... | java |
protected int getHorizontalSnapPreference() {
return mTargetVector == null || mTargetVector.x == 0 ? SNAP_TO_ANY :
mTargetVector.x > 0 ? SNAP_TO_END : SNAP_TO_START;
} | java |
protected int getVerticalSnapPreference() {
return mTargetVector == null || mTargetVector.y == 0 ? SNAP_TO_ANY :
mTargetVector.y > 0 ? SNAP_TO_END : SNAP_TO_START;
} | java |
protected void updateActionForInterimTarget(Action action) {
// find an interim target position
PointF scrollVector = computeScrollVectorForPosition(getTargetPosition());
if (scrollVector == null || (scrollVector.x == 0 && scrollVector.y == 0)) {
Log.e(TAG, "To support smooth scrolli... | java |
public int calculateDyToMakeVisible(View view, int snapPreference) {
final RecyclerView.LayoutManager layoutManager = getLayoutManager();
if (!layoutManager.canScrollVertically()) {
return 0;
}
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)
... | java |
public int calculateDxToMakeVisible(View view, int snapPreference) {
final RecyclerView.LayoutManager layoutManager = getLayoutManager();
if (!layoutManager.canScrollHorizontally()) {
return 0;
}
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)
... | java |
private Class<?> resolveTargetType(final Class<?> listenerType, final Class<?> declaredTargetType) {
Class<?> target = null;
if (RequiresRecordConversion.class.isAssignableFrom(listenerType)) {
target = GenericsResolver.resolve(listenerType)
.type(RequiresRecordConversion... | java |
public static String methodToString(final Class<?> type, final Method method) {
final StringBuilder res = new StringBuilder();
res.append(type.getSimpleName()).append('#').append(method.getName()).append('(');
int i = 0;
for (Class<?> param : method.getParameterTypes()) {
if ... | java |
public static void checkParamExtensionCompatibility(
final Class<? extends RepositoryMethodDescriptor> descriptorType,
final Class<? extends MethodParamExtension> paramExtType) {
check(isCompatible(paramExtType, MethodParamExtension.class, descriptorType),
"Param extensio... | java |
public static void checkAmendExtensionsCompatibility(
final Class<? extends RepositoryMethodDescriptor> descriptorType,
final List<Annotation> extensions) {
final List<Class<? extends AmendMethodExtension>> exts =
Lists.transform(extensions, new Function<Annotation, Class... | java |
public static List<AmendExecutionExtension> filterCompatibleExtensions(
final List<AmendExecutionExtension> extensions,
final Class<? extends RepositoryMethodDescriptor> descriptorType) {
@SuppressWarnings("unchecked")
final Class<? extends AmendExecutionExtension> supportedExten... | java |
public void disposeTooltip() {
if (popup != null) {
timer.stop();
popup.setVisible(false);
popup = null;
}
} | java |
private void showTooltip() {
Wrap tooltipLabel = new Wrap(toolTipWrapWidth);
tooltipLabel.setForeground(getForeground());
tooltipLabel.setFont(ToolTipButton.this.getFont());
tooltipLabel.setText(text);
JPanel panel = new JPanel();
panel.setBackground(toolTipBackground);
panel.setLayout(new ... | java |
public static Collection<MatchedMethod> filterByClosestParams(
final Collection<MatchedMethod> possibilities, final int paramsCount) {
Collection<MatchedMethod> res = null;
for (int i = 0; i < paramsCount; i++) {
final Collection<MatchedMethod> filtered = filterByParam(possibilit... | java |
private ODatabaseDocument checkAndAcquireConnection() {
final ODatabaseDocument res;
if (userManager.isSpecificUser()) {
// non pool-managed connection for different user
res = orientDB.get().open(database, userManager.getUser(), userManager.getPassword());
} else {
... | java |
public static void trackIdChange(final ODocument document, final Object pojo) {
if (document.getIdentity().isNew()) {
ORecordInternal.addIdentityChangeListener(document, new OIdentityChangeListener() {
@Override
public void onBeforeIdentityChange(final ORecord record)... | java |
private static Field findIdField(final Object value) {
Field res = null;
final Class<?> type = value.getClass();
if (ODatabaseRecordThreadLocal.instance().isDefined()) {
res = OObjectEntitySerializer.getIdField(type);
} else {
final String idField = OObjectSeriali... | java |
private static Component getCurrentModal_(RootPaneContainer rootPane) {
synchronized (modals) {
Modal modal = modals.get(rootPane);
if (modal != null) {
if (modal.getSize() > 0) {
return modal.components.get(modal.components.size() - 1);
}
}
return null;
}
} | java |
private static void closeCurrentModal_(RootPaneContainer rootPane) {
synchronized (modals) {
Modal modal = modals.get(rootPane);
if (modal != null) {
modal.closeCurrent();
if (modal.getSize() == 0) {
modals.remove(rootPane);
}
}
}
} | java |
public static void closeModal(Component component) {
synchronized (modals) {
RootPaneContainer frame = null;
Modal modal = null;
Iterator<Entry<RootPaneContainer, Modal>> it =
modals.entrySet().iterator();
while (it.hasNext()) {
Entry<RootPaneContainer, Modal> entry = it.next();
modal = entry.getV... | java |
private static void closeAllModals_(RootPaneContainer rootPane) {
synchronized (modals) {
Modal modal = modals.get(rootPane);
if (modal != null) {
modal.closeAll();
modals.remove(rootPane);
}
}
} | java |
private static boolean hasModal_(RootPaneContainer rootPane) {
synchronized (modals) {
Modal modal = modals.get(rootPane);
if (modal != null && modal.getSize() > 0) {
return true;
}
return false;
}
} | java |
private static Modal getModal(RootPaneContainer rootPane) {
synchronized (modals) {
Modal modal = modals.get(rootPane);
if (modal == null) {
modal = new Modal(rootPane);
modals.put(rootPane, modal);
}
return modal;
}
} | java |
public static boolean isModal(Component component) {
synchronized (modals) {
Iterator<Entry<RootPaneContainer, Modal>> it =
modals.entrySet().iterator();
while (it.hasNext()) {
Entry<RootPaneContainer, Modal> entry = it.next();
if (entry.getValue().components.contains(component)) {
return true;
}
... | java |
public static void addModal(JInternalFrame frame, Component component,
ModalListener listener) {
addModal_(frame, component, listener, defaultModalDepth);
} | java |
public static void addModal(JFrame frame, Component component,
ModalListener listener, Integer modalDepth) {
addModal_(frame, component, listener, modalDepth);
} | java |
private static void addModal_(RootPaneContainer rootPane,
Component component, ModalListener listener,
Integer modalDepth) {
synchronized (modals) {
if (isModal(component) == false) {
getModal(rootPane).addModal(component, listener, modalDepth);
}
}
} | java |
private static int getModalCount_(RootPaneContainer rootPane) {
synchronized (modals) {
Modal modal = modals.get(rootPane);
if (modal != null) {
return modal.getSize();
}
return 0;
}
} | java |
private void closeCurrent() {
if (components.size() > 0) {
Component component = components.remove(components.size() - 1);
getModalPanel().removeAll();
fireCloseActionListener(listeners.get(component));
listeners.remove(component);
if (components.size() > 0) {
showNextComponent();
} else {
resto... | java |
private void close(Component component) {
if (components.size() > 0) {
if (components.contains(component) == false) {
return;
}
components.remove(component);
depths.remove(component);
getModalPanel().removeAll();
fireCloseActionListener(listeners.get(component));
listeners.remove(component);
... | java |
private void closeAll() {
getModalPanel().removeAll();
components.clear();
depths.clear();
listeners.clear();
restoreRootPane();
} | java |
private void addModal(Component component, ModalListener listener,
Integer modalDepth) {
if (modalDepth == null) {
modalDepth = defaultModalDepth;
}
if (components.contains(component) == false) {
rootPane.getLayeredPane().remove(getModalPanel());
rootPane.getLayeredPane().add(getModalPanel(), modalDe... | java |
private ModalPanel getModalPanel() {
if (modalPanel == null) {
modalPanel = new ModalPanel();
modalPanel.setLayout(new ModalLayout());
}
return modalPanel;
} | java |
public static RootPaneContainer getRootPaneContainer(Component component) {
if (component instanceof RootPaneContainer) {
return (RootPaneContainer) component;
}
for (Container p = component.getParent(); p != null; p = p.getParent()) {
if (p instanceof RootPaneContainer) {
return (RootPaneContainer) p;
}... | java |
public static ResultDescriptor analyzeReturnType(final DescriptorContext context,
final Class<? extends Collection> returnCollectionType) {
final Method method = context.method;
final MethodGenericsContext generics = context.generics.method(method);
... | java |
protected void recycleByRenderState(RecyclerView.Recycler recycler, RenderState renderState) {
if (renderState.mLayoutDirection == RenderState.LAYOUT_START) {
recycleViewsFromEnd(recycler, renderState.mScrollingOffset);
} else {
recycleViewsFromStart(recycler, renderState.mScroll... | java |
public static void check(final Object result, final Class<?> targetType) {
if (result != null && !targetType.isAssignableFrom(result.getClass())) {
// note: conversion logic may go wrong (e.g. because converter expect collection input mostly and may
// not work correctly for single eleme... | java |
@SuppressWarnings("unchecked")
public static Object convertToCollection(final Object result, final Class collectionType,
final Class targetEntity, final boolean projection) {
final Object converted;
if (collectionType.equals(Iterator.class)) {
... | java |
@SuppressWarnings("PMD.LooseCoupling")
public static Object convertToArray(final Object result, final Class entityType, final boolean projection) {
final Collection res = result instanceof Collection
// no projection because its applied later
? (Collection) result : convertTo... | java |
public static void check(final boolean condition, final String message, final Object... args) {
if (!condition) {
throw new SchemeInitializationException(String.format(message, args));
}
} | java |
public <T> T doInTransaction(final TxConfig config, final TxAction<T> action) {
return txTemplate.doInTransaction(config, action);
} | java |
public boolean collapsePanel() {
if (mFirstLayout) {
mSlideState = SlideState.COLLAPSED;
return true;
} else {
if (mSlideState == SlideState.HIDDEN || mSlideState == SlideState.COLLAPSED)
return false;
return collapsePanel(mSlideableView, 0... | java |
public boolean expandPanel(float mSlideOffset) {
if (mSlideableView == null || mSlideState == SlideState.EXPANDED) return false;
mSlideableView.setVisibility(View.VISIBLE);
return expandPanel(mSlideableView, 0, mSlideOffset);
} | java |
public void showPanel() {
if (mFirstLayout) {
mSlideState = SlideState.COLLAPSED;
} else {
if (mSlideableView == null || mSlideState != SlideState.HIDDEN) return;
mSlideableView.setVisibility(View.VISIBLE);
requestLayout();
smoothSlideTo(0, 0);... | java |
public void hidePanel() {
if (mFirstLayout) {
mSlideState = SlideState.HIDDEN;
} else {
if (mSlideState == SlideState.DRAGGING || mSlideState == SlideState.HIDDEN) return;
int newTop = computePanelTopPosition(0.0f);
smoothSlideTo(computeSlideOffset(newTop)... | java |
boolean smoothSlideTo(float slideOffset, int velocity) {
if (!isSlidingEnabled()) {
// Nothing to do.
return false;
}
int panelTop = computePanelTopPosition(slideOffset);
if (mDragHelper.smoothSlideViewTo(mSlideableView, mSlideableView.getLeft(), panelTop)) {
... | java |
public static UnsubscribeMessage createCleanupMessage(WebSocketSession session) {
UnsubscribeMessage msg = new UnsubscribeMessage("**");
msg.setWebSocketSessionId(session.getId());
msg.setPrincipal(session.getPrincipal());
msg.setWampSession(new WampSession(session));
msg.cleanup = true;
return msg;
} | java |
public static long[] parseCoins(long value) {
long[] result = new long[3];
if (value < 0) return result;
long temp = value;
result[2] = temp % 100;
temp = temp / 100;
result[1] = temp % 100;
result[0] = temp / 100;
return result;
} | java |
@Override
public void handleMessageFromClient(WebSocketSession session,
WebSocketMessage<?> webSocketMessage, MessageChannel outputChannel) {
Assert.isInstanceOf(TextMessage.class, webSocketMessage);
WampMessage wampMessage = null;
try {
wampMessage = WampMessage.fromJson(session, this.jsonFactory,
(... | java |
@Override
public void handleMessageToClient(WebSocketSession session, Message<?> message) {
if (!(message instanceof WampMessage)) {
logger.error("Expected WampMessage. Ignoring " + message + ".");
return;
}
boolean closeWebSocketSession = false;
try {
String json = ((WampMessage) message).toJson(thi... | java |
private Set<Field> getItemFields() {
Class next = Item.class;
Set<Field> fields = new HashSet<>(getFields(next));
while (next.getSuperclass() != Object.class) {
next = next.getSuperclass();
fields.addAll(getFields(next));
}
return fields;
} | java |
private List<Field> getFields(Class given) {
Field[] fs = given.getDeclaredFields();
return new ArrayList<>(Arrays.asList(fs));
} | java |
public static void setInstance(Cache cache) throws GuildWars2Exception {
if (instance != null)
throw new GuildWars2Exception(ErrorCode.Other, "Instance already initialized");
instance = new GuildWars2(cache);
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.